CompileResult#
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.pipeline.CompileResult[source]#
Bases:
objectThe compiled panel, with the intermediate results kept for inspection.
Diagnostics – notably whether the camera had to retreat to fit the cast – are part of the result rather than log output, so tooling can surface them.
Example
>>> from scenet import CompileResult, compile_source, render >>> result = compile_source( ... "cast: {a: {reference: alice}}\nscript: [{say: {by: a, text: Hi.}}]" ... ) >>> isinstance(result, CompileResult), result.notes (True, ()) >>> svg = render(result.core, fonts=result.fonts, embed=result.images)
See also
PanelCore, whatcoreholds.CompileNote, each note with its rule.- camera: CameraSolution | None#
The framing the camera chose, or None for a panel whose cast a supplied picture draws: the artist framed it, and the camera does not run. Its type is internal, outside semantic versioning.
- placements: tuple[Placement, ...]#
Where the solver stood each actor, before posing, in cast order. Its type is internal, outside semantic versioning.
- posed: dict[str, ResolvedPuppet]#
Each actor’s puppet, posed, scaled and placed, by actor id. Its type is internal, outside semantic versioning.
- fonts: dict[str, FontMetrics]#
The fonts the lettering was measured in, other than the shipped family’s, by the digest
PanelCore.fontsnames them by. Hand them to the renderer.
- images: dict[str, bytes]#
The supplied pictures it was drawn over, by the digest
PanelCorenames them by: their bytes, for a renderer asked to embed them rather than link them.
- lettering_notes: tuple[CompileNote, ...]#
Faces the document named no file for, and what was used instead – reported in
notesonly when something was actually set in one.
- property notes: tuple[str, ...]#
Human-readable diagnostics about how this panel was compiled.
- Returns:
Zero or more sentences describing decisions the compiler had to make that were not literally what the source asked for – a camera that retreated to fit the cast, a balloon tail that had to bend around a face, a mark drawn partly outside the panel. Each is a
CompileNote’s message, in the order ofcompile_notes, which also names what kind it is.
These are returned rather than logged so that tooling can put them in front of the person who wrote the panel. A camera that silently retreats leaves you with a panel that is quietly not the shot you asked for, which you would eventually notice and have no way to explain.
Example
>>> from scenet import compile_source >>> crowded = compile_source( ... "{panel: {size: [600.0, 400.0]}, camera: {shot: close_up}," ... " cast: {a: {reference: alice}, b: {reference: bob}}," ... " staging: [a left_of b]}" ... ) >>> any("camera retreated" in note for note in crowded.notes) True
- property compile_notes: tuple[CompileNote, ...]#
The notes, each with the name of what kind it is.
- Returns:
The same notes as
notes, in the same order, each a sentence and aCompileNoteRule– the name a gallery entry declares it by, which stays when the sentence is reworded.
Example
>>> from scenet import compile_source >>> crowded = compile_source( ... "{panel: {size: [600.0, 400.0]}, camera: {shot: close_up}," ... " cast: {a: {reference: alice}, b: {reference: bob}}," ... " staging: [a left_of b]}" ... ) >>> [note.rule for note in crowded.compile_notes] ['camera-retreated']
- __init__(core, camera, placements, posed, fonts=<factory>, images=<factory>, lettering_notes=())#