Scripting: a stroke's Dashes use After Effects' match names (#815)

Dashes reported its children as `dash`, `gap`, `offset`, so
`property("ADBE Vector Stroke Dash 1")` was null and addProperty threw.
They now report ADBE Vector Stroke Dash 1-3 / Gap 1-3 / Offset.
addProperty with one of those names returns the existing property
(EffectCraft's Dashes always holds Dash 1, Gap 1 and Offset) or adds the
Dash/Gap 2 or 3 pair through shape.dashes.add. Lookups by the old ids
still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
redonion23
2026-10-13 03:04:12 +02:00
co-authored by Claude Opus 5.5
parent 470ea7a3af
commit f816cd5e38
4 changed files with 68 additions and 0 deletions
+31
View File
@@ -828,6 +828,37 @@ fn script_remove_keys_batches_a_range_as_one_edit() {
assert!(invalid.error.is_some());
}
/// #815: a stroke's Dashes use After Effects' match names, and addProperty with them returns
/// Dash 1 / Gap 1 / Offset or adds the Dash 2 / Gap 2 pair.
#[test]
fn script_stroke_dashes_use_after_effects_match_names() {
let mut s = session();
let o = ok(
&mut s,
"function names(g) { var a = []; for (var i = 1; i <= g.numProperties; i++) a.push(g.property(i).matchName); return a.join(','); }\
var comp = app.project.items.addComp('Names', 100, 100, 1, 10, 25);\
var contents = comp.layers.addShape().property('ADBE Root Vectors Group'); contents.addProperty('ADBE Vector Shape - Rect');\
var d = contents.addProperty('ADBE Vector Graphic - Stroke').property('ADBE Vector Stroke Dashes');\
var before = names(d);\
var dash1 = d.addProperty('ADBE Vector Stroke Dash 1'); dash1.setValue(12);\
var gap2 = d.addProperty('ADBE Vector Stroke Gap 2');\
var err = ''; try { d.addProperty('ADBE Vector Stroke Dash 9'); } catch (e) { err = e.message; }\
[before, dash1.matchName, d.property('ADBE Vector Stroke Dash 1').value, d.property('ADBE Vector Stroke Offset').matchName, gap2.matchName, names(d), err]",
);
assert_eq!(
o.result,
json!([
"ADBE Vector Stroke Dash 1,ADBE Vector Stroke Gap 1,ADBE Vector Stroke Offset",
"ADBE Vector Stroke Dash 1",
12,
"ADBE Vector Stroke Offset",
"ADBE Vector Stroke Gap 2",
"ADBE Vector Stroke Dash 1,ADBE Vector Stroke Gap 1,ADBE Vector Stroke Dash 2,ADBE Vector Stroke Gap 2,ADBE Vector Stroke Offset",
"Can not add \"ADBE Vector Stroke Dash 9\" to Dashes"
])
);
}
#[test]
fn script_layer_comment_and_unnamed_marker_params_round_trip() {
let mut s = session();