From 209df6ab02226fec79f3725037ae64d1d158926c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 15:18:14 -0800 Subject: [PATCH 1/3] Scripts: retracing and releasing refuse a tracing with added opacity mask art Retracing and releasing a tracing discard every object the trace did not make, and refuse when there is one. The check walked only the tracing's children, so the art of an opacity mask given to the tracing or to an object the trace made was discarded without the refusal. The check now also walks that mask art. The source image's own mask is left out, since both keep the image whole. The refusal came with #9077 (a1b8b013). --- crates/engine/src/script/dom/tracing.rs | 27 +++++--- crates/engine/src/tests/script_dom_tracing.rs | 63 +++++++++++++++++++ docs/mcp.md | 3 +- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/script/dom/tracing.rs b/crates/engine/src/script/dom/tracing.rs index a37a062849..04fac60a66 100644 --- a/crates/engine/src/script/dom/tracing.rs +++ b/crates/engine/src/script/dom/tracing.rs @@ -199,15 +199,24 @@ pub(super) fn remember_source(h: &Host, uid: u64, group: &Node) { } h.dom.tracing.descendants.borrow_mut().entry((uid, group.id.0)).or_insert_with(|| { let mut ids = HashSet::new(); - group.walk(&mut |n| { - if n.id != group.id { - ids.insert(n.id); + // The source image is kept whole, so the art of its own opacity mask is not looked at. + let source = group.children().and_then(|c| c.first()).map(|n| n.id); + let mut todo: Vec<&Node> = members(group).collect(); + while let Some(n) = todo.pop() { + ids.insert(n.id); + if Some(n.id) != source { + todo.extend(members(n)); } - }); + } ids }); } +/// The objects `n` holds: its children and the art of its opacity mask. +fn members(n: &Node) -> impl Iterator { + n.children().into_iter().flatten().map(|c| &**c).chain(n.extras().mask.as_deref().map(|m| &*m.art)) +} + pub(super) fn same_source(h: &Host, uid: u64, original: NodeId, group: &Node) -> bool { let source = h.dom.tracing.sources.borrow().get(&(uid, original.0)).copied(); source.is_some_and(|source| group.children().and_then(|c| c.first()).is_some_and(|n| n.id == source)) @@ -321,7 +330,8 @@ fn replace(h: &Host, item: Item, id: &str, params: &Value, key: &str) -> Result< }) } -/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make, +/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make +/// (the art of an opacity mask on it or on one of its objects other than the source image included), /// and "Cannot edit page item" when it holds a locked object other than its source image, which /// the replacement would discard. The objects looked at are charged to the run either way. fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { @@ -338,7 +348,8 @@ fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { let source = group.children().and_then(|c| c.first()).map(|n| n.id); let mut visited = 0u64; let mut locked = None; - let mut todo: Vec<&Arc> = group.children().map(|c| c.iter().collect()).unwrap_or_default(); + // The tracing's own opacity mask goes with it too; the source image is kept whole. + let mut todo: Vec<&Node> = members(group).collect(); while let Some(n) = todo.pop() { visited += 1; let added = match (&made, ids) { @@ -353,7 +364,9 @@ fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { if n.locked && Some(n.id) != source && locked.is_none() { locked = Some(n.id); } - todo.extend(n.children().into_iter().flatten()); + if Some(n.id) != source { + todo.extend(members(n)); + } } Ok((visited, locked.map_or(Ok(()), |id| Err(HostError::Error(format!("Cannot edit page item {}", id.0)))))) })?; diff --git a/crates/engine/src/tests/script_dom_tracing.rs b/crates/engine/src/tests/script_dom_tracing.rs index 24223785dd..e6e3f4dfa1 100644 --- a/crates/engine/src/tests/script_dom_tracing.rs +++ b/crates/engine/src/tests/script_dom_tracing.rs @@ -1253,6 +1253,69 @@ fn retrace_and_release_refuse_locked_traced_artwork() { let _ = std::fs::remove_dir_all(base); } +/// The art of an opacity mask given to the tracing or to an object the trace made is added artwork +/// too: retracing and releasing discard it, so both refuse, before the document changes. +#[test] +fn retrace_and_release_refuse_added_opacity_mask_art() { + let base = folder("mask-art"); + for on_group in [false, true] { + for (action, refusal) in [ + ("p.tracing.tracingOptions.threshold = 90;", "Cannot retrace a tracing containing added artwork"), + ("p.tracing.releaseTracing();", "Cannot release a tracing containing added artwork"), + ] { + let (mut s, image) = session(&base, false); + let r = s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + let group = NodeId(r["id"].as_u64().unwrap()); + let made = s.active().unwrap().doc.node(group).unwrap().children().unwrap()[1].id; + let masked = if on_group { group } else { made }; + s.edit("Mask traced artwork", |d, _| { + let art = crate::doc::Node::group(d.alloc_id(), vec![]); + d.node_mut(masked).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + let before = vectorcraft_format::save(&s.active().unwrap().doc, false); + let steps = undo_steps(&s); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!(refusal)], "{on_group} {action}"); + assert_eq!(vectorcraft_format::save(&s.active().unwrap().doc, false), before, "{on_group} {action}"); + assert_eq!(undo_steps(&s), steps, "{on_group} {action}"); + } + } + let _ = std::fs::remove_dir_all(base); +} + +/// The source image keeps its opacity mask through retracing and releasing, so its mask art is +/// not added artwork. +#[test] +fn retrace_and_release_take_a_source_image_with_an_opacity_mask() { + let base = folder("source-mask"); + for action in ["p.tracing.tracingOptions.threshold = 90;", "p.tracing.releaseTracing();"] { + let (mut s, image) = session(&base, false); + s.edit("Mask the image", |d, _| { + let art = crate::doc::Node::group(d.alloc_id(), vec![]); + d.node_mut(image).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + let mask = s.active().unwrap().doc.node(image).unwrap().extras().mask.clone(); + s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + assert_eq!(s.active().unwrap().doc.node(image).unwrap().extras().mask, mask, "imageTrace.make: {action}"); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!("")], "{action}"); + assert_eq!(s.active().unwrap().doc.node(image).unwrap().extras().mask, mask, "{action}"); + } + let _ = std::fs::remove_dir_all(base); +} + /// The `TracingOptions` and `TracingObject` members that are not implemented are left out of /// `hasOwnProperty` and `reflect`, and still throw when read. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index e716a1a08e..4f76bea4f6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3365,7 +3365,8 @@ through `$`: `viewVector` does not trace again: it runs `imageTrace.setView`. The `PluginItem`, `TracingObject` and `TracingOptions` follow the new object, and a run traces again at most 10,000 times. Tracing again throws `Cannot retrace a tracing containing added artwork`, with nothing changed, when the tracing holds an object its trace - did not make, whether this run, an earlier run or a command added it, and `releaseTracing()` throws + did not make, whether this run, an earlier run or a command added it (the art of an opacity mask on the tracing or on an + object the trace made counts; the source image's own mask does not, since both keep the image whole), and `releaseTracing()` throws `Cannot release a tracing containing added artwork` in the same case. When no object was added, both throw `Cannot edit page item `, with nothing changed, when an object the trace made is locked. `imageTrace.make` records the objects it made in the tracing's `trace` settings as `made`, ranges of ids `[[first, last], ...]`, and a copy of the tracing records From fbe16e8143a4a05463521544eabf5b4ebddbecff Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 16:31:36 -0800 Subject: [PATCH 2/3] Scripts: retracing and releasing refuse any opacity mask on traced artwork The check for added artwork compared mask art by id. A mask made with Make Opacity Mask from two traced paths keeps the art's id, which the tracing records as made, and a tracing saved without that record took a mask it already held as part of its own objects. Retracing or releasing then discarded the mask without the refusal. An opacity mask on the tracing or on any object in it other than the source image now makes retracing and releasing refuse, whatever the ids of its art. The source image keeps its own mask as before. --- crates/engine/src/script/dom/tracing.rs | 30 ++++---- crates/engine/src/tests/script_dom_tracing.rs | 69 +++++++++++++++++++ docs/mcp.md | 8 ++- docs/target-app-parity.md | 2 +- 4 files changed, 92 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/script/dom/tracing.rs b/crates/engine/src/script/dom/tracing.rs index 04fac60a66..e423ec8511 100644 --- a/crates/engine/src/script/dom/tracing.rs +++ b/crates/engine/src/script/dom/tracing.rs @@ -199,14 +199,12 @@ pub(super) fn remember_source(h: &Host, uid: u64, group: &Node) { } h.dom.tracing.descendants.borrow_mut().entry((uid, group.id.0)).or_insert_with(|| { let mut ids = HashSet::new(); - // The source image is kept whole, so the art of its own opacity mask is not looked at. - let source = group.children().and_then(|c| c.first()).map(|n| n.id); - let mut todo: Vec<&Node> = members(group).collect(); + // Only children are recorded: an opacity mask is refused whatever its art, so the art of + // one held now must not become an object the trace made if the mask is later undone. + let mut todo: Vec<&Node> = group.children().into_iter().flatten().map(|c| &**c).collect(); while let Some(n) = todo.pop() { ids.insert(n.id); - if Some(n.id) != source { - todo.extend(members(n)); - } + todo.extend(n.children().into_iter().flatten().map(|c| &**c)); } ids }); @@ -330,8 +328,8 @@ fn replace(h: &Host, item: Item, id: &str, params: &Value, key: &str) -> Result< }) } -/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make -/// (the art of an opacity mask on it or on one of its objects other than the source image included), +/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make, +/// or has an opacity mask on it or on one of its objects other than the source image, whatever its art, /// and "Cannot edit page item" when it holds a locked object other than its source image, which /// the replacement would discard. The objects looked at are charged to the run either way. fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { @@ -348,15 +346,21 @@ fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { let source = group.children().and_then(|c| c.first()).map(|n| n.id); let mut visited = 0u64; let mut locked = None; + // An opacity mask on the tracing or on an object other than the source image is added + // artwork whatever the ids of its art: a mask made from traced objects keeps their ids. + if group.extras().mask.is_some() { + return Ok((visited, Err(HostError::Error(refusal.into())))); + } // The tracing's own opacity mask goes with it too; the source image is kept whole. let mut todo: Vec<&Node> = members(group).collect(); while let Some(n) = todo.pop() { visited += 1; - let added = match (&made, ids) { - (Some(m), _) => !m.contains(n.id), - (None, Some(ids)) => !ids.contains(&n.id), - (None, None) => false, - }; + let added = (Some(n.id) != source && n.extras().mask.is_some()) + || match (&made, ids) { + (Some(m), _) => !m.contains(n.id), + (None, Some(ids)) => !ids.contains(&n.id), + (None, None) => false, + }; // Added artwork is reported before a locked object, whichever comes first. if added { return Ok((visited, Err(HostError::Error(refusal.into())))); diff --git a/crates/engine/src/tests/script_dom_tracing.rs b/crates/engine/src/tests/script_dom_tracing.rs index e6e3f4dfa1..0ab4469719 100644 --- a/crates/engine/src/tests/script_dom_tracing.rs +++ b/crates/engine/src/tests/script_dom_tracing.rs @@ -1289,6 +1289,75 @@ fn retrace_and_release_refuse_added_opacity_mask_art() { let _ = std::fs::remove_dir_all(base); } +/// An opacity mask made from two objects the trace made keeps the mask art's id, which the tracing +/// records as made, but retracing and releasing still discard it, so both refuse. +#[test] +fn retrace_and_release_refuse_an_opacity_mask_made_from_traced_paths() { + let base = folder("traced-mask"); + for (action, refusal) in [ + ("p.tracing.tracingOptions.threshold = 90;", "Cannot retrace a tracing containing added artwork"), + ("p.tracing.releaseTracing();", "Cannot release a tracing containing added artwork"), + ] { + let (mut s, image) = session(&base, false); + let r = s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + let group = NodeId(r["id"].as_u64().unwrap()); + let kids: Vec = s.active().unwrap().doc.node(group).unwrap().children().unwrap().iter().map(|n| n.id).collect(); + assert!(kids.len() > 2, "{kids:?}"); + s.execute("select.set", &json!({"ids": [kids[1].0, kids[2].0]})).unwrap(); + s.execute("transparency.makeOpacityMask", &json!({})).unwrap(); + let g = s.active().unwrap().doc.node(group).unwrap(); + assert!(g.children().unwrap().iter().any(|n| n.extras().mask.is_some()), "a traced path holds the mask"); + let before = vectorcraft_format::save(&s.active().unwrap().doc, false); + let steps = undo_steps(&s); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!(refusal)], "{action}"); + assert_eq!(vectorcraft_format::save(&s.active().unwrap().doc, false), before, "{action}"); + assert_eq!(undo_steps(&s), steps, "{action}"); + } + let _ = std::fs::remove_dir_all(base); +} + +/// A tracing saved without the record of what its trace made is checked against what it held when +/// the run first saw it; an opacity mask it already held then still counts as added artwork. +#[test] +fn retrace_and_release_refuse_a_mask_on_a_tracing_without_its_record() { + let base = folder("unrecorded-mask"); + for (action, refusal) in [ + ("p.tracing.tracingOptions.threshold = 90;", "Cannot retrace a tracing containing added artwork"), + ("p.tracing.releaseTracing();", "Cannot release a tracing containing added artwork"), + ] { + let (mut s, image) = session(&base, false); + let r = s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + let group = NodeId(r["id"].as_u64().unwrap()); + let made = s.active().unwrap().doc.node(group).unwrap().children().unwrap()[1].id; + s.edit("Mask traced artwork of an older tracing", |d, _| { + if let Some(t) = d.node_mut(group).unwrap().extras_mut().trace.as_deref_mut().and_then(Value::as_object_mut) { + t.remove(vectorcraft_doc::trace::TRACE_MADE); + } + let art = crate::doc::Node::group(d.alloc_id(), vec![]); + d.node_mut(made).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + assert!(s.active().unwrap().doc.node(group).unwrap().trace_made().is_none()); + let before = vectorcraft_format::save(&s.active().unwrap().doc, false); + let steps = undo_steps(&s); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!(refusal)], "{action}"); + assert_eq!(vectorcraft_format::save(&s.active().unwrap().doc, false), before, "{action}"); + assert_eq!(undo_steps(&s), steps, "{action}"); + } + let _ = std::fs::remove_dir_all(base); +} + /// The source image keeps its opacity mask through retracing and releasing, so its mask art is /// not added artwork. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 4f76bea4f6..9deeedb43c 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3365,12 +3365,14 @@ through `$`: `viewVector` does not trace again: it runs `imageTrace.setView`. The `PluginItem`, `TracingObject` and `TracingOptions` follow the new object, and a run traces again at most 10,000 times. Tracing again throws `Cannot retrace a tracing containing added artwork`, with nothing changed, when the tracing holds an object its trace - did not make, whether this run, an earlier run or a command added it (the art of an opacity mask on the tracing or on an - object the trace made counts; the source image's own mask does not, since both keep the image whole), and `releaseTracing()` throws + did not make, whether this run, an earlier run or a command added it (any opacity mask on the tracing or on an object + the trace made counts, whether or not the trace made its art; the source image's own mask does not, since both keep + the image whole), and `releaseTracing()` throws `Cannot release a tracing containing added artwork` in the same case. When no object was added, both throw `Cannot edit page item `, with nothing changed, when an object the trace made is locked. `imageTrace.make` records the objects it made in the tracing's `trace` settings as `made`, ranges of ids `[[first, last], ...]`, and a copy of the tracing records - their copies. A tracing saved without `made` is checked only for objects added in the same run. `threshold` takes a whole + their copies. A tracing saved without `made` is checked only for objects added in the same run, but an opacity + mask counts with or without `made`, even one it held before the run. `threshold` takes a whole number from 0 to 255, `maxColors` from 2 to 256 and `minArea` (the Noise setting, in pixels) from 0 to the largest image the tracer reads; `fills` and `strokes` cannot both be `false`; `palette` is `""` (automatic), `"Limited"`, `"Full Tone"` or `"Document Library"`; `viewRaster` and `viewVector` take only the pairs that match an Image Trace diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 144759bf00..b50a826dff 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1115,7 +1115,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s. - Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`. - Scripts: `Document.placedItems` and `Document.rasterItems` list a document's linked and embedded images; `placedItems.add()` with a `File` assigned to `file` places an image linked, and `PlacedItem.relink(file)` and `embed()` relink and embed it, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItem/, https://ai-scripting.docsforadobe.dev/jsobjref/RasterItems/ and https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/ describe them. A raster item's bits per channel, channels, color space and transparency come from its encoded pixels' header. Only files the script may read, of at most 256 MiB and holding an image, are placed or relinked. Rasterizing and capturing are not there yet. `crates/engine/src/tests/script_dom_images.rs`. - - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. + - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. Tracing again and `releaseTracing()` throw, with nothing changed, when the tracing holds added artwork, an opacity mask on the tracing or on an object the trace made included; the source image keeps its own mask. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. - Scripts: `Document.pathItems` lists the paths and makes rectangles, rounded rectangles, ellipses, polygons, stars and empty paths with the defaults the help page https://ai-scripting.docsforadobe.dev/jsobjref/PathItems/ gives; each path's points, closed state, fill rule, area, length, guide state, selected points, fill and stroke colors, stroke options and transforms read and change as https://ai-scripting.docsforadobe.dev/jsobjref/PathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/PathPoints/ and https://ai-scripting.docsforadobe.dev/jsobjref/PathPoint/ describe them, and `RGBColor`, `CMYKColor`, `GrayColor`, `LabColor` and `NoColor` make colors (`docs/mcp.md`). `pathItems["name"]` reads a path by name as `pageItems` does, and `removeAll()` deletes nothing and throws when any path is on a locked artboard. The transforms move gradients with the art: `changeFillGradients` false throws an error, as do `changeFillPatterns` and `changeStrokePattern` given as different values, and `transform` is not there yet (`docs/mcp.md` lists these limits). Gradient stops are not there yet. A `PathPoint` of a path in an Objects on Path group goes stale when an edit of another path in the group moves it. `crates/engine/src/tests/script_dom_paths.rs`. - Scripts: a document's `default*` members (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) read and set the fill, stroke and stroke options of the next object drawn through `appearance.setNewArt`, leaving the selection and its art as they were, and `scaleFactor` reads 1 (`docs/mcp.md`). `crates/engine/src/tests/script_dom_defaults.rs`. - Scripts: `app.undo()` and `app.redo()` undo and redo the edits the run made, and each document open before and after the run that it changed gets one undo step. `crates/engine/src/tests/script_dom.rs`. From a70c687ee0b5029fe1f9acdd7d6ce70682f2bee7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 17:58:23 -0800 Subject: [PATCH 3/3] Docs: a tracing saved without `made` is checked only for artwork added in the run The Scripts line for Image Trace now says that retracing or releasing a tracing saved without `made` can discard artwork added before the run, and that the opacity mask check applies with or without `made`. --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b117989989..3279b91ff8 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1118,7 +1118,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Scripts: `app.preferences` reads, stores and removes values by key with the type they were set as, keeps them across runs and restarts, and turns the warning before a picked script on with the key `ShowExternalJSXWarning`, and off only after the person answers Yes to a confirm (https://ai-scripting.docsforadobe.dev/jsobjref/Preferences/; the confirm is VectorCraft's own rule); `app` makes, joins, inverts and compares `Matrix` records (https://ai-scripting.docsforadobe.dev/jsobjref/Matrix/), rounding each joined value once from its exact sum of products, and runs Copy, Cut and Paste on the active document inside the run's transaction (https://ai-scripting.docsforadobe.dev/jsobjref/Application/). `crates/engine/src/tests/script_dom_prefs.rs`. - Scripts: `Document.pathItems` lists the paths and makes rectangles, rounded rectangles, ellipses, polygons, stars and empty paths with the defaults the help page https://ai-scripting.docsforadobe.dev/jsobjref/PathItems/ gives; each path's points, closed state, fill rule, area, length, guide state, selected points, fill and stroke colors, stroke options and transforms read and change as https://ai-scripting.docsforadobe.dev/jsobjref/PathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/PathPoints/ and https://ai-scripting.docsforadobe.dev/jsobjref/PathPoint/ describe them, and `RGBColor`, `CMYKColor`, `GrayColor`, `LabColor` and `NoColor` make colors (`docs/mcp.md`). `pathItems["name"]` reads a path by name as `pageItems` does, and `removeAll()` deletes nothing and throws when any path is on a locked artboard. A path takes the page item transforms, and `resize` also sets its stroke weight to a `changeLineWidths` percent from 0 to 100000 (at most 1000 points; a member of a compound sets the compound's stroke); gradients move with positions, so a `changeFillGradients` different from `changePositions` throws an error, as do `changeFillPatterns` and `changeStrokePattern` given as different values (`docs/mcp.md` lists these limits). Gradient stops are not there yet. A `PathPoint` of a path in an Objects on Path group goes stale when an edit of another path in the group moves it. `crates/engine/src/tests/script_dom_paths.rs`. - Scripts: `Document.placedItems` and `Document.rasterItems` list a document's linked and embedded images; `placedItems.add()` with a `File` assigned to `file` places an image linked, and `PlacedItem.relink(file)` and `embed()` relink and embed it, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItem/, https://ai-scripting.docsforadobe.dev/jsobjref/RasterItems/ and https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/ describe them. A raster item's bits per channel, channels, color space and transparency come from its encoded pixels' header. Only files the script may read, of at most 256 MiB and holding an image, are placed or relinked. Rasterizing and capturing are not there yet. `crates/engine/src/tests/script_dom_images.rs`. - - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. Tracing again and `releaseTracing()` throw, with nothing changed, when the tracing holds added artwork, an opacity mask on the tracing or on an object the trace made included; the source image keeps its own mask. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. + - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. Tracing again and `releaseTracing()` throw, with nothing changed, when the tracing holds added artwork, an opacity mask on the tracing or on an object the trace made included; the source image keeps its own mask. A tracing saved without `made` is checked only for artwork added during the same run, so tracing it again or releasing it discards artwork that was added before the run without an error, and the opacity mask check applies with or without `made`. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. - Scripts: a document's `default*` members (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) read and set the fill, stroke and stroke options of the next object drawn through `appearance.setNewArt`, leaving the selection and its art as they were, and `scaleFactor` reads 1 (`docs/mcp.md`). `crates/engine/src/tests/script_dom_defaults.rs`. - Scripts: `app.undo()` and `app.redo()` undo and redo the edits the run made, and each document open before and after the run that it changed gets one undo step. `crates/engine/src/tests/script_dom.rs`. - Scripts: `document.textFrames` makes point type, area type and type on a path, and each text frame gives its kind, its contents, its text as text ranges with their characters, words and paragraphs (which can add text), their character attributes (size, leading, tracking, baseline shift, scales, rotation, underline, strikethrough, font) and paragraph attributes (alignment, indents, space before and after), outlines and point and area conversion; `app.textFonts` lists the fonts, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItems/, https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ and https://ai-scripting.docsforadobe.dev/jsobjref/TextFonts/ describe them (`docs/mcp.md`). Offsets count UTF-16 units, VectorCraft's own rule. Lines, tab stops and colors are not there yet. `crates/engine/src/tests/script_text.rs`.