Layers: with several layers selected, value edits, stopwatches and viewer Scale / Rotate change them all (#355, #491)

With several layers selected, After Effects applies a property edit to the same property of
every selected layer; we changed only the layer whose row was edited (the Properties panel
showed only the first selected layer), so a stopwatch switched on one layer and later moves
of the others had nothing to keyframe (#355), and scaling or rotating a selection changed
one layer (#491).

- Engine: `prop.set`, `prop.toggleAnimation` and `prop.toggleKey` take `selected: true`:
  the change also goes to the same property (by match path, `transform/scale`,
  `effects/<effect>#n/<param>`) of every other selected, unlocked layer whose value has the
  same kind, in one undo step (a scrub keeps folding into it through its `merge` key). With
  `offset: true` (a scrub) each layer changes by the same amount from its own value; a typed
  value sets them all. Position with Separate Dimensions is handled per layer.
- The Timeline, Properties and Effect Controls panels pass `selected` (and `offset` while a
  value is dragged). The Properties panel heads "(N) Selected Objects" (zh-CN / zh-TW / ja /
  uk rows).
- Viewer: a bounding-box handle drag scales every selected layer by the same ratio about its
  own anchor point; the Rotation tool turns them all by the same angle (one undo step).

Tests: engine test (stopwatch, scrub offset, typed value, keyframe button, one undo step,
unselected layers untouched); kittests: the Properties panel with three layers selected
(header, stopwatch on all three undone in one step, a scrub moving all three by the same
amount) and a handle drag scaling two selected layers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
Claude
2026-10-10 21:23:36 +00:00
parent 03598229ba
commit 657f34d40b
9 changed files with 342 additions and 20 deletions
+26
View File
@@ -1707,6 +1707,32 @@ fn handle_drags_scale_about_the_anchor_and_follow_the_pointer() {
assert!(close(scale(&h), [162.5, 162.5]), "{:?}", scale(&h));
}
/// #491: with several layers selected, a handle drag scales all of them by the same ratio, each
/// about its own anchor point, in one undo step.
#[test]
fn handle_drags_scale_every_selected_layer() {
let mut h = harness();
let layers = h.state().session.active_comp().unwrap().layers.iter().map(|l| l.id).collect::<Vec<_>>();
let (box_id, plate) = (layers[0], layers[1]);
let scale = |h: &Harness<'_, EffectcraftApp>, id: LayerId| {
let l = h.state().session.active_comp().unwrap().layer(id).unwrap().clone();
l.props.prop("transform/scale").unwrap().value.as_vec3()
};
h.state_mut().session.execute("prop.set", json!({"layer": plate.0, "path": "transform/scale", "value": [50, 50, 100]})).unwrap();
h.state_mut().session.execute("layer.select", json!({"layers": [box_id.0, plate.0]})).unwrap();
h.state_mut().session.execute("view.snapping", json!({"value": false})).unwrap();
h.run_steps(2);
let undo0 = h.state().session.history.undo.len();
// The box's bottom-right corner (360, 220) to (400, 260): twice the box's size.
let corner = rect(&h, &format!("viewer.handle.{}.2", box_id.0)).center();
let to = screen(&h, [400.0, 260.0]);
drag_path(&mut h, &[corner, to], Default::default());
let (b, p) = (scale(&h, box_id), scale(&h, plate));
assert!((b[0] - 200.0).abs() < 1.0 && (b[1] - 200.0).abs() < 1.0, "{b:?}");
assert!((p[0] - 100.0).abs() < 1.0 && (p[1] - 100.0).abs() < 1.0, "the other layer doubles too: {p:?}");
assert_eq!(h.state().session.history.undo.len(), undo0 + 1, "one undo step");
}
/// #252: with snapping on, a dragged handle snaps to the comp's corners and edges (and other
/// layers'), so a layer scales exactly to the comp; Shift keeps the proportions and still lands
/// on the comp's size.