FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Merge branch 'pr/nested-safety' into pr/nested-editing
justjohn12345642cfb6bdf57
diff --cc crates/engine/src/commands.rsindex 8205c1351,9ad24f753..c3f4b09d3--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@@ -2566,10 -2558,13 +2566,13 @@@ fn nest(s: &mut Session, p: &Value) ->let seq_id = s.state.active_sequence.ok_or(EngineError::NoSequence)?;let sel = with_links(s, &s.state.selection.clone());let q = s.active_sequence().ok_or(EngineError::NoSequence)?.clone();- let name = str_p(p, "name").map(str::to_string).unwrap_or_else(|| "Nested Sequence 01".to_string());+ let name = str_p(p, "name").filter(|n| !n.trim().is_empty()).map(str::to_string).unwrap_or_else(|| next_nested_name(s));let mut items: Vec<(TrackKind, usize, filmcraft_project::TrackItem)> = Vec::new();+ // transitions go into the nest with their clips: those whose clips are all nested+ let mut transitions: Vec<(TrackKind, usize, filmcraft_project::Transition)> = Vec::new();for (k, ts) in [(TrackKind::Video, &q.video_tracks), (TrackKind::Audio, &q.audio_tracks)] {- for (ti, t) in ts.iter().enumerate() {+ // clips on a locked track stay where they are (they cannot be removed from it)+ for (ti, t) in ts.iter().enumerate().filter(|(_, t)| !t.locked) {for i in t.items.iter().filter(|i| sel.contains(&i.id)) {items.push((k, ti, i.clone()));}