#10682 made paths::see_all_points return a Result; d22384d6 had added a call in the mask-release path of removeAll that ignored it, so clippy -D warnings fails on main. The call now passes the error on with ?, as the other three callers do.
When the folder can't be opened or `FS_IOC_GETFLAGS` fails, `casefolded`
returned false, so `imageCapture` treated names that differ only in their
normalization form as two files and could write over a source document.
It now returns false only when the flags are read and the flag is clear.
A refused rename that falls back to copying into the target no longer
creates a missing target before the final authorization check. The
target is created only after that check, on every platform, so a
refusal at the final check leaves the path absent. An existing target
is still opened with O_CREAT, so Linux's fs.protected_regular applies.
imageCapture no longer treats an empty Linux folder as ignoring the
Unicode normalization form. It reads the folder's casefold inode flag
(FS_IOC_GETFLAGS) instead, so a missing linked cafe\u{301}.png no longer
matches cafe\u{e9}.png in an ordinary folder, and a casefolded folder
still matches both spellings.
On Windows the Unix block in same_folder is compiled out, which left
`if a == b { return true; } false` and failed clippy's needless_bool
lint with -D warnings in the Windows CI run. The early return now sits
inside the Unix block and the other platforms compare the paths.
Behavior is unchanged on every platform.
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.
Assigning fillColor or strokeColor on a text range compared the color as
given with the paint the characters have. In a CMYK document an RGB color
is stored as CMYK, so assigning the RGB color the text already stores ran
text.setRangeStyle again and recorded an undo step that changed nothing.
The comparison now converts the color through the text's own document
(its color mode and color settings), so the same assignment records no
step, and text in a background RGB document keeps an RGB color assigned
to it.
The text paint setters came with #9304.
textFrames.removeAll() and the removeAll() of a group's pageItems,
groupItems and compoundPathItems checked only clip groups whose mask
they release. Deleting the type or art below an image in an ordinary
group named Image Trace left the image first, so the group was read as
a tracing and the image dropped out of pageItems. Both now throw
"Only Image Trace can make a tracing" and delete nothing, checking the
whole set being deleted at once.
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.
- object.rasterize and Document.rasterize refuse clipBounds that reach
none of the selected objects' own bounds, including a rectangle in the
gap between two of them, instead of replacing the art with a
background-only image.
- imageCapture checks its destination again on every write the export
makes and as the file is committed, so a destination that becomes a
link to an open document or a linked file while the art renders is
refused.
- imageCapture refuses a destination whose real path is not valid UTF-8
instead of writing under a name with its bytes replaced.
- A missing linked file's name in the other Unicode normalization form
counts as the linked file in folders that ignore the form (macOS, and
casefolded folders on Linux).
- The hard-link tests skip on volumes without hard links.
- docs/mcp.md: imageCapture rounds clip dimensions to the nearest pixel;
rasterize rounds fractional dimensions up.
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.
remove(), the document's pageItems.removeAll() and textFrames.removeAll()
release the mask of a clip group whose clipping path they delete. A clip
group named Image Trace with an image next above its clipping path then
became an ordinary group named as a tracing with an image first, which
reads as a tracing. They now throw "Only Image Trace can make a tracing"
and delete nothing in that case.
docs/mcp.md names the removeAll() collections that release a mask and
the ones that refuse to delete a clipping path instead.
- object.rasterize with ids refuses objects whose nearest clip group or
clipped layer differs, before rendering: the image goes where the last
object is, so mixed sources would be clipped by another object's path.
- Document.rasterize reads the image id from the command's result inside
the run's savepoint, so an id above 2^53 binds the new RasterItem and a
missing id undoes the edit.
- Document.imageCapture refuses a destination that is another name of an
open document's file or a linked file (same device and inode, or same
volume and file index), and on Unix any file with other hard links,
which an in-place write would change under every name.
- Docs: gaps.md and target-app-parity.md list what rasterizing and
capturing still lack; mcp.md states the clipping rule, the hard-link
rule and that a later OS write failure can leave some files written.
After a script called setActiveArtboardIndex, a paste or Fit to Artwork
Bounds step that doScript played still went to the Artboard tool's
selection from the start of the run, so it pasted on or fitted those
artboards instead of the one the script chose. The script's choice now
also replaces that selection, until a revert discards it.
The choice was added in #9048 and the kept selection in #9055.
While a group is isolated, `layer.hasSelectedArtwork = true` looked only at
the layer's top-level art, which is not selectable in isolation, so it
selected nothing. It now takes what Select All takes in isolation: the art
inside the isolated group (through any sublayer it holds), or the isolated
object itself, and nothing when the isolated object or what holds it is
hidden or locked. While Lock Guides is on, paths made into guides are not
counted as art to add, so they no longer trip the selection limit.
Reading `hasSelectedArtwork` now counts each selected object it checks
toward the script's operation budget, as the setter already did.
Follows #9048, which added the property.
- Layer.zOrderPosition reads the sibling list through the cached layer
lists, so reading it for every layer of a loop lists the layers once.
Each read is still charged for the search through the list.
- TextFrames.removeAll releases the mask of a group or layer whose
clipping path is one of the type objects it deletes, as
PageItems.removeAll and remove() do, so the object above the type is
not made the clipping path.
- GroupItems.createFromFile checks that its collection is still there
first, so a collection whose group was deleted throws "Stale page item"
instead of the not-available message. docs/mcp.md says so.
Assigning `matrix` to a placed or raster image ran `object.transform` on a
locked or hidden image, an image inside a locked or hidden layer or group,
and an image on a locked artboard. The transform methods (`translate`,
`rotate`, `resize`, `transform`) refuse all of these with nothing changed.
The setter now refuses them with the same errors, before the unchanged
matrix check, so assigning the current matrix to such an image throws too.
The locked artboard check uses the cached lookup that `editable` uses.
The setter came in with #9062.
Docs: docs/mcp.md.
`resize` and `transform` with `changeLineWidths` at the transformation's own
scale scaled a path's strokes past the 1000-point limit that other line
widths enforce, and could store a NaN weight for a scale too large for a
number. Every stroke layer the transformation scales is now checked against
the limit with the factor the transformation applies.
`rotate`, `resize` and `transform` threw "the object has no bounds" on a
path without points whenever the call named or defaulted to a point of the
bounds. Such a path now takes the transformation about the origin, or the
first artboard's bottom-left corner for `Transformation.DOCUMENTORIGIN`,
so its linked mask, strokes, effects and patterns still transform.
Both faults came in with #9295.
Assigning `clipped = true` to a GroupItem checked only that the group and
its layer were editable, so a hidden or locked topmost object lost its fill
and stroke and became the clipping path. The setter now refuses that object
before running the command, with no undo step. The setter came from #9048.
The scripting reference gives unitScaleRatio as the ratio, as a
percentage, by which the output is scaled, from 0 to 1000. exportFile
passed it to the DXF writer as drawing units per unit, so 100 wrote
the drawing 100 times too large and 1 wrote it at full size.
- The value is divided by 100 before it reaches the DXF writer, and a
value left out still writes at full size (100).
- A value below 0.0001, which the writer's smallest scale cannot
represent, throws a range error at the script instead of an error
about the DXF scale from the writer.
- docs/mcp.md describes the percentage and the default of 100.
The option was added in #9266.
- paletteClose with another engine's palette id no longer drops that
palette's waiting events.
- A hidden palette is not described after a run or an add, so a
throwing getter on it no longer fails the run; script.palettes and
docs/mcp.md say a hidden palette lists its controls as they were.
- A check box's click rechecks the box after reading its value, so a
getter that disables it or closes the palette stops the click.
- A list's change rechecks that the list is still enabled and visible
after its item texts are read, and is dropped when a getter disabled
or hid it.
- A waiting palette event does not start its run, or ask for frames,
while the last run's print jobs wait for their answer.
- script.palette.event's help states that a change merges only after
its palette's last waiting click or close.
A tracing saved without the record of the objects its trace made was
checked against a snapshot taken when the script first got its
PluginItem. A script that reached the tracing's paths first (through
pathItems or the selection) and added artwork beside them had that
artwork in the snapshot, so tracing again or releasing the tracing
discarded it without an error.
- Before each command a script runs, the run notes the id the active
document gives its next object. An object the run made since then
counts as added to an older tracing saved without its record.
- After file.revert the note moves to the reloaded document's next id,
so objects read back from the file are not counted as added.
The snapshot check comes from 466debdc (Scripts: tracing refuses
protected art).