FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Merge main into #834 (commands.rs)
Brandon Thomas5d9fc0998109
diff --cc crates/engine/src/commands.rsindex 067ed2c7e,90cb5f77c..67549276a--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@@ -411,35 -434,47 +434,76 @@@ pub(crate) fn slip_together(q: &mut filOk(())}+/// Clips an audio effect should land on: audio ids as given, plus the linked audio of any video+/// clip in the list (so applying Parametric EQ to an A/V pair hits the sound).+pub fn audio_effect_targets(s: &Session, clips: &[ClipId]) -> Vec<ClipId> {+ let Some(seq) = s.active_sequence() else { return clips.to_vec() };+ let mut out = Vec::new();+ for c in clips {+ let Some((tid, it)) = seq.find_item(*c) else { continue };+ let kind = seq.track(tid).map(|t| t.kind);+ if kind == Some(TrackKind::Audio) {+ if !out.contains(c) {+ out.push(*c);+ }+ continue;+ }+ if kind != Some(TrackKind::Video) {+ continue;+ }+ let Some(link) = it.link else { continue };+ for t in &seq.audio_tracks {+ for i in &t.items {+ if i.link == Some(link) && !out.contains(&i.id) {+ out.push(i.id);+ }+ }+ }+ }+ out+}++ /// Adjacent roll pairs that follow `left`/`right` when linked selection is on: the given cut, plus+ /// through-edits between the same pieces' linked partners at that same time (Premiere linked+ /// selection). Split edits (audio cut at another time) and unlinked clips are not added.+ pub fn linked_roll_pairs(seq: &filmcraft_project::Sequence, left: ClipId, right: ClipId, follow_links: bool) -> Vec<(ClipId, ClipId)> {+ let mut pairs = vec![(left, right)];+ if !follow_links {+ return pairs;+ }+ let Some((_, l)) = seq.find_item(left) else {+ return pairs;+ };+ let Some((_, r)) = seq.find_item(right) else {+ return pairs;+ };+ let cut = l.end();+ let left_link = l.link;+ let right_link = r.link;+ if left_link.is_none() && right_link.is_none() {+ return pairs;+ }+ for tr in seq.all_tracks() {+ if tr.locked {+ continue;+ }+ for w in tr.items.windows(2) {+ if w[0].id == left && w[1].id == right {+ continue;+ }+ if w[0].end() != w[1].start || w[0].end() != cut {+ continue;+ }+ let left_ok = left_link.is_some_and(|g| w[0].link == Some(g));+ let right_ok = right_link.is_some_and(|g| w[1].link == Some(g));+ if left_ok && right_ok {+ pairs.push((w[0].id, w[1].id));+ }+ }+ }+ pairs+ }+/// Expand a clip selection with linked partners (when linked selection is on).pub fn with_links(s: &Session, clips: &[ClipId]) -> Vec<ClipId> {let Some(seq) = s.active_sequence() else { return clips.to_vec() };