From 1fe1058d343050840b7d4b9f3b115047a8cbf405 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 31 Oct 2026 02:01:29 -0700 Subject: [PATCH] Scripting: Offset Paths and Zig Zag properties resolve by their match names Offset Paths' Amount, Line Join, Miter Limit, Copies and Copy Offset, and Zig Zag's Size, Ridges per segment and Points reported their internal ids as matchName, so property("ADBE Vector Offset Amount") and the other documented names returned null. They now report and resolve by ADBE Vector Offset Amount, Line Join, Miter Limit, Copies and Copy Offset, and ADBE Vector Zigzag Size, Detail and Points. Lookups by display name and internal id still work. --- crates/script/src/matchnames.rs | 8 +++++ crates/script/src/tests.rs | 53 +++++++++++++++++++++++++++++++++ docs/scripting-parity.md | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/crates/script/src/matchnames.rs b/crates/script/src/matchnames.rs index 5837f77b8..45b10a0df 100644 --- a/crates/script/src/matchnames.rs +++ b/crates/script/src/matchnames.rs @@ -254,6 +254,14 @@ const SHAPE_PROPS: &[(&str, &str, &str)] = &[ ("wiggler", "seed", "ADBE Vector Random Seed"), ("wiggler", "transform", "ADBE Vector Wiggler Transform"), ("merge", "mode", "ADBE Vector Merge Type"), + ("offset", "amount", "ADBE Vector Offset Amount"), + ("offset", "join", "ADBE Vector Offset Line Join"), + ("offset", "miter", "ADBE Vector Offset Miter Limit"), + ("offset", "copies", "ADBE Vector Offset Copies"), + ("offset", "copyOffset", "ADBE Vector Offset Copy Offset"), + ("zigzag", "size", "ADBE Vector Zigzag Size"), + ("zigzag", "ridges", "ADBE Vector Zigzag Detail"), + ("zigzag", "points", "ADBE Vector Zigzag Points"), ("wiggle", "size", "ADBE Vector Roughen Size"), ("wiggle", "detail", "ADBE Vector Roughen Detail"), ("wiggle", "points", "ADBE Vector Roughen Points"), diff --git a/crates/script/src/tests.rs b/crates/script/src/tests.rs index 0af09841a..eefa017f0 100644 --- a/crates/script/src/tests.rs +++ b/crates/script/src/tests.rs @@ -309,6 +309,59 @@ fn wiggle_paths_properties_by_match_name() { assert_eq!(sh.props.prop("contents/wiggle/spatialPhase").unwrap().value, KV::Scalar(45.0)); } +/// Scripts reach Offset Paths' and Zig Zag's properties by their match names. +#[test] +fn offset_paths_and_zig_zag_properties_by_match_name() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("O", 200, 200, 1, 2, 30); + var sh = c.layers.addShape(); + var root = sh.property("ADBE Root Vectors Group"); + root.addProperty("ADBE Vector Filter - Offset"); + root.addProperty("ADBE Vector Filter - Zigzag"); + var o = root.property("ADBE Vector Filter - Offset"); + var z = root.property("ADBE Vector Filter - Zigzag"); + var on = ["ADBE Vector Offset Amount", "ADBE Vector Offset Line Join", "ADBE Vector Offset Miter Limit", + "ADBE Vector Offset Copies", "ADBE Vector Offset Copy Offset"]; + var zn = ["ADBE Vector Zigzag Size", "ADBE Vector Zigzag Detail", "ADBE Vector Zigzag Points"]; + var names = []; + for (var i = 0; i < on.length; i++) names.push([o.property(on[i]).matchName, o.property(on[i]).name]); + for (var j = 0; j < zn.length; j++) names.push([z.property(zn[j]).matchName, z.property(zn[j]).name]); + var before = [o.property("ADBE Vector Offset Amount").value, o.property("ADBE Vector Offset Line Join").value, + z.property("ADBE Vector Zigzag Points").value]; + o.property("ADBE Vector Offset Amount").setValue(-6); + o.property("ADBE Vector Offset Copies").setValue(3); + z.property("ADBE Vector Zigzag Detail").setValue(8); + [names, before, o.property("ADBE Vector Offset Nope") === null, z.property("ADBE Vector Zigzag Nope") === null] + "#, + ); + assert_eq!( + o.result, + json!([ + [ + ["ADBE Vector Offset Amount", "Amount"], + ["ADBE Vector Offset Line Join", "Line Join"], + ["ADBE Vector Offset Miter Limit", "Miter Limit"], + ["ADBE Vector Offset Copies", "Copies"], + ["ADBE Vector Offset Copy Offset", "Copy Offset"], + ["ADBE Vector Zigzag Size", "Size"], + ["ADBE Vector Zigzag Detail", "Ridges per segment"], + ["ADBE Vector Zigzag Points", "Points"] + ], + [10, 1, 1], + true, + true + ]) + ); + let (_, c) = comp_named(&s, "O"); + let sh = c.layers.iter().find(|l| l.props.sub("contents").is_some()).unwrap(); + assert_eq!(sh.props.prop("contents/offset/amount").unwrap().value, KV::Scalar(-6.0)); + assert_eq!(sh.props.prop("contents/offset/copies").unwrap().value, KV::Scalar(3.0)); + assert_eq!(sh.props.prop("contents/zigzag/ridges").unwrap().value, KV::Scalar(8.0)); +} + #[test] fn match_names_and_lookups() { let mut s = session(); diff --git a/docs/scripting-parity.md b/docs/scripting-parity.md index 96e298ece..9aa6ca626 100644 --- a/docs/scripting-parity.md +++ b/docs/scripting-parity.md @@ -18,7 +18,7 @@ our own scripts; no real-world script library has been run against both apps. | Expression object model | `thisComp`, `thisLayer`, `wiggle`, `loopOut`, `valueAtTime`, `sampleImage`, `footage()`, text style API… | Same members, from the reference, including `propertyGroup(countUp)` and a group's `propertyIndex` for name-independent rigs (#1619) | good | `crates/expr/src/tests.rs`, `tests/property_group.rs`; behaviour of edge cases unmeasured (G1) | | Expression editing | Inline field, error bar, pick whip, Expression Language menu, external editors | Inline field that grows, error bar, pick whips (property and value), language menu | partial | External editor support (#364) | | Expression performance | Cached, multi-frame | Per-thread boa contexts | unknown | No benchmark | -| Scripting object model | `app`, `Project`, items, layers, properties, keys, eases, render queue, `TextDocument`, `Shape`, markers, `File`/`Folder`, `Socket`, `app.settings` | Same classes, edits run through undoable engine commands; match names table; layers, groups and properties are callable (`layer("Effects")(1)` is `.property(...)`) | good | `crates/script` tests (≈ 10 test files) | +| Scripting object model | `app`, `Project`, items, layers, properties, keys, eases, render queue, `TextDocument`, `Shape`, markers, `File`/`Folder`, `Socket`, `app.settings` | Same classes, edits run through undoable engine commands; match names table, the properties of Offset Paths and Zig Zag included; layers, groups and properties are callable (`layer("Effects")(1)` is `.property(...)`) | good | `crates/script` tests (≈ 10 test files) | | `$.evalFile`, `BridgeTalk` | Evaluate another script file; identify the host application and message other Adobe applications | `$.evalFile` evaluates a file relative to the calling file (nested at most 32 deep, under the scripts' file gate) and returns its last value; `BridgeTalk` names the host honestly (`appName` `effectcraft`, its version); messaging other applications throws "not supported" | partial | `tests_evalfile.rs` (#760); no inter-application messaging | | ScriptUI | Dialogs, palettes, dockable panels, resource strings, `onDraw` / ScriptUIGraphics, mouse events | Same, dockable panels reopen at launch; a docked panel gets its dock's size and `onResize` (`scriptui.resize`, #2585); a drag keeps reaching the control it started on past the window edge, and `MouseEvent.buttons` reports the held buttons (#2584) | good | `ui_scriptui`, `tests_ui*` | | `app.scheduleTask` / `cancelTask` | One-shot and repeating tasks (polling, panel refresh) until `cancelTask` | Same: repeating tasks run every `delay` ms (at least 50 ms, at most 64 pending per script) until `cancelTask`, until they throw (reported once, then cancelled), or until their owner goes: a script's last window closing, or the project closing for scripts without windows (a Startup script's tasks go on until EffectCraft quits); frontends tick them every frame, agents with `script.runTasks` | good | `tests_tasks.rs` (#773); one-shot tasks of a script file still run right after it, not after their delay |