mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-01 05:58:19 -06:00
Project panel: Replace with Precomposition (used N times)
Right-clicking a footage item or solid in the Project panel offers
"Replace with Precomposition (used N times)": the item goes into a new
composition of its size, pixel aspect and frame rate, in the same folder, and
every layer in every composition that used it switches to that composition,
keeping timing, transforms, effects and masks. One undo step. Agents run it as
`file.replaceWithPrecomp`.
The Project panel's details header also shows how often the selected item is
used ("Name ▾, used 3 times"); the ▾ lists and opens the comps that use it.
`Project::item_users` and the `project.usedIn` query back both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9efe75330c
commit
fcf56415dc
@@ -167,3 +167,24 @@ fn delete_removes_selected_groups_not_their_layer() {
|
||||
delete(&mut s);
|
||||
assert!(s.active_comp().unwrap().layer(LayerId(t)).is_none(), "a fixed group selected: the layer goes");
|
||||
}
|
||||
|
||||
/// `project.usedIn`: the Project panel's "used N times" and its ▾ list of comps, by name.
|
||||
#[test]
|
||||
fn used_in_counts_layers_across_comps() {
|
||||
let mut s = Session::default();
|
||||
s.execute("comp.new", json!({"name": "Inner", "width": 64, "height": 64, "duration": 1})).unwrap();
|
||||
let inner = s.active_comp_id().unwrap();
|
||||
s.execute("comp.new", json!({"name": "Outer", "width": 64, "height": 64, "duration": 1})).unwrap();
|
||||
let outer = s.active_comp_id().unwrap();
|
||||
s.execute("layer.addItem", json!({"item": inner.0})).unwrap();
|
||||
s.execute("layer.addItem", json!({"item": inner.0})).unwrap();
|
||||
let r = s.execute("project.usedIn", json!({"item": "Inner"})).unwrap();
|
||||
assert_eq!(r["count"], 2);
|
||||
assert_eq!(r["comps"], json!([{"id": outer.0, "name": "Outer", "layers": 2}]));
|
||||
// Default: the selected item; an unused one is used 0 times.
|
||||
s.execute("project.select", json!({"items": [outer.0]})).unwrap();
|
||||
let r = s.execute("project.usedIn", json!({})).unwrap();
|
||||
assert_eq!((r["item"].as_u64(), r["count"].as_u64()), (Some(outer.0), Some(0)));
|
||||
assert_eq!(r["comps"], json!([]));
|
||||
assert!(s.execute("project.usedIn", json!({"item": "Nope"})).is_err());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user