removeAll() on a layer's or group's pathItems walked every object in the
document to check clipping paths, even when the collection was empty or
held two paths. It now walks the container's own objects, or, when the
container sits in the clipping path of a clipping group, the subtree of
the highest such clipping path and the group it clips. An empty
collection walks nothing. The document's own pathItems.removeAll() still
checks every object.
A scoped removeAll() now also throws when a path id in the list resolves
to an object outside the container, which a damaged file with repeated
ids can cause, instead of deleting that other object.
The walk came in with #9288 ("Scripts: paths, path points and colors
for scripts").
Setting `closed` on a path with no points gives it an empty closed
subpath, so the path's own data keeps the setting. The separate set of
empty paths, its key, its cleanup after commands and its copy in the
command trail were no longer written to by anything. `closed` and
`setEntirePath` now read the closed state from the subpaths only.
When a live geometry effect reshapes what stays in a clipping path,
removeAll() now measures the area that outline fills under its fill
rule, with overlaps resolved, instead of the area of each subpath. An
image whose Transform effect adds a copy reflected onto itself fills
nothing under nonzero, so deleting the other paths now throws and
deletes nothing. A frame that an effect scales to a thin strip still
counts as a clipping region.
The check that an image or placed-document frame still encloses an area
now measures each subpath from its own first point, so a tiny frame far
from the origin is not lost to roundoff and a collapsed frame is not
counted through roundoff.
When a live geometry effect, such as an Offset Path inset, would leave
no clipping region once the paths are deleted, removeAll() now throws and
deletes nothing. The preflight copies only the members that hold a path
being deleted.
The document's pathItems.removeAll() refused to delete paths from a group
that is a clipping path when an image or placed document stayed inside
that group, although the image's frame still clips. It now counts the frame
of a visible image or placed document as clipping geometry when the frame
encloses an area, as Node::clip_shapes does, and still refuses when the
frame is collapsed to a line.
resize and transform with changeLineWidths equal to the scale now scale the
strokes, dashes and effects of a path with no anchors, as they do for a path
with anchors. A member with no anchors of a compound path or compound shape
that shows a pattern is refused when the call transforms patterns, as a path
with a pattern of its own is.
node.move's description and docs/mcp.md now say that a compound path on a
locked artboard takes a path while it is new art there and still selected.
The document's pathItems.removeAll() skipped text whose characters are
all whitespace before laying it out, so a numbered paragraph holding a
single space did not count, although its number clips. The deletion was
then refused while the mask would still clip.
- Whitespace-only text is laid out like other text.
- Text is laid out only inside a mask that loses a path, so documents
with text outside such masks do no layout for the check.
- A test covers a mask left with only a list number.
- docs/mcp.md says blank text without a list marker does not count.
The document's pathItems.removeAll() counted any visible text object as
geometry that keeps a clipping mask clipping. Blank type and area type too
short for its first line lay out no glyphs, so the clip renderer clips by
nothing for them; deleting the mask's last path then hid the clipped art.
- Text counts only when it is visible and its layout gives glyph outlines.
- A clipping group nested in the mask counts only its first member.
- Hidden objects and members of hidden groups do not count.
- Tests cover blank, overset, hidden and nested-clipped type, and type
with glyphs that still allows the delete.
- docs/mcp.md states the rule.
A group that clips by a mask holding a path and a text object keeps
clipping by the text's outlines after the path is deleted, so
Document.pathItems.removeAll() no longer refuses that case. Hidden
text and hidden subgroups do not clip, so a mask left with only those
still refuses. docs/mcp.md describes the rule.
Document.pathItems.add() and the shape creators passed the active layer
as onLayer even when it was locked or hidden, so path.create refused it
and the script threw, while textFrames.add() and the app's own creation
commands put the new art on the topmost shown, unlocked layer. The path
creators now choose that layer the same way. While an opacity mask,
pattern or symbol is being edited, they use that edit's layer, and a
locked or hidden editing layer still throws. When every layer is locked
or hidden, the call throws and makes no path.
The creators came in with #9304.
Making a background document active can measure its type again and replace the document, so the undo step is now found by the document read after the switch. A test covers a background document whose text is measured again.
While Global Edit is on, an object model edit of one member (or a move
of a group that holds it) is given to the other members, but the check
that marks read PathPoint handles stale only looked at the edited
object's own subtree. A script that read a point of another member kept
a valid handle after the edit, even when an undo then put the member
back. The check now also looks at each Global Edit member, or the
outermost Objects on Path group that holds it, and skips subtrees the
command left as they were. The stale-point check came in with #9288.
Docs: docs/mcp.md, docs/target-app-parity.md.
Document.pathItems.removeAll() deleted every path of the document even when
one was the clipping path of a group or layer that keeps other objects, so
the next object became the clipping path. The scoped collections already
refuse this. The document's collection now runs the same check before
anything is deleted, and also refuses when it would empty a compound path or
group that clips other objects. edit.clear removes an emptied compound path
and keeps an emptied group, and the check follows it.
The fault came with #9041, which added Document.pathItems.
Writing a script's point changes drops the selected anchors and segments
that the new points no longer have before it runs path.setAnchors, so the
undo step of the edit kept the trimmed selection. Undoing the edit, with
app.undo() in the run or Edit > Undo after it, put the points back but
left them unselected. The step now keeps the selection from before the
trim.
The trim was added in #9304.
After a script reads a path's points, each command makes the run look
through the changed layers and groups of the document for those paths.
That look was not counted toward the script's operation budget, so a
loop of commands on a large layer did unbounded work. It now charges the
objects it looks at, as the layer scans in layers.rs do.
- The look pairs each object with the one of the same id under the same
parent now, and lists the document once for a group that moved, so no
object is searched for through the whole document.
- A document none of whose read paths remain is no longer looked at.
The look was added in #9288.
An edit to a Shaper source regenerates the group's paths. When the
regeneration drops a generated path and makes none, the document's next
id does not change, so the kept list of pathItems still held the removed
path. Edits to a path inside a Shaper group no longer keep the list.
- pathItems.removeAll() now throws and deletes nothing when it would delete
the clipping path of a group or layer that keeps other objects, as
pageItems.removeAll() does. The check is shared with the art collections,
and the document's collection counts compound paths that edit.clear
empties and deletes.
- rotate, resize and transform check changeLineWidths at the
transformation's own scale with changePositions false before the early
return for a path with no points, so an empty path is refused as one with
bounds is instead of having its stroke weight set.
- docs/mcp.md describes both.