Scripts: layer collections go stale after Revert, addDocument keeps the built-in layout

- A layer's, group's or compound path's layers, pageItems, groupItems,
  compoundPathItems and pathItems read before File > Revert now throw instead
  of listing the loaded document's art under the same id.
- addDocument with a saved preset of the built-in preset's name lays out
  several artboards as the built-in preset does, with presetSettings over it.
- Layer.zOrderPosition reads the kept list of sibling layers.
- PathItems.parent is described as any container, and the docs say when
  PathPoint.remove() keeps the direct selection.
This commit is contained in:
dotCooCoo committed 2026-12-01 13:43:56 -08:00
1 parent d52d8ff354
commit fe36fe67d0
5 files changed
+93 -41

No files matched your search

+11 -4
View File
@@ -3095,7 +3095,9 @@ through `$`:
tab as it was. A command that selects the objects it changes leaves the current layer and the highlighted Layers
panel rows as they were before the change. A bad value throws an error and changes nothing. An object that was
deleted, that a named engine kept from an earlier run, or whose document was reverted with `file.revert`, throws
`Stale page item`. Layer objects also become stale after their document is reverted. `remove()` on an object that
`Stale page item`. Layer objects also become stale after their document is reverted, and so do the `layers`,
`pageItems`, `groupItems`, `compoundPathItems` and `pathItems` of a layer, group or compound path read before the
revert; the document's own collections stay usable. `remove()` on an object that
is hidden or locked, is inside a hidden or locked layer or group, or is a group that holds one, and `removeAll()`
when any object is, throw `cannot delete hidden or locked objects` and delete nothing. `remove()` on an object on
a locked artboard, and `removeAll()` when any object is on one, throw `cannot delete objects on a locked artboard`
@@ -3318,9 +3320,14 @@ through `$`:
a path aligned to the pixel grid, or in an object that is, is written at each change, so its points
read as the grid snaps them.
Setting `closed` to true on a path with no points throws `Cannot close a path that has no points`.
Writing changes that added, removed or replaced points deselects the path's direct-selected anchors, even when the
path ends with as many points as before; changes that only move points or handles, change a point's type or set
`closed` keep them selected.
Writing changes that added or replaced points, or that removed points along with other such changes, deselects the
path's direct-selected anchors, even when the path ends with as many points as before. `PathPoint.remove()` on its
own keeps the rest of the direct selection: selected anchors after the removed point are renumbered and stay
selected, except that a selected segment that starts or ends at the removed point is deselected, and so is its other
anchor unless another selected segment still uses it. When every anchor left is selected and no segment is, the
path is selected as a whole. On a path aligned to the pixel grid, or in an object that is, which is written at each
change, the removal can clear the direct selection. Changes that
only move points or handles, change a point's type or set `closed` keep them selected.
`pathPoints`
(https://ai-scripting.docsforadobe.dev/jsobjref/PathPoints/) has `length`, `[i]`, `index(i)`, `add()` and
`removeAll()`, and each `PathPoint` (https://ai-scripting.docsforadobe.dev/jsobjref/PathPoint/) has `anchor`,