Commit Graph
14 Commits
Author SHA1 Message Date
dotCooCoo 516b7eb321 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-04 07:56:23 -08:00
dotCooCoo 78a3861135 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-03 11:13:42 -08:00
dotCooCoo c4a737f255 Merge main into feat/scripts-scriptui-palettes 2026-12-03 09:29:28 -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 192c015f09 Merge main into feat/scripts-api-d5-swatches-symbols 2026-12-02 18:27:53 -08:00
dotCooCoo d8caffae61 Merge main into feat/scripts-scriptui-palettes 2026-12-02 17:15:19 -08:00
dotCooCoo d091abbf53 Scripts: palette handlers that update() runs play their palette's actions
- A handler that a palette's update() runs in a later run of the same
  engine plays the actions of the run that showed the palette, as a
  handler's own run does. After the handler ends, or throws out of
  update(), app.doScript plays the run's own actions again.
- script_palette_start gives the app the error of an open edit that
  cannot be settled, and the waiting events keep waiting; it no longer
  returns None, which showed nothing.
- A palette event runs no handler or listener once a getter or an
  earlier listener took its control out of the palette, and a click or
  change is dropped when a getter read for the event disabled or hid
  the control or a container above it.
- A palette list's change ends its run with an error when an item's
  text comes from a getter, an inherited property or an object.
- The run's report of unhandled rejections is made again after the
  palettes are refreshed, leaving out a rejection that a getter gave a
  handler, and stays empty after a failed run.
- A text a palette's field gave stays in the field until no change of
  that field waits, also while a run before the change set the field to
  the same text.
- The report test replaces a waiting change ahead of another field's
  change, and the modal-wait test requires that no later frame is asked
  for.
- docs/mcp.md: a list's change made before the app puts it in line is
  dropped without an error; an error a handler throws out of update()
  can be caught, and the run then keeps the handler's changes.
2026-12-01 21:45:22 -08:00
dotCooCoo 0507cfade0 Scripts: clipping, artboard fallback and collection fixes
- A scoped removeAll() or Edit > Clear that leaves a clipping group or
  layer without art releases its mask in the same undo step, also when
  the mask was a compound path's last member.
- GroupItem.clipped refuses changes to a hidden or locked group, layer
  or artboard.
- After the script deletes the artboard it chose, action steps use the
  same active artboard as getActiveArtboardIndex() and the view. File >
  Revert discards the script's choice.
- A compound path's pathItems is a PathItems object; its creation
  methods throw an error. PathItems and PageItems methods refuse the
  other class's scoped collections.
- Scoped collections convert to strings.
- Layer.color returns an RGBColor, so it can be assigned to paint.
- Each zOrderPosition read counts its scan toward the script's budget.
2026-11-29 16:58:27 -08:00
dotCooCoo 382d396eff Scripts: fix review findings on path lists, resource handles and Symbol
- A path list stays kept through paint, stroke and point edits that make
  no new object, so a loop over pathItems no longer rebuilds it per edit.
- Resource handles go stale when any step of a batch or an action step
  removes or renames their resource, and come back when a failed dataset
  row restores it. The names the steps compare are charged to the run,
  including for a batch that fails.
- Listing spots is charged for every swatch it looks at.
- A path inside a group inside a compound shape reads and sets the
  compound shape's paint.
- Assigning closed on an empty path is kept until the path has points,
  and is dropped once a command gives it points.
- Only the host class named Symbol leaves an existing global in place.
2026-11-29 16:14:32 -08:00
dotCooCoo b816f072c1 Scripts: layer, artboard and scoped collection fixes
- A layer's, group's or compound path's collections and Artboard objects
  read before File > Revert throw their stale errors.
- Scoped PageItems answer index() by number.
- removeAll() refuses to delete a clipping path whose group or layer keeps
  other objects (ruler guides do not count), after the lock checks.
- Layers lists are kept while the document is unchanged, so a loop over
  layers[i] lists them once; getByName on scoped collections is charged
  each time.
- Action steps act on the artboard the script chose with
  setActiveArtboardIndex, or on its index when it was deleted.
- object.newGroup refuses null for parent, index and compound.
2026-11-29 15:08:19 -08:00
dotCooCoo 9c2a4ee9eb Merge main into feat/scripts-api-d9-do-script 2026-11-28 05:27:49 -08:00
dotCooCoo fdad498dbc Scripts: doScript keeps the run's artboard picks and a batch's artboard
- The Artboard tool's selection as script.run starts is kept for the
  steps app.doScript plays: the run gives the tool fresh state, which
  dropped it, so a paste or Fit to Artwork Bounds step acted on the
  active artboard only.
- A step of a command.batch step that names its artboard acts on that
  artboard, past the last one the last, as command.batch gives it.
- The app leaves out every action of a set that shares a name with an
  action it cannot pass, so that name is never one a script can play.
- The host name check lists doScript, loadAction and unloadAction.
2026-11-21 17:46:59 -08:00
dotCooCoo 59facefcd2 Scripts: doScript checks a Batch step's commands before any step runs
An action step that runs action.batch plays its own list of commands
on each file. app.doScript now checks those commands with the action's
steps, so a stop, a command a script may not run or a command the
engine does not have among them throws an error naming the step (as
2.2) before any step of the action runs.
2026-11-21 14:25:31 -08:00
dotCooCoo 3ef8961913 Scripts: app.doScript plays an action of the Actions panel
A script can play an action by name with app.doScript(action, set,
dialogs?), the DoScript method of the scripting reference. script.run
takes a new `actions` param, and the app fills it with the Actions
panel's actions and their included steps; a recorded command.batch step
gives its own steps.

- The action and its set are matched by their exact names. A name that
  matches no action or more than one, an action with no included step,
  a stop, and a step a script may not run or the engine does not have
  (a View menu step, or one that plays an action or runs a script)
  throw before any step runs, so an action cannot play itself.
- Each step runs as vc.run runs a command: it joins the run's one undo
  step for each changed document, counts as a host call, and reads and
  writes files only where the script may. A failed step is put back and
  its error gives the step's place, the action and the command.
- A step that acts on the active artboard (paste in place, in front and
  in back, Align, Distribute Objects and Distribute Spacing to the
  artboard, All on Active Artboard, Edit Symbol, Fit to Artwork Bounds
  and Fit to Selected Art) and names no artboard gets the active
  document's active artboard, as the Actions panel's playback gives it.
  The index is the one the artboard had as the run started, clamped to
  the last artboard after a step deletes artboards. While the Artboard
  tool has several artboards selected, a paste step gets none and Fit
  to Artwork Bounds gets those artboards.
- dialogs must be true or false (default false). app.loadAction and
  app.unloadAction throw an error that says they are not available yet.
- `actions` is checked before the script starts: at most 4,096 actions,
  10,000 steps an action, 100,000 in all and 16 MiB.
2026-11-21 13:34:22 -08:00