hierarchy

The Scene’s mobs, as a tree a viewer can walk, with their animatable state.

Two things make this less obvious than listing scene.actors:

  • actors is flat and holds every Animatable ever constructed, including the component mobs a shape builds itself out of, and in construction order – so a child can appear before its parent. The tree is rebuilt from the roots (not mob.parents) downwards instead. Parents are a list: the hierarchy is a graph, and a mob reached by two paths appears under both.

  • The camera and the lights are not in actors at all, so they get their own sections rather than being silently missing.

Mob state does not live on the Mob. Every animatable attribute is a row in the Scene’s timeline, so reading one at a chosen time means materializing the whole timeline at that time, reading, and putting it back – which is what attributes_at() does, and why the caller must hold the session lock.

Functions

attributes_at(scene, mob, time_seconds=None)[source]

A mob’s animatable attributes, optionally as of time_seconds.

Convenience for the single-mob case; reading several mobs at one time should share a single materialized() block rather than repeat it per mob.

attributes_of(scene, mob)[source]

A mob’s animatable attributes, read from the timeline as it stands.

Wrap the call in materialized() to read them at a chosen time instead.

children(mob, include_components=False)[source]

The child rows under one node.

index(scene)[source]

Every node the tree can reach, keyed by node_id().

Built once per request rather than cached: a script may keep authoring while the viewer is open, and a stale index would hide the new mobs.

materialized(scene, time_seconds)[source]

Hold the Scene’s timeline at time_seconds for the block, then undo it.

Materializing points every attribute’s storage at a buffer of values for the requested times, which is what makes an ordinary mob.location read return the frame’s value instead of the authored one. It is global mutation of the Scene, so the caller must hold the viewer’s lock, and it must be undone however the block exits.

time_seconds of None is a no-op, leaving the authoring state in place – the scene as the script last left it.

mob_by_timeline_id(scene)[source]

Mob.id -> mob, for naming the surface behind a rendered fragment.

Mob.id is not unique across views and clones, so the first actor holding an id wins; that is the one that owns the timeline rows the render read.

node_id(mob)[source]

The viewer’s identity for a mob.

Deliberately id(mob) and not mob.id: the latter is the timeline row key, and a packed mob’s mob[i] views and its clones share it, so two different tree nodes would collide.

Return type:

int

roots(scene)[source]

The Scene’s top-level nodes: its root mobs, its camera, its lights.