FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Lay out Motion's auto points in the sequence frame when applied (#2588)
MarekSpodBiedry28859f69e50b
diff --git a/crates/engine/src/clip_ops_tests.rs b/crates/engine/src/clip_ops_tests.rsindex 5a8ee62a4..964dedd03 100644--- a/crates/engine/src/clip_ops_tests.rs+++ b/crates/engine/src/clip_ops_tests.rs@@ -1108,4 +1108,11 @@ fn applied_transform_centres_its_points_in_the_clip_picture() {s.execute("effects.setParam", json!({"clip": c, "effect": "transform", "param": "anchor", "value": [10.0, 20.0]})).unwrap();s.execute("effects.resetParam", json!({"clip": c, "effect": "transform", "param": "anchor"})).unwrap();assert_eq!(point(&s, "anchor"), centre);+ // intrinsic effects stay centred in the sequence frame when applied to a smaller clip+ let q = s.active_sequence().unwrap();+ let frame_centre = filmcraft_geom::Vec2::new(f64::from(q.settings.width) / 2.0, f64::from(q.settings.height) / 2.0);+ s.execute("effects.apply", json!({"clips": [c], "effect": "motion"})).unwrap();+ for m in clip(&s, c).effects.iter().filter(|e| e.effect == "motion") {+ assert_eq!(m.param("position").unwrap().value.as_vec2().unwrap(), frame_centre);+ }}diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rsindex a037b4733..9687881f4 100644--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@ -2970,7 +2970,9 @@ fn build() -> Vec<CommandSpec> {for i in t.items.iter_mut().filter(|i| clips.contains(&i.id)) {let mut inst = def.instance();let size = source_sizes.get(&i.id).copied().unwrap_or((fw, fh));- resolve_auto_points(&mut inst, size, size);+ // intrinsic effects (Motion) are laid out in the sequence frame, as `reset_params` does+ let frame = if def.intrinsic { (fw, fh) } else { size };+ resolve_auto_points(&mut inst, frame, size);// standard effects go before the intrinsic ones (render order)let pos = i.effects.iter().position(|e| e.def().is_some_and(|d| d.intrinsic)).unwrap_or(i.effects.len());let pos = if is_audio { i.effects.len() } else { pos };