Merge branch 'worktree-agent-a802c795bb021e525'
Browse files at this commit3 changed files +52 -3
- MCP.md +1 -1
- crates/engine/src/project.rs +50 -1
- crates/mcp/src/tools/edit.rs +1 -1
MCP.mdmodified+1 -1
| @@ -159,7 +159,7 @@ in the GUI. Ops take `scope: "group" | "clip"` where it matters. | |||
| 159 | | `lift`, `fade`, `dissolve`, `transition`, `crossfade`, `gain`, `color`, `transform`, `fit`, `eq`, `sub_trim`, `sub_delete`, `cue_text` | clip | act on the one clip named | | 159 | | `lift`, `fade`, `dissolve`, `transition`, `crossfade`, `gain`, `color`, `transform`, `fit`, `eq`, `sub_trim`, `sub_delete`, `cue_text` | clip | act on the one clip named | |
| 160 | | `split` | all lanes (or `lanes`) | a cut, not a ripple: nothing moves. `lanes` limits which lanes are cut; a linked partner follows its clip | | 160 | | `split` | all lanes (or `lanes`) | a cut, not a ripple: nothing moves. `lanes` limits which lanes are cut; a linked partner follows its clip | |
| 161 | | `regroup` | all lanes | `regroup {at}` rejoins the clips that meet at `at` and groups them again: the inverse of `split`, metadata only | | 161 | | `regroup` | all lanes | `regroup {at}` rejoins the clips that meet at `at` and groups them again: the inverse of `split`, metadata only | |
| 162 | -| `copy_paste` | the copied clips | `copy_paste {clips:[addr…], at, lane?}`: one clip pastes as the GUI paste does (splits and ripples the room open); several, or any with `lane`, land as one set and are refused whole if they would overlap. Each copy gets a new link, so group the halves of a copied take after | | 162 | +| `copy_paste` | the copied clips | `copy_paste {clips:[addr…], at, lane?}`: one clip pastes as the GUI paste does (splits and ripples the room open); several, or any with `lane`, land as one set and are refused whole if they would overlap. Copies that were one take (a picture and its sound) come back as one new take; a copy whose partner was not copied comes back unlinked. A `lane` override keeps a take only where its members land on different lanes | |
| 163 | | `close_gap` | the gap's take | `close_gap {lane, at}` closes the one gap on `lane` that `at` stands in (the GUI's Close gap); a linked take's other lane closes with it. Captions use `close_gaps` | | 163 | | `close_gap` | the gap's take | `close_gap {lane, at}` closes the one gap on `lane` that `at` stands in (the GUI's Close gap); a linked take's other lane closes with it. Captions use `close_gaps` | |
| 164 | | `solo` | — | `solo {lane, on}` for an audio lane: monitoring only, not project state, not saved, never exported, no undo step | | 164 | | `solo` | — | `solo {lane, on}` for an audio lane: monitoring only, not project state, not saved, never exported, no undo step | |
| 165 | | `close_gaps` | one lane | closes the gaps on that lane only | | 165 | | `close_gaps` | one lane | closes the gaps on that lane only | |
crates/engine/src/project.rsmodified+50 -1
| @@ -9809,6 +9809,11 @@ impl Project { | |||
| 9809 | /// clipboard to bed unchanged, rather than collapsing onto `V1`/`A1` the | 9809 | /// clipboard to bed unchanged, rather than collapsing onto `V1`/`A1` the |
| 9810 | /// way a lone clip's copy does. | 9810 | /// way a lone clip's copy does. |
| 9811 | /// | 9811 | /// |
| 9812 | + /// The links come back among the copies: clips that shared a link id in | ||
| 9813 | + /// the set share one fresh id between them, distinct from every link in | ||
| 9814 | + /// the project, so a picture and its sound pasted together stay linked. A | ||
| 9815 | + /// clip whose link partner was not in the set comes back unlinked. | ||
| 9816 | + /// | ||
| 9812 | /// All-or-nothing, and **refused** rather than opening room or splitting | 9817 | /// All-or-nothing, and **refused** rather than opening room or splitting |
| 9813 | /// a neighbour the way [`paste`](Project::paste) does for one clip: | 9818 | /// a neighbour the way [`paste`](Project::paste) does for one clip: |
| 9814 | /// a set-paste never ripples the bed, so a landing that overlaps so much | 9819 | /// a set-paste never ripples the bed, so a landing that overlaps so much |
| @@ -9855,9 +9860,38 @@ impl Project { | |||
| 9855 | } | 9860 | } |
| 9856 | landings.push((li, Clip { start, ..clip })); | 9861 | landings.push((li, Clip { start, ..clip })); |
| 9857 | } | 9862 | } |
| 9863 | + // The links the copies carry among themselves. A clipboard link names | ||
| 9864 | + // the take it was copied from: members that were copied together and | ||
| 9865 | + // land on distinct lanes get one fresh id between them, so the take | ||
| 9866 | + // stays a take. A member whose partner was not copied, or two members | ||
| 9867 | + // forced onto one lane (a `lane` override), gets none, because a link | ||
| 9868 | + // may never name two clips of one lane. | ||
| 9869 | + let members: Vec<(usize, u32)> = landings | ||
| 9870 | + .iter() | ||
| 9871 | + .filter_map(|(li, c)| c.link.map(|id| (*li, id))) | ||
| 9872 | + .collect(); | ||
| 9873 | + let keeps = |old: u32| { | ||
| 9874 | + let lanes: Vec<usize> = members | ||
| 9875 | + .iter() | ||
| 9876 | + .filter(|m| m.1 == old) | ||
| 9877 | + .map(|m| m.0) | ||
| 9878 | + .collect(); | ||
| 9879 | + lanes.len() >= 2 && lanes.iter().enumerate().all(|(i, l)| !lanes[..i].contains(l)) | ||
| 9880 | + }; | ||
| 9858 | self.snapshot(); | 9881 | self.snapshot(); |
| 9882 | + let mut fresh: Vec<(u32, u32)> = Vec::new(); | ||
| 9859 | for (li, mut clip) in landings { | 9883 | for (li, mut clip) in landings { |
| 9860 | - clip.link = Some(self.new_link()); | 9884 | + clip.link = match clip.link { |
| 9885 | + Some(old) if keeps(old) => match fresh.iter().find(|(o, _)| *o == old) { | ||
| 9886 | + Some(&(_, id)) => Some(id), | ||
| 9887 | + None => { | ||
| 9888 | + let id = self.new_link(); | ||
| 9889 | + fresh.push((old, id)); | ||
| 9890 | + Some(id) | ||
| 9891 | + } | ||
| 9892 | + }, | ||
| 9893 | + _ => None, | ||
| 9894 | + }; | ||
| 9861 | clip.fade_in = 0; | 9895 | clip.fade_in = 0; |
| 9862 | clip.fade_out = 0; | 9896 | clip.fade_out = 0; |
| 9863 | clip.transition_out = 0; | 9897 | clip.transition_out = 0; |
| @@ -15002,6 +15036,21 @@ mod tests { | |||
| 15002 | assert_eq!(p.map_timeline(8), Some((4, 6))); | 15036 | assert_eq!(p.map_timeline(8), Some((4, 6))); |
| 15003 | } | 15037 | } |
| 15004 | 15038 | ||
| 15039 | + /// A set pasted from a take keeps the take: the picture and the sound copied | ||
| 15040 | + /// together come back on one fresh link, and not the one they came from. | ||
| 15041 | + #[test] | ||
| 15042 | + fn paste_set_relinks_the_copied_take() { | ||
| 15043 | + let mut p = Project::single(FILE, 40); | ||
| 15044 | + let video = p.lane(Lane::V1)[0].clone(); | ||
| 15045 | + let sound = p.lane(Lane::A1)[0].clone(); | ||
| 15046 | + assert_eq!(video.link, sound.link, "the take starts linked"); | ||
| 15047 | + assert!(p.paste_set(50, &[(Lane::V1, video.clone()), (Lane::A1, sound.clone())])); | ||
| 15048 | + let (v, a) = (p.lane(Lane::V1)[1].link, p.lane(Lane::A1)[1].link); | ||
| 15049 | + assert!(v.is_some() && v == a, "the pasted pair is one take again"); | ||
| 15050 | + assert_ne!(v, video.link, "on a link of its own, not the source's"); | ||
| 15051 | + assert!(links_are_consistent(&p.lanes).is_ok()); | ||
| 15052 | + } | ||
| 15053 | + | ||
| 15005 | #[test] | 15054 | #[test] |
| 15006 | fn paste_at_boundary_zero_and_end() { | 15055 | fn paste_at_boundary_zero_and_end() { |
| 15007 | let mut p = three(); | 15056 | let mut p = three(); |
crates/mcp/src/tools/edit.rsmodified+1 -1
| @@ -98,7 +98,7 @@ TIME | |||
| 98 | speed {clip, x, ripple?, lanes?} — rate 0.25..4. [group] Its length changes, so a neighbour in its way refuses; ripple:true moves the later items in the RIPPLE RULE scope (titles too) by the length change: slower pushes them later, faster closes the gap. A clip on another lane that spans the change is never cut: outside the scope it is left in place and the reply names it; a scope lane (named in lanes) that holds one refuses, naming it. One undo step. | 98 | speed {clip, x, ripple?, lanes?} — rate 0.25..4. [group] Its length changes, so a neighbour in its way refuses; ripple:true moves the later items in the RIPPLE RULE scope (titles too) by the length change: slower pushes them later, faster closes the gap. A clip on another lane that spans the change is never cut: outside the scope it is left in place and the reply names it; a scope lane (named in lanes) that holds one refuses, naming it. One undo step. |
| 99 | speed_ramp {clip, keys:[{at, speed}...], ripple?, lanes?} [group] — a speed that changes over the clip: each key sets a speed 0.25–4 at a clip-relative time `at` ("0s", "2s", "end" or frames), linear between keys and held before the first and after the last. Keys must be in increasing `at`, at most 8, and keys:[] clears the ramp back to the clip's constant speed. The clip's length follows the ramp, and ripple:true moves the later items as speed does. preset:"speed_up"|"slow_down"|"fast_middle"|"slow_middle" lays one of the speed card's shapes across the clip's length instead of keys (speed_up: 1x to 2x; slow_down: 2x to 1x; fast_middle: slow–fast–slow; slow_middle: fast–slow–fast); not with keys. | 99 | speed_ramp {clip, keys:[{at, speed}...], ripple?, lanes?} [group] — a speed that changes over the clip: each key sets a speed 0.25–4 at a clip-relative time `at` ("0s", "2s", "end" or frames), linear between keys and held before the first and after the last. Keys must be in increasing `at`, at most 8, and keys:[] clears the ramp back to the clip's constant speed. The clip's length follows the ramp, and ripple:true moves the later items as speed does. preset:"speed_up"|"slow_down"|"fast_middle"|"slow_middle" lays one of the speed card's shapes across the clip's length instead of keys (speed_up: 1x to 2x; slow_down: 2x to 1x; fast_middle: slow–fast–slow; slow_middle: fast–slow–fast); not with keys. |
| 100 | regroup {at} — rejoins the clips that meet at `at` in every lane and puts them back in one group: the inverse of split (metadata only, one undo step; refused when no cut sits there). | 100 | regroup {at} — rejoins the clips that meet at `at` in every lane and puts them back in one group: the inverse of split (metadata only, one undo step; refused when no cut sits there). |
| 101 | -copy_paste {clips:[addr,...], at, lane?} — pastes copies of the named clips at `at`, with their effects, keys and volume, keeping their spacing. One clip splits and ripples the room open as the GUI's paste does; several (or any with `lane`) land as one set on their own lanes, refused whole when a landing would overlap. `lane` puts every copy on that lane (the same kind, V or A, as each copy). Each copy gets a new link, as the GUI's paste gives it: the halves of a copied take come back unlinked to each other, so group them after with group {clips}. | 101 | +copy_paste {clips:[addr,...], at, lane?} — pastes copies of the named clips at `at`, with their effects, keys and volume, keeping their spacing. One clip splits and ripples the room open as the GUI's paste does; several (or any with `lane`) land as one set on their own lanes, refused whole when a landing would overlap. `lane` puts every copy on that lane (the same kind, V or A, as each copy). Links come back among the copies: copied clips that were one take (a picture and its sound, say) land as one new take, while a clip whose partner was not copied comes back unlinked. A set with a `lane` override keeps a take only where its members land on different lanes. |
| 102 | close_gap {lane, at} — closes the one gap on `lane` that `at` stands in (the GUI's Close gap): a gap that borders a linked take closes with the take's other lane too; nothing else moves. Refused for a clip at `at`, the time past the lane's last clip, and the empty lead-in before its first clip. Captions use close_gaps. | 102 | close_gap {lane, at} — closes the one gap on `lane` that `at` stands in (the GUI's Close gap): a gap that borders a linked take closes with the take's other lane too; nothing else moves. Refused for a clip at `at`, the time past the lane's last clip, and the empty lead-in before its first clip. Captions use close_gaps. |
| 103 | solo {lane, on} — solos an audio lane for listening: while any is soloed, the other audio lanes are silent in this session's playback. It is monitoring only: not project state, not saved, never exported, and it leaves no undo step. | 103 | solo {lane, on} — solos an audio lane for listening: while any is soloed, the other audio lanes are silent in this session's playback. It is monitoring only: not project state, not saved, never exported, and it leaves no undo step. |
| 104 | reverse {clip, on?} — the clip plays backward, picture and sound: on true/false, or omit `on` to toggle. [group] Its length and place do not change, so nothing ripples, and it composes with speed and a speed ramp. Fades stay on the timeline's ends and gain and transform keys keep their time on the timeline. A trim, split or join follows the footage (a reversed clip's start edge trims its source's end). A still refuses. One undo step. clip_info and timeline say "reversed". Limits: a reversed clip decodes at 8 bits (a 10-bit source loses its low 2 bits on a 10-bit export; banding is possible on HDR), hardware decode is off for it, a dissolve's B side plays forward, and waveforms and thumbnails draw forward. | 104 | reverse {clip, on?} — the clip plays backward, picture and sound: on true/false, or omit `on` to toggle. [group] Its length and place do not change, so nothing ripples, and it composes with speed and a speed ramp. Fades stay on the timeline's ends and gain and transform keys keep their time on the timeline. A trim, split or join follows the footage (a reversed clip's start edge trims its source's end). A still refuses. One undo step. clip_info and timeline say "reversed". Limits: a reversed clip decodes at 8 bits (a 10-bit source loses its low 2 bits on a 10-bit export; banding is possible on HDR), hardware decode is off for it, a dissolve's B side plays forward, and waveforms and thumbnails draw forward. |