The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
fix(project): a layer laid without a lane goes over the picture, not under it (#249)
Jareer697cb2685020
diff --git a/src/crates/concat-project/src/commands/clips.rs b/src/crates/concat-project/src/commands/clips.rsindex b15f7f85..0da125f0 100644--- a/src/crates/concat-project/src/commands/clips.rs+++ b/src/crates/concat-project/src/commands/clips.rs@@ -208,7 +208,11 @@ pub(super) fn apply(let track_id = match track_id {Some(id) if timeline.track(&id).is_some() => id,Some(_) => return Err(CommandError::TrackGone),- None => first_free_track(timeline, start, duration)+ // Over the picture, as a title is: a layer treats what is+ // beneath it, and the bottom-first walk put one under the+ // footage whenever a lower lane was free, where it treated+ // nothing.+ None => first_free_track_above(timeline, start, duration).unwrap_or_else(|| fresh_track(timeline, mint)),};let start = timeline.nearest_free_start(&track_id, start, duration, &[]);diff --git a/src/crates/concat-project/src/commands/mod.rs b/src/crates/concat-project/src/commands/mod.rsindex 6c4576f1..078088fb 100644--- a/src/crates/concat-project/src/commands/mod.rs+++ b/src/crates/concat-project/src/commands/mod.rs@@ -399,7 +399,10 @@ pub enum Command {/// package named, at its defaults, and the clip's opacity is how hard it/// is applied.AddLayerClip {- /// The lane to place it on; None picks the first free track.+ /// The lane to place it on. None picks the first free lane *above*+ /// the highest one occupied over its span, minting one at the top+ /// when every lane above is taken: a layer treats what is beneath+ /// it, so one under the picture would treat nothing.track_id: Option<String>,/// Timeline position in seconds, floored at 0.start: f64,diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex 35cc02ad..e7188813 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -3675,6 +3675,51 @@ mod tests {);}+ /// An adjustment layer laid at the playhead lands over the footage,+ /// with the colour panel's package as its chain at its defaults: a+ /// layer under the picture would treat nothing (#249).+ #[test]+ fn an_adjustment_layer_lands_above_the_picture() {+ let mut editor = Editor::new();+ let media_id = editor+ .apply(media("/a.mp4", 10.0, true))+ .expect("adds")+ .created_id+ .expect("id");+ let video_track = editor.project().active().tracks[2].id.clone();+ editor+ .apply(Command::AddClip {+ media_id,+ track_id: video_track.clone(),+ start: 0.0,+ ripple: false,+ })+ .expect("adds");+ let layer_id = editor+ .apply(Command::AddLayerClip {+ track_id: None,+ start: 1.0,+ duration: Some(3.0),+ effect_id: "concat.adjust".into(),+ name: "Adjustment".into(),+ })+ .expect("adds")+ .created_id+ .expect("id");+ let timeline = editor.project().active();+ let layer = timeline.clip(&layer_id).expect("exists");+ assert_eq!(layer.kind, ClipKind::Layer);+ assert_eq!(layer.name, "Adjustment");+ assert_eq!(layer.video_effects.len(), 1);+ assert_eq!(layer.video_effects[0].id, "concat.adjust");+ assert!(layer.video_effects[0].params.is_empty(), "at its defaults");+ let row = |id: &str| timeline.tracks.iter().position(|t| t.id == id);+ assert!(+ row(&layer.track_id) > row(&video_track),+ "the layer must sit over the footage, not under it"+ );+ }+#[test]fn a_caption_on_an_empty_timeline_lands_on_the_bottom_lane() {let mut editor = Editor::new();