Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Trim mode rolls each selected edit point once (fixes the #870 regression)

Brandon Thomasc8275f294bf4
diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rs
index 90ed841de..20925268f 100644
--- a/crates/engine/src/commands.rs
+++ b/crates/engine/src/commands.rs
@@ -2498,7 +2498,7 @@ fn build() -> Vec<CommandSpec> {
s,
&json!({"side": "next", "ripple": false})
)),
- cmd!("timeline.roll", "Rolling Edit", [], None, r#"{"left":id,"right":id,"delta":ticks|"deltaFrames":i64}"#, has_seq, |s, p| {
+ cmd!("timeline.roll", "Rolling Edit", [], None, r#"{"left":id,"right":id,"delta":ticks|"deltaFrames":i64,"followLinks"?:bool}"#, has_seq, |s, p| {
let (l, r) = (
clip_p(p, "left").ok_or_else(|| bad("timeline.roll", "need `left`"))?,
clip_p(p, "right").ok_or_else(|| bad("timeline.roll", "need `right`"))?,
@@ -2509,7 +2509,8 @@ fn build() -> Vec<CommandSpec> {
.map(Tick)
.or_else(|| p.get("deltaFrames").and_then(Value::as_i64).map(|f| s.sequence_rate().tick_of(f)))
.unwrap_or_default();
- let follow = s.state.linked_selection;
+ // `followLinks: false` rolls only this pair: Trim mode already lists linked partners as edit points of their own
+ let follow = s.state.linked_selection && p.get("followLinks").and_then(Value::as_bool).unwrap_or(true);
let (x, n, linked) = s.edit_sequence("Rolling Edit", |q, ctx, _| {
let pairs = linked_roll_pairs(q, l, r, follow);
let linked = pairs.len() > 1;
diff --git a/crates/engine/src/trim.rs b/crates/engine/src/trim.rs
index 951a873c8..22315157e 100644
--- a/crates/engine/src/trim.rs
+++ b/crates/engine/src/trim.rs
@@ -208,7 +208,7 @@ fn trim_all_raw(s: &mut Session, delta_for: &dyn Fn(&Sequence, &EditPoint) -> Op
let r = match ep.kind {
TrimKind::Roll => {
let Some((l, r)) = roll_pair(seq, ep) else { continue };
- s.execute("timeline.roll", json!({"left": l.0, "right": r.0, "delta": delta.0}))?
+ s.execute("timeline.roll", json!({"left": l.0, "right": r.0, "delta": delta.0, "followLinks": false}))?
}
k => s.execute(
"timeline.trim",