Commit Graph
731 Commits
Author SHA1 Message Date
dotCooCoo a857b49af4 Main: removeAll on a clipping path passes on a stale-point error
#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.
2026-12-03 08:46:32 -08:00
.CooCoo fff1c92179 Merge pull request #10682 from dotCooCoo/fix/script-point-scan-charged
Scripts: the look for changed path points after each command is charged
2026-12-03 08:22:32 -08:00
.CooCoo fc19f5a42d Merge pull request #10664 from dotCooCoo/fix/action-playback-current-artboard
Scripts: doScript steps act on the artboard the script made active
2026-12-03 07:36:06 -08:00
.CooCoo a64c923e04 Merge pull request #10658 from dotCooCoo/fix/layer-selection-scans
Scripts: hasSelectedArtwork selects inside an isolated group and charges its scans
2026-12-03 07:35:25 -08:00
.CooCoo de71cfc9ef Merge pull request #10654 from dotCooCoo/fix/script-image-matrix-locks
Scripts: image matrix assignment refuses locked and hidden images
2026-12-03 07:34:43 -08:00
.CooCoo 6d2b626597 Merge pull request #10653 from dotCooCoo/fix/script-transform-stroke-limit-empty-path
Scripts: transforms keep path strokes within 1000 points and take empty paths
2026-12-03 07:34:28 -08:00
.CooCoo 06d4971200 Merge pull request #10648 from dotCooCoo/fix/dxf-unit-scale-ratio-percent
Scripts: ExportOptionsAutoCAD.unitScaleRatio is a percentage
2026-12-03 07:34:11 -08:00
.CooCoo 4ed98d68c1 Merge pull request #10645 from dotCooCoo/fix/legacy-tracing-first-sight
Scripts: tracings saved without their record catch artwork added before the script reaches them
2026-12-03 07:33:48 -08:00
.CooCoo 9a21dae940 Merge pull request #10636 from dotCooCoo/fix/script-image-read-once
Scripts: placing or relinking an image reads its file once
2026-12-03 07:32:03 -08:00
.CooCoo 79fdfedfb5 Merge pull request #9075 from dotCooCoo/feat/scripts-api-d8c-rasterize-capture
Scripts: Document.rasterize and Document.imageCapture with their option classes
2026-12-03 07:14:28 -08:00
dotCooCoo 4a1ac38ac3 Scripts: a Linux folder whose casefold flag can't be read is taken as casefolded
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.
2026-12-03 02:59:58 -08:00
dotCooCoo ade0e47f48 Scripts: refused writes create no file; Linux reads the casefold flag
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.
2026-12-03 02:35:18 -08:00
dotCooCoo 0d9dfe6bb8 Merge main into fix/script-clipped-hidden-top 2026-12-03 01:54:05 -08:00
dotCooCoo 4e90d6c211 Scripts: same_folder builds without a needless bool on Windows
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.
2026-12-03 00:09:32 -08:00
dotCooCoo 3d69c8d49a Scripts: removeAll cannot leave an image first in a group named Image Trace
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.
2026-12-02 22:58:00 -08:00
dotCooCoo 14e8959bc0 Scripts: tighten rasterize clip bounds and imageCapture destination checks
- 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.
2026-12-02 22:19:16 -08:00
dotCooCoo 74e7109026 Scripts: the look for changed path points after each command is charged
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.
2026-12-02 21:28:43 -08:00
dotCooCoo 72e99d1c3b Merge main into feat/scripts-layer-text-frames 2026-12-02 21:17:26 -08:00
dotCooCoo f7d310828a Merge main into fix/script-transform-stroke-limit-empty-path 2026-12-02 20:54:00 -08:00
dotCooCoo f46d591204 Merge main into feat/scripts-api-d8c-rasterize-capture 2026-12-02 20:30:16 -08:00
dotCooCoo 80569dc577 Scripts: deleting a clipping path cannot make a tracing
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.
2026-12-02 20:24:21 -08:00
dotCooCoo 8714ec7731 Scripts: rasterize refuses sources clipped differently, capture checks file identity
- 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.
2026-12-02 20:10:56 -08:00
dotCooCoo e10dc47ae8 Scripts: doScript steps act on the artboard the script made active
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.
2026-12-02 19:08:51 -08:00
dotCooCoo 27e10129bd Scripts: hasSelectedArtwork selects inside an isolated group and charges its scans
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.
2026-12-02 18:44:27 -08:00
dotCooCoo 0d8a56cfde Scripts: zOrderPosition reuses the layer list; textFrames.removeAll releases masks
- 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.
2026-12-02 18:44:26 -08:00
dotCooCoo c1470adfc6 Merge main into feat/scripts-text-paint 2026-12-02 18:14:59 -08:00
dotCooCoo cca97099a7 Scripts: image matrix assignment refuses locked and hidden images
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.
2026-12-02 18:02:52 -08:00
dotCooCoo 99a04b9a78 Scripts: transforms keep path strokes within 1000 points and take empty paths
`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.
2026-12-02 17:52:07 -08:00
dotCooCoo e4e6dd517d Merge main into feat/scripts-layer-text-frames 2026-12-02 17:49:12 -08:00
dotCooCoo a7c6ff1d43 Scripts: clipped = true refuses a hidden or locked topmost object
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.
2026-12-02 17:45:14 -08:00
dotCooCoo 1922ba20c9 Scripts: ExportOptionsAutoCAD.unitScaleRatio is a percentage
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.
2026-12-02 17:27:06 -08:00
dotCooCoo a7c7dae179 Merge main into feat/scripts-api-d8c-rasterize-capture 2026-12-02 17:25:26 -08:00
.CooCoo cd502f08e8 Merge pull request #9073 from dotCooCoo/feat/scripts-api-d1b-prefs-matrix-clipboard
Scripts: app gives scripts preferences, matrices and the clipboard
2026-12-02 17:08:38 -08:00
.CooCoo 5d8deddaf0 Merge pull request #9048 from dotCooCoo/feat/scripts-api-d3-layers-artboards
Scripts: documents give scripts their layers, groups, compound paths and artboards
2026-12-02 16:50:47 -08:00
dotCooCoo cdbd288f3c Scripts: tracings saved without their record catch artwork added before the script reaches them
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).
2026-12-02 16:40:50 -08:00
dotCooCoo 7b433a52fe Merge main into feat/scripts-api-d8c-rasterize-capture 2026-12-02 16:27:15 -08:00
dotCooCoo dc94ae977c Docs: matrix records passed in need only the six mValue fields
The matrix functions read only mValueA to mValueTY from a record passed
in. The typename "Matrix" is on the records they give back.
2026-12-02 16:10:05 -08:00
.CooCoo e72ff7480d Merge pull request #9062 from dotCooCoo/feat/scripts-api-d8-placed-raster
Scripts: documents give scripts their placed and raster images
2026-12-02 16:07:47 -08:00
dotCooCoo 70504f6dfe Merge main into feat/scripts-layer-text-frames 2026-12-02 16:02:05 -08:00
dotCooCoo 98c6e5fb20 Merge main into feat/scripts-api-d3-layers-artboards 2026-12-02 15:57:11 -08:00
dotCooCoo 44b238b814 Merge main into feat/scripts-text-paint 2026-12-02 15:51:24 -08:00
.CooCoo 822651dc7a Merge pull request #9266 from dotCooCoo/feat/scripts-export-autocad
Scripts: exportFile writes DXF with ExportOptionsAutoCAD
2026-12-02 15:42:04 -08:00
dotCooCoo 08a29802b8 Scripts: placing or relinking an image reads its file once
PlacedItem.file and PlacedItem.relink() ran file.place.info on the file
to check that it held an image, then file.place or links.relink read and
decoded it again. The image check now runs inside file.place and
links.relink while a script places or relinks an image: a file in no
image format is refused before the document changes, with "The file is
not an image", and a damaged image keeps its own error. The double read
came in with fed96731e2 (#9077).

A test counts the engine's file reads and fails with 2 reads on main.
2026-12-02 15:38:44 -08:00
dotCooCoo e369013463 Merge main into feat/scripts-api-d3-layers-artboards 2026-12-02 15:37:51 -08:00
dotCooCoo 217c33d46e Merge main into feat/scripts-layer-text-frames 2026-12-02 15:29:55 -08:00
dotCooCoo 60383e1ac1 Merge main into feat/scripts-api-d8c-rasterize-capture 2026-12-02 15:28:08 -08:00
dotCooCoo ab35e04329 Merge main into feat/scripts-api-d1b-prefs-matrix-clipboard 2026-12-02 15:23:31 -08:00
dotCooCoo d73dad7ee0 Merge main into feat/scripts-api-d8c-rasterize-capture 2026-12-02 14:38:27 -08:00
dotCooCoo b47eaf582c Merge main into feat/scripts-api-d8-placed-raster 2026-12-02 14:14:45 -08:00
dotCooCoo 80eb658aa9 Merge main into feat/scripts-layer-text-frames 2026-12-02 14:12:48 -08:00