Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge branch 'worktree-agent-a70a415ce57f73911'

Brandon Thomas54e62c0c883e
diff --cc crates/engine/src/commands/mod.rs
index 7833f8186,e90a44358..69e5ab696
--- a/crates/engine/src/commands/mod.rs
+++ b/crates/engine/src/commands/mod.rs
@@@ -103,7 -104,8 +105,9 @@@ pub fn command_specs() -> &'static [Com
v.extend(file_more::specs());
v.extend(comp_more::specs());
v.extend(frontend::specs());
+ v.extend(track::specs());
+ v.extend(paint::specs());
+ v.extend(puppet::specs());
v.extend(stubs::specs());
v
})
diff --cc crates/engine/src/lib.rs
index fd3af5d3e,2609c8d80..39e363620
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@@ -158,9 -153,12 +158,15 @@@ pub struct EditorState
/// Viewer 3D view per comp (Active Camera / Front / … / Custom View 3 and edited view cameras).
#[serde(default)]
pub views3d: std::collections::BTreeMap<ItemId, effectcraft_render::three_d::Views3D>,
+ /// Tracker panel ▸ Current Track: (tracked layer, tracker group uid) in the active comp.
+ #[serde(default)]
+ pub current_track: Option<(LayerId, Uid)>,
+ /// Paint and Brushes panel options (Brush, Clone Stamp and Eraser tools).
+ #[serde(default)]
+ pub paint: commands::paint::PaintOptions,
+ /// Puppet tool options for new meshes.
+ #[serde(default)]
+ pub puppet: commands::puppet::PuppetOptions,
}
/// What Copy with Property Links / Copy Expression Only put on the clipboard.
diff --cc crates/ui-egui/src/menus.rs
index a938ab4a5,0a7673292..48f9eec96
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@@ -446,15 -447,10 +447,18 @@@ pub fn frontend(app: &mut EffectcraftAp
app.show_panel(PanelKind::Flowchart);
Value::Null
}
+ "track.editTargetDialog" => {
+ crate::panels::tracker::open_target(app)?;
+ Value::Null
+ }
+ "track.optionsDialog" => {
+ crate::panels::tracker::open_options(app)?;
+ Value::Null
+ }
"layer.openLayer" => {
+ let id = p.get("layer").and_then(Value::as_u64).or_else(|| app.session.state.selected_layers.first().map(|l| l.0));
+ app.ui.layer_panel = id;
+ app.ui.layer_view = None;
app.show_panel(PanelKind::Layer);
Value::Null
}
diff --cc crates/ui-egui/src/panels/effect_controls.rs
index f62569731,e353950f0..eda2ed763
--- a/crates/ui-egui/src/panels/effect_controls.rs
+++ b/crates/ui-egui/src/panels/effect_controls.rs
@@@ -485,7 -248,11 +485,11 @@@ fn group_rows
}
}
Node::Group(sg) => {
+ // Paint strokes live in the Timeline only (AE's Paint shows Paint on Transparent).
+ if effectcraft_engine::effects::paint::is_paint(g) {
+ continue;
+ }
- *y += 24.0;
+ *y += ROW;
let open = !app.ui.fx_closed.contains(&sg.uid);
let tw = Rect::from_center_size(pos2(r.min.x + 12.0 + 14.0 * depth as f32, r.center().y), vec2(12.0, 12.0));
if r.max.y >= rect.min.y && r.min.y <= rect.max.y {
diff --cc crates/ui-egui/src/panels/mod.rs
index ebd30a558,7216376bf..03fe21efd
--- a/crates/ui-egui/src/panels/mod.rs
+++ b/crates/ui-egui/src/panels/mod.rs
@@@ -71,7 -72,9 +74,10 @@@ pub fn show(app: &mut EffectcraftApp, u
PanelKind::Markers => misc::markers(app, ui, rect),
PanelKind::Wiggler => misc::wiggler(app, ui, rect),
PanelKind::RenderQueue => render_queue::show(app, ui, rect),
+ PanelKind::Tracker => tracker::show(app, ui, rect),
+ PanelKind::Layer => layer_panel::show(app, ui, rect),
+ PanelKind::Paint => paint_panels::paint(app, ui, rect),
+ PanelKind::Brushes => paint_panels::brushes(app, ui, rect),
other => misc::placeholder(app, ui, rect, other),
}
}
diff --cc crates/ui-egui/src/panels/viewer.rs
index f1962077f,924e6ba9f..68791600c
--- a/crates/ui-egui/src/panels/viewer.rs
+++ b/crates/ui-egui/src/panels/viewer.rs
@@@ -548,10 -551,15 +570,17 @@@ pub fn show(app: &mut EffectcraftApp, u
Tool::PanCamera => egui::CursorIcon::Move,
Tool::Dolly => egui::CursorIcon::ResizeVertical,
t if t.is_shape() || t == Tool::Pen => egui::CursorIcon::Crosshair,
+ t if t.puppet_kind().is_some() => {
+ if pin_hits.iter().any(|h| h.pos.distance(hp) < 8.0) {
+ egui::CursorIcon::Move
+ } else {
+ egui::CursorIcon::Crosshair
+ }
+ }
_ => {
- if handle_hits.iter().any(|(_, _, h)| h.distance(hp) < HANDLE) {
+ if super::tracker::hit_at(&track_hits, hp).is_some() {
+ egui::CursorIcon::Move
+ } else if handle_hits.iter().any(|(_, _, h)| h.distance(hp) < HANDLE) {
egui::CursorIcon::ResizeNwSe
} else {
egui::CursorIcon::Default
@@@ -630,15 -638,11 +659,19 @@@
})
}),
t if t.is_shape() => Some(Gesture::Create { tool: t, start: cpt }),
+ t if t.puppet_kind().is_some() => pin_hits.iter().rev().find(|h| h.pos.distance(press) < 8.0).and_then(|h| {
+ let l = comp.layer(h.layer)?;
+ Some(Gesture::PuppetPin { layer: h.layer, pin: h.pin, inv: l2c(&ectx, l).0.inverse()? })
+ }),
Tool::Orbit | Tool::PanCamera | Tool::Dolly => Some(Gesture::Camera { tool }),
+ Tool::Selection if super::tracker::hit_at(&track_hits, press).is_some() => {
+ let hit = super::tracker::hit_at(&track_hits, press);
+ track_cur.zip(hit).and_then(|((tl, tu), hit)| {
+ let layer = comp.layer(tl)?;
+ let (m, _) = l2c(&ectx, layer);
+ super::tracker::begin_drag(layer, tu, time, &m, hit, map.to_comp(press)).map(|drag| Gesture::Track { layer: tl, tracker: tu, drag })
+ })
+ }
Tool::Selection if vertex_at(press, true).is_some() => vertex_at(press, true).map(|h| Gesture::Tangent {
layer: h.layer,
mask: h.mask,
diff --cc crates/ui-egui/src/state.rs
index f7bc74323,25c8e1919..1fbf58e14
--- a/crates/ui-egui/src/state.rs
+++ b/crates/ui-egui/src/state.rs
@@@ -412,9 -395,12 +444,15 @@@ pub struct UiState
pub start_screen: bool,
/// Composition ▸ Preview ▸ Cache Frames When Idle.
pub cache_when_idle: bool,
+ /// Tracker panel ▸ Motion Source chosen without a tracker yet (layer id).
+ #[serde(default)]
+ pub tracker_source: Option<u64>,
+ /// Layer shown in the Layer panel (None = the first selected layer).
+ #[serde(default)]
+ pub layer_panel: Option<u64>,
+ /// Layer panel View: number of effects rendered (None = through the last Paint effect).
+ #[serde(default)]
+ pub layer_view: Option<usize>,
}
impl Default for UiState {
@@@ -455,7 -434,8 +493,9 @@@
preview_audio: true,
start_screen: false,
cache_when_idle: false,
+ tracker_source: None,
+ layer_panel: None,
+ layer_view: None,
}
}
}
diff --cc docs/architecture.md
index 59d9ef4a5,d618d016a..01e1bba26
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@@ -91,17 -90,17 +91,26 @@@ at composite time. Styled pixels are ca
reuses the cached source/masks/effects. Global Light is one setting per comp, mirrored into every
layer's Blending Options and kept in step after each edit.
+ **Paint and Puppet** are effects whose instances carry nested groups. Paint (`effects::paint`)
+ holds Brush / Clone / Eraser strokes (Path, Stroke Options, Transform, hidden Duration span);
+ strokes rasterize as brush-tip dabs and composite in order, and the layer cache key includes which
+ strokes are visible at the frame. Puppet (`effects::puppet`) holds meshes and pins: the mesh is
+ traced from the input alpha, expanded, and triangulated (Delaunay + constraint recovery, cached
+ by content); pins drive an as-rigid-as-possible solve (Igarashi et al. 2005) each frame and the
+ input is texture-mapped through the deformed triangles. The renderer flattens nested effect
+ groups into `Params` keys (`effects::flatten_params`). Commands: `paint.*`, `puppet.*`.
+
Half, Third and Quarter resolution render proportionally fewer pixels end to end.
+**Motion tracking** (Animation ▸ Track Motion / Stabilize Motion, Window ▸ Tracker): a tracker
+is a `Tracker` group under the layer's Motion Trackers group, with Track Point groups (Feature
+Center, Feature Size, Search Offset, Search Size, Confidence, Attach Point, Attach Point Offset)
+keyframed per analysed frame. `track.analyze` renders the layer's source frames
+(`Renderer::layer_source`) on a background thread (`engine::tracking`, polled like the render
+queue; blocking with `wait`), and `effectcraft-track` matches each point in parallel. One undo step
+covers an analysis. `track.apply` keys the target's Position/Rotation/Scale, the tracked layer's
+Anchor Point and Position (Stabilize), or a Corner Pin effect (Parallel / Perspective).
+
## 5. Expressions
Expressions are JavaScript, run by boa, with After Effects' object model (`thisComp`, `thisLayer`,