scene¶
The Scene – the unit of authoring and rendering.
A Scene owns everything an animation needs: its actors, its camera and lights,
its own timeline, animation and audio managers, its video settings, and the
render loop it inherits from RenderLoopMixin. Two
Scenes in one process share nothing, so they can be authored and rendered
independently.
Authoring is lazy. Running a script records events on the Scene’s timeline;
nothing is computed until Scene.save_video() or Scene.save_frame()
materializes that recording in batches of frames, builds render primitives and
renders them. Both return a
RenderResult.
save_video leaves the Scene exactly as authored by default (reset=False):
Mobs stay spawned, the timeline keeps its recording, and you can render again –
including a preview taken from inside a with block that has not finished yet.
Pass reset=True for the destructive behaviour a per-run harness wants.
active_scene_method is why Scene.save_video(...) and
scene.save_video(...) are the same call: accessed on an instance it binds to
it, accessed on the class it resolves the active Scene. Class-level access still
reports the real signature, so help() and autodoc work.
The active-Scene stack itself lives in
SceneManager, the one singleton in Algan.
Classes
The container that turns recorded animations into rendered video. |
|
Bind to an instance, or resolve the active Scene when called on Scene. |
Functions
- renders_requested()[source]¶
The number of renders this process has been asked for so far.
- Return type:
int
- warn_if_nothing_rendered(script_path, renders_before)[source]¶
Say so, on stderr, if a script ran to completion and rendered nothing.
Algan is lazy: a script builds a Scene and only
save_videoturns it into a file. A script that forgets the last line therefore runs perfectly, writes nothing, and exits 0 – and the user is left looking for an output file that was never going to exist. Called by the runners that exist to produce one.Returns whether the message was printed.
- Parameters:
renders_before (int)
- Return type:
bool