Compiling#
The compiler itself. Source or IR in, Panel Core out.
Every entry point takes the same two optional keyword arguments – library and
metrics – so the character set and the font are both injectable, and neither is
read from the environment.
scenet.pipeline#
The compiler: source through IR to Panel Core.
Each stage is separable and independently testable, which is the point of having tiers at all. The frontend never computes a coordinate, the solver never touches artwork, and the emitter never makes a layout decision.
- scenet.pipeline.CompileNoteRule#
What each kind of compile note is called: a stable name, as a check’s rule has one, by which a gallery entry’s
notes:declares it while the sentence stays free to be reworded. One name per sentence;scenet.diagnostics.COMPILE_NOTESexplains each, and the diagnostics reference gives each an entry.alias of
Literal[‘camera-retreated’, ‘curved-tail’, ‘cropped-mouth’, ‘cropped-marks’, ‘inset-covers-face’, ‘slant-cuts-face’, ‘italic-stand-in’, ‘bold-italic-stand-in’]
- scenet.pipeline.PRESERVE_ASPECT_RATIO: dict[Fit, Literal['xMidYMid slice', 'xMidYMid meet']] = {Fit.CONTAIN: 'xMidYMid meet', Fit.COVER: 'xMidYMid slice'}#
A fit, as SVG’s
preserveAspectRatiosays it.
- scenet.pipeline.DOCUMENT_LOADERS = {'.script': <function _load_script_document>, '.yaml': <function load_scene_document>, '.yml': <function load_scene_document>}#
The same extensions, read as whole documents – panels and the pages they go on.
scenet.compose#
Sparse override between panels.
Borrowed from OpenUSD’s composition arcs, and specifically from over: a panel names
a parent and states only what differs from it.
This matters more for comics than it might look. Consecutive panels in a scene are mostly identical – the same cast, the same staging, the same camera – with one thing changed. Restating all of it per panel is both tedious and a place for inconsistencies to creep in, which is exactly the continuity error comics readers notice.
panels:
p1:
camera: {shot: medium_shot}
cast:
alice: {reference: alice, at: left_third}
p2:
over: p1 # everything from p1...
camera: {shot: close_up} # ...except the framing
Taking something away is JSON Merge Patch’s rule (RFC 7386): “If the value is null,
remove”. cast: {bob: null} leaves Bob out of a panel that would otherwise inherit him.
- class scenet.compose.Dropped[source]#
Bases:
objectA staging relation that named somebody a panel left out.
- __init__(index, relation, actor)#
- scenet.compose.looks_toward(relation, actor, leaving)[source]#
Whether a relation is somebody still drawn looking at an actor who is not.
- Return type:
- scenet.compose.merge(base, override)[source]#
Deep-merge
overrideontobase, withoverridewinning.Mappings merge recursively so that changing one actor’s pose leaves the rest of the cast alone. Lists replace wholesale rather than concatenating:
scriptandstagingare ordered wholes, and appending to an inherited script would make it impossible to write a panel where somebody says less than in the panel before.A
nullis kept, not applied: it has to remove the key from whatever the document is merged over next as well – a scene’s defaults come last – so it issettle, once the document is whole, that takes it out.
- scenet.compose.names(relation, actor)[source]#
Whether a staging relation, as written, names an actor as subject or object.
- Return type:
- scenet.compose.on_their_side(event, cast)[source]#
An off-panel line with no side named, given the side its speaker was written at.
- Return type:
- scenet.compose.relation_text(relation)[source]#
A staging relation as a sentence, however it was written.
- Return type:
- scenet.compose.resolve_beneath(panels)[source]#
Every panel’s
overchain resolved as if nonullhad been written in it.What each removal takes away: whoever a panel leaves out, as they stood in the panels it is over, so a line they speak from off panel can end on their side (
settle).
- scenet.compose.resolve_overrides(panels)[source]#
Resolve every panel’s
overchain into a self-contained document.Panels are resolved lazily with memoisation, so a chain is walked once however many panels hang off it, and declaration order does not matter – a panel may inherit from one declared later.
- scenet.compose.settle(document, *, beneath=None)[source]#
Apply the removals a complete document’s
nullvalues ask for.Every key whose value is
nullgoes, in mappings at any depth – not inside lists, which Merge Patch treats as values. A cast member who goes takes with them every staging relation that names them, since none can hold in a panel they are not in.All but one kind, while they are heard from off panel in it, as a comic script’s
CAROL (OP)has it:bob looking_at carolstill holds, since Bob may look toward the side of the frame she is heard from. That side is the one she was written to stand on,at: left_thirdbeing the left, unless her line names one.- Parameters:
- Return type:
- Returns:
The document, and the relations dropped, in the order they were written.
Example
>>> from scenet.compose import settle >>> settled, dropped = settle({"cast": {"a": {}, "b": None}, "staging": ["a left_of b"]}) >>> settled, [item.actor for item in dropped] ({'cast': {'a': {}}, 'staging': []}, ['b'])