Skip to content

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

Keep Footage panel overlay/insert edits at full length past the comp end (#795)

MarekSpodBiedry5df37babc32c
diff --git a/crates/engine/src/commands/footage_panel.rs b/crates/engine/src/commands/footage_panel.rs
index f984d53fd..7b3bbe5cc 100644
--- a/crates/engine/src/commands/footage_panel.rs
+++ b/crates/engine/src/commands/footage_panel.rs
@@ -179,7 +179,8 @@ fn edit_into_comp(s: &mut Session, p: &Value, ripple: bool) -> Result<Value> {
let mut l = build::layer(proj, &comp, &it.name, src, size, Some(len));
l.start_time = at - src_in;
l.in_point = at;
- l.out_point = (at + len).min(comp.duration);
+ // Keep the full marked length past the comp's end (After Effects); the comp just doesn't show it.
+ l.out_point = at + len;
let lid = l.id;
let cm = proj.comp_mut(cid).ok_or(EngineError::NoComp)?;
cm.layers.insert(0, l);
diff --git a/crates/engine/src/tests_panels.rs b/crates/engine/src/tests_panels.rs
index b77c7e9ba..c99d92d13 100644
--- a/crates/engine/src/tests_panels.rs
+++ b/crates/engine/src/tests_panels.rs
@@ -185,6 +185,16 @@ fn scopes_read_the_comp_frame() {
// ---------------------------------------------------------------- Footage panel
+#[test]
+fn footage_panel_overlay_keeps_full_length_past_the_comp_end() {
+ let (mut s, cid, _clip, item) = setup(32, 24, 8.0, |_| Image::filled(32, 24, [0.5, 0.5, 0.5, 1.0]));
+ s.execute("footage.open", json!({"item": item.0})).unwrap();
+ let r = s.execute("footage.overlayEdit", json!({"item": item.0, "in": 0.0, "out": 4.0, "at": 6.0})).unwrap();
+ let ov = LayerId(r["layer"].as_u64().unwrap());
+ let l = s.project.comp(cid).unwrap().layer(ov).unwrap();
+ assert_eq!((l.in_point.seconds(), l.out_point.seconds()), (6.0, 10.0));
+}
+
#[test]
fn footage_panel_overlay_and_ripple_insert() {
let (mut s, cid, clip, item) = setup(32, 24, 8.0, |_| Image::filled(32, 24, [0.5, 0.5, 0.5, 1.0]));