cutan.compile.lowering

How the stage compiler lowers the cut-out genre’s actions, and reads a character’s swap sets.

The stage compiler (an.stage.compile) knows no cut-out kind by name. A genre hands it an action lowering (an.genres.ActionKind.lowering) for each kind that is more than a tween or set, and an entity swap declaration (an.genres.EntityKind.swap_declaration) saying what a descriptor declares. Both live here; the code they call is cutan.compile.passes.

>>> from cutan.characters.registration import PlayAction
>>> PLAY_LOWERING.extent_resolver(None)(PlayAction(target="a", animation="hop"))
0.5

Module Attributes

CHARACTERS_STORE

The mall store holding character descriptors (a persisted name).

Functions

character_swap_declaration(entity, mall)

What a character's (migrated) descriptor declares, for the swap vocabulary.

Classes

ExpressionLowering()

The expression action kind: the face solver's input, so it makes no clip of its own.

PlayLowering()

The play action kind, as the stage compiler lowers it (an#7, an#166, an#220).

cutan.compile.lowering.CHARACTERS_STORE: str = 'characters'

The mall store holding character descriptors (a persisted name).

class cutan.compile.lowering.ExpressionLowering[source]

Bases: object

The expression action kind: the face solver’s input, so it makes no clip of its own.

expand(flat_list, **kw)[source]

Drop the expression leaves: _add_face_clips sums them per (node, property).

Return type:

list

class cutan.compile.lowering.PlayLowering[source]

Bases: object

The play action kind, as the stage compiler lowers it (an#7, an#166, an#220).

clip(action, **kw)[source]

The clip of one descriptor play (the presets were expanded already).

expand(flat_list, *, products=None, **kw)[source]

Replace each play of a motion preset by the tweens and sets it stands for, a walk’s gait under the scene’s policy (products, an#348).

Return type:

list

extent_resolver(vocab, *, products=None)[source]

play -> seconds for a play that names no duration, read off its descriptor — and, for a walk, off the gait and scale the expansion will fill in (cutan.compile.passes.preset_context_of(), cutan#12), under the scene’s policy the policy pass left in products (an#348).

Return type:

Callable[[Any], float]

view_of(entity_swaps, vocab, *, duration)[source]

flat -> the view its entity is in then, for characters with per-view face sets.

cutan.compile.lowering.character_swap_declaration(entity, mall)[source]

What a character’s (migrated) descriptor declares, for the swap vocabulary.

None when the store has no descriptor for the entity (a procedural or placeholder rig: its built nodes’ sets ARE its declaration).

Return type:

SwapDeclaration | None