PanelIR#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- class scenet.ir.PanelIR[source]#
Bases:
StrictA complete, validated panel: the language’s real definition.
Every frontend produces one of these and nothing else, which is what lets the YAML syntax and the comic-script syntax coexist without the solver knowing either exists. Nothing here carries a coordinate – computing those is the solver’s job, and keeping them out is what makes a panel reusable at any size.
Validation is strict and total: unknown keys are rejected, every actor id mentioned in
stagingorscriptmust exist incast, and the ordering relations must not contain a cycle. A misspelled key that was silently ignored would produce a panel that is subtly wrong with no indication of why, which for a language meant to be precise is the worst possible failure.Example
>>> from scenet import PanelIR, parse_panel >>> panel = parse_panel("panel: {size: [800.0, 600.0]}") >>> isinstance(panel, PanelIR) True >>> panel.panel.width, panel.camera.shot.value (800.0, 'medium_shot')
See also
compile_ir, to turn one of these into geometry.- description#
What the panel shows, in words, for a reader who cannot see it. Carried into the SVG as its accessible name and never interpreted. Not inherited: a panel drawn
over:another is a different picture. Left out, one is generated from the shot, the setting and the cast.
- direction#
Which way the comic is read:
ltrfrom the top left,rtlfrom the top right, as manga are – panels, pages and the balloons in a panel. Its progression, not its text: the words in a balloon still read left to right. Written once for the whole document; the scene is never mirrored.- Type:
- palette#
What the panel is drawn in:
mono, the value ladder in grey, ortinted, each value in a colour with the same lightness. Colour never changes a value, so a tinted panel is, in monochrome, the mono one. Inherited like any default; a panel may have its own.- Type:
- camera: CameraSpec#
How the cast is framed: the shot, and the camera’s height.
- setting: SettingSpec#
Where and when the panel happens: a named place, tonal masses or a picture behind the cast, with the time of day and the weather.
- lettering: LetteringSpec#
How the lettering is set: the dialogue type size, and the font files.
- cast: dict[str, CastMember]#
Who is in the panel: each actor id, chosen by the author, and the puppet that plays them or the figure a picture draws. Their order means nothing.
- staging: tuple[Relation, ...]#
How the cast stand to each other, as sentences:
alice left_of bob. One relation each.
- script: tuple[SayEvent | CaptionEvent | SfxEvent | SayEvent | CaptionEvent | SfxEvent, ...]#
What is said and heard, in the order it is read:
sayfor a balloon,captionfor a box,sfxfor a sound effect.
- figures()[source]#
The cast members a supplied picture draws, and the figure each plays.
Example
>>> from scenet import parse_panel >>> parse_panel("cast: {ana: {figure: ana_in_red}}").figures() {'ana': 'ana_in_red'}
- property drawn_by_its_picture: bool#
Whether everybody in the cast is a figure the panel’s picture draws.
Then nothing is staged, the camera does not run, and the shot is whatever the artist drew.
- ordering_constraints()[source]#
Normalised (left, right) pairs from both left_of and right_of relations.
- gaze_targets()[source]#
Who is looking at whom.
- Return type:
- Returns:
A mapping from each looking actor to the actor they are looking at. An actor may look at only one target, so a later
looking_atrelation for the same subject replaces an earlier one.
Example
>>> from scenet import parse_panel >>> panel = parse_panel( ... "{cast: {a: {reference: alice}, b: {reference: bob}}," ... " staging: [a looking_at b]}" ... ) >>> panel.gaze_targets() {'a': 'b'}
- off_panel_speakers()[source]#
Who is heard from off panel, and the side each is heard from, if any line names one.
- Return type:
- Returns:
Speaker to the first side a line of theirs names, or None when every line of theirs says only
off_panel: true, in the order they first speak.
Example
>>> from scenet import parse_panel >>> panel = parse_panel( ... "{script: [{say: {by: carol, text: Hi, off_panel: true}}," ... " {say: {by: carol, text: Here, off_panel: left}}]}" ... ) >>> panel.off_panel_speakers() {'carol': <Side.LEFT: 'left'>}