Module presets

Source
Expand description

Keyframe presets, motion presets and clip templates — capture from clips and apply back. Curve presets store keys normalised to 0..1 of the clip length (stretched to the target clip’s duration when applied) or as absolute seconds (kept as saved).

Structs§

TemplateData 🔒

Constants§

PROPS 🔒
The fixed (label, property) pairs shared by capture and apply.

Functions§

apply_curve
Apply a curve preset to a property: normalised times are stretched to clip_duration, absolute presets keep their seconds. Replaces existing keys. scaled is kept for the callers’ “exact” button but is only meaningful for absolute presets, which ignore the duration anyway — placing a normalised preset’s 0..1 times as seconds would crush the whole animation into the clip’s first second. See capture_curve: nothing but tests saves absolute.
apply_effects
Apply a preset to clip: a graph replaces the clip’s graph (with fresh node ids, so a later add_node cannot hand out one the preset already used), a stack replaces the effects and drops the graph, which would otherwise keep shadowing them. False when the JSON is not what it claims.
apply_motion
Apply a motion preset to a clip (properties it doesn’t have are skipped; effect params create the effect when missing). scaled as in apply_curve.
builtin_motions
Built-in motion presets (slide in/out from each side, zoom in/out “Ken Burns”, pop, fade in/out, spin).
capture_curve
Snapshot a property’s keys as a preset (normalised unless absolute). None if the property has no keys.
capture_effects
Snapshot a clip’s node graph if it has one, else its effect stack. The JSON’s shape is what tells the two apart afterwards (EffectPreset::is_graph) — nothing else has to be stored.
capture_motion
Capture every animated property of clip (incl. effect params as “: ”).
capture_template
Serialise a group of clips (+ the assets they use) into a Template (times relative to the earliest start).
decode_template
Decode a template into (clips, assets) ready for Project::place_clips. None on malformed JSON.
is_adjustment_template
True when a template holds nothing but adjustment layers — the Presets pane gives those their own section. ponytail: decodes the JSON per frame the list is drawn; templates are a handful of small blobs, memoise if that stops being true.
is_container_template
True when a template holds at least one container clip.
merge_curve
apply_curve’s sibling: ADD the preset’s keys to what the property already has, shifted to start at offset seconds, so two presets can be layered on one property without hand-editing. span is the length a normalised preset is stretched over (callers pass the clip’s remaining time so the merged keys land inside it). A preset key falling on an existing key’s time wins.
merge_motion
Layer a motion preset on top of the clip’s existing keys, starting at clip-local offset and stretched over the time left in the clip (so “slide in left” then “slide in right” can be stacked).
motion 🔒
motion_prop 🔒
Resolve a motion preset label to the clip’s property, creating the effect an “: ” label needs. None for labels this clip cannot hold.
prop_of 🔒
scaled_keys
Convenience: keyframes of a preset scaled to duration (used by the curve editor preview).