Merge pull request #8649 from dotCooCoo/feat/actions-automatic-align-to

Actions: an action can choose Align To when it plays
This commit is contained in:
BFlat
2026-11-19 15:09:04 +07:00
committed by GitHub
42 changed files with 791 additions and 45 deletions
+31 -13
View File
@@ -4227,18 +4227,20 @@ already walks Image Trace. Short agent entry points:
`stepIndex` from 0, and `batchStep` is the command's place in a `command.batch` step), and `unknownCount`, how many
there are; the status bar names the first and the count, with control characters replaced and long names cut at 80
characters. These are VectorCraft's own rules. An action set file (`.vcactions`) is JSON:
`{"format": "vcactions", "version": 1 to 6, "name", "actions": [{"name", "steps": [{"command", "params", "excluded"?}]}]}`, each step
`{"format": "vcactions", "version": 1 to 7, "name", "actions": [{"name", "steps": [{"command", "params", "excluded"?}], "automaticAlignTo"?}]}`, each step
a command id and its params as `command.batch` takes them, or a stop: the command `action.stop` with
`{message, allowContinue}`. A Select Object step is the command `select.byNote` with `{note, caseSensitive,
wholeWord}`, and a Select Path step is the command `select.storedPath` with `{id, fingerprint}`. A View menu step is
the id of a View menu command that the app runs itself (`view.outline`, `view.zoomIn`, `view.rotate` and the others
`ui.action.insertMenuItem` lists) with the item's params. `excluded: true` preserves a step but omits it from playback;
an absent or false flag includes the step. Files with View menu steps use version 6, files with Select Path steps and
no View menu step use version 5, files with Select Object steps and neither use version 4, files with stops and none
an absent or false flag includes the step. Files with an action whose `automaticAlignTo` is true, or with an
`object.align` step (excluded, or inside a `command.batch` or `action.batch` step, too) whose `to` is `"auto"`, use
version 7. Other files with View menu steps use version 6, files with Select Path steps and no View menu step use
version 5, files with Select Object steps and neither use version 4, files with stops and none
of these use version 3, and files with excluded steps and none of these use version 2, so older builds refuse them
instead of playing the excluded steps or failing at a stop, a Select Object step, a Select Path step or a View menu
step; other files use version 1, and version 1 to 5 files still load. A file with another `format` or a `version` other than
1 to 6, a stop whose message is not text or whose `allowContinue` is not true or false, a Select Object step whose params `ui.action.insertSelectObject` would refuse, a View menu step whose params are not an object, a file larger than 8 MiB, one with more than 1,000 actions and one with an action of more than 10,000 steps are
step; other files use version 1, and version 1 to 6 files still load. A file with another `format` or a `version` other than
1 to 7, a stop whose message is not text or whose `allowContinue` is not true or false, a Select Object step whose params `ui.action.insertSelectObject` would refuse, a View menu step whose params are not an object, a file larger than 8 MiB, one with more than 1,000 actions and one with an action of more than 10,000 steps are
refused, and no set is added. So is a file whose set `ui.actionSet.save` would write larger than 8 MiB (a file with
less white space, a set name that gets a number, or an `.aia` set), with the error `the action set would be larger
than 8 MiB`. The Actions panel menu's Save Actions… and Load Actions… run these; Load Actions… is
@@ -4269,18 +4271,28 @@ already walks Image Trace. Short agent entry points:
exclusion that would give the set's action set file more than 8 MiB, counting the steps the recording in progress
adds to the set; it is an error. A change that leaves the file as large or makes it smaller is never refused. The
panel's checkmarks run this command; normal playback and Batch… skip excluded steps.
- Actions: `ui.action.new {set, name, key?, cmd?, shift?, color?}` adds an action named `name` (spaces
- Actions: `ui.action.new {set, name, key?, cmd?, shift?, color?, automaticAlignTo?}` adds an action named `name` (spaces
trimmed) after the last action of set `set` (0 is the top set), starts recording into it and returns
`{set, action}`; Stop Playing/Recording (`ui.action.stop`) ends the recording. `key` 1 to 15 is the function key F1 to F15 that plays the
action (0 or null for none), with `cmd` (Ctrl, Command on macOS) and `shift`. `color` is its Button Mode color
(`red`, `yellow`, `green`, `blue` or `violet`; null or `""` for none), the color of its button in Button Mode
(`ui.action.buttonMode`). Action function
(`ui.action.buttonMode`). `automaticAlignTo: true` makes playback run each of the action's `object.align` steps,
those in a recorded Batch run (`action.batch`) included, with `to: "auto"` (see [Align to Artboard](#align-to-artboard)):
the key object, key anchor or key guide, else the artboard for one whole selected object, else the selection.
Playback also leaves out an `artboard` the step stores, so the step uses the active artboard, as `object.align`
without `artboard` does. A Batch run passes no active artboard to its steps, so when an `object.align` step in a
Batch run aligns to the artboard, it uses the artboard under the center of the selection, or the first artboard when
none is there. `object.distribute` and `object.distributeSpacing` steps play with the `to` they were recorded with.
The stored steps keep the `to` they were recorded with, and the action plays them as recorded again when the option
is turned off. It is false when left out or null, and a value that is not true, false or null is an error. These are
VectorCraft's own rules. Action function
keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6
cannot be used. While an action is recording, and for an index past the last set,
an empty name, or a key or color that is not one of these, it is an error and nothing is added. So is an action that
would give the set more than 1,000 actions (`the action set file holds more than 1,000 actions`) or a file larger
than 8 MiB (`the action set would be larger than 8 MiB`), and then no recording starts. The panel's Create
New Action button and menu's New Action… open the `actionNew` dialog, whose Record runs this.
New Action button and menu's New Action… open the `actionNew` dialog, whose Record runs this; its Choose Align To at
playback checkbox sets `automaticAlignTo`.
- Actions: `ui.action.record {set?, action?, after?}` starts recording a new action in the chosen set, or the current
set when `set` is left out, and returns `{set, name}`. With no sets, it creates Set 1. The action gets the next
available `Action N` name in that set. With `action`, it records into the action at `action` in set `set` instead
@@ -4301,11 +4313,12 @@ already walks Image Trace. Short agent entry points:
`ui.action.stop` keeps the steps that fit. A stop that playback reaches
then is not recorded, and the status bar shows the reason. `ui.action.stop` leaves out any recorded steps still past
either limit and shows which one in the status bar.
- Actions: `ui.action.options {set, action, name?, key?, cmd?, shift?, color?}` changes the action at
- Actions: `ui.action.options {set, action, name?, key?, cmd?, shift?, color?, automaticAlignTo?}` changes the action at
`action` in set `set` and keeps its steps: `name` renames it, `key` with `cmd` and `shift` sets its function key,
and `color` its Button Mode color, as `ui.action.new` takes them; a param left out keeps what the action has, and
`cmd` or `shift` alone changes that modifier of its key. It
returns `{name, key, color}`. The panel menu's Action Options… runs this for the selected action. A function key
`color` its Button Mode color and `automaticAlignTo` how its Align steps play, as `ui.action.new` takes them; a param
left out (or a null `automaticAlignTo`) keeps what the action has, and `cmd` or `shift` alone changes that modifier
of its key. It returns `{name, key, color, automaticAlignTo}`. The panel menu's Action Options… runs this for the
selected action, and its dialog has the same checkbox as New Action…. A function key
plays its action from the keyboard; like command shortcuts, it does nothing while a dialog, the command palette or
a text field has the keyboard, or while a tool is busy. Editing command shortcuts (`shortcuts.set`, Keyboard Shortcuts), loading preferences and
`ui.actionSet.load` preserve action function keys. When several actions have the same key, the first in panel order
@@ -4373,7 +4386,8 @@ already walks Image Trace. Short agent entry points:
toggle, an Actions command, a Perspective Grid preset of the preferences or a recent-font, saved-selection or saved-view slot. Disabled items are listed, and playback checks the step when it runs. An Object › Align item's step
keeps the `to` its click sends at insertion (`key` while the selection has a key object or key guide, `artboard` for one selected
object or with Align to Artboard, else `selection`), so a later Align To choice does not change it, and a step that
aligns to the key object fails in playback when the selection has no key then. With anchor points selected the click
aligns to the key object fails in playback when the selection has no key then. In an action with `automaticAlignTo`
on (`ui.action.new`), playback sends `to: "auto"` for every `object.align` step instead. With anchor points selected the click
sends no `to`, and neither does the step. These are VectorCraft's own rules. A
View menu step plays as `ui.action.play` describes. With `set` and `action`, the
step goes into that action, after step `step`, else after its last step, becomes the panel's selected step, and the
@@ -7310,6 +7324,10 @@ below 3 or above 1000 counts as 3 or 1000, and a fractional or negative `sides`
## Align to Artboard
`object.align {to: "auto"}` chooses the target each time it runs: the key object, key anchor or key guide when the
selection has one, else the artboard when exactly one object is selected and no anchor points are, else the
selection. It then aligns as that `to` value does, and it changes neither the selection nor the key. These are VectorCraft's own rules.
`object.align {to: "artboard", artboard?}` aligns the selected objects to artboard `artboard` (a 0-based index).
Without `artboard`, or with an index the document doesn't have, it aligns them to the artboard under the center of the
selection, or to the first artboard when no artboard is under the center. With `to: "selection"` or `"key"`,
+2 -1
View File
@@ -920,6 +920,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- Actions panel menu: Load Actions… reads an `.aia` file's Set Selection step, which selects objects by the note typed in its dialog ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html)), as a Select Object step with its note, Case Sensitive and Whole Word (`ui.actionSet.load`; `actionSet.read` now lists each step's recorded values with their keys and types). VectorCraft's own rules: the step is found by its internal name whatever its label, and comes in only when it has exactly the note (UTF-8, 1 to 1,024 bytes once trimmed) and the two options (each 0 or 1); any other Set Selection step is left out and counted, with no option filled in. Tests `panels::actions::tests::{load_actions_reads_set_selection_steps_as_select_object, set_selection_steps_with_bad_values_are_left_out}`, `tests::actionset::{recorded_values_come_back_with_their_keys_and_types, recorded_values_past_the_cap_are_counted_but_not_kept}`.
- Actions panel: the panel menu's Action Options… renames the selected action and keeps its steps ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html): the menu item opens a dialog that renames the action or gives it a function key and color; `ui.action.options`). It also sets the action's function key and color.
- Actions panel: Create New Action (bottom bar) and the panel menu's New Action… ask for the new action's name, set, function key and color, and Record adds the action and starts recording into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html): the New Action dialog takes the action's name and the set it goes in; `ui.action.new`, `ui.action.play`). The function key (F1 to F15, with Ctrl or Command and Shift) plays the action. An action's function key plays the action even when a command has the same shortcut, and the command keeps it. VectorCraft's own rules, which the page does not cover: when several actions have the same key the first in panel order plays; a copied action has no key; New Action does not open while an action is recording. The color is the color of the action's button in Button Mode.
- Actions panel: New Action… and Action Options… have Choose Align To at playback, off by default. With it on, each Align step of the action aligns to the key object, key anchor or key guide when the selection has one, else to the artboard when one whole object is selected, else to the selection; the recorded steps are kept as they were, and Save Actions… and Load Actions… keep the option (#6972; `ui.action.new`, `ui.action.options`, `object.align` with `to: "auto"`). These are VectorCraft's own rules.
- Actions panel: the panel menu's Button Mode shows the actions as buttons with their names in their Action Options colors, without sets or individual commands; a click on a button plays its action without its excluded steps, and choosing Button Mode again returns to the list ([the help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=467) and [the next page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=468); [the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/exclude-commands-from-actions.html) says commands cannot be excluded in Button Mode; `ui.action.buttonMode`, `ui.action.playAt`). VectorCraft's own rules, which the pages do not cover: the menu item shows a check mark while Button Mode is on; every set's actions show, in set order and then action order; an action without a color is an ordinary button; function keys still play their actions; the bottom bar shows only Stop Playing/Recording while an action plays or records, and Play Current Selection while one waits at a stop; Button Mode cannot be turned on while an action records; and the mode is kept with the UI preferences.
- Actions panel: with an action selected, Begin Recording adds the commands recorded to that action, after its selected step or at its end, and a step dragged within its action or to another action goes where a highlighted line shows when the button is released ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/add-commands-to-actions.html); `ui.action.record`, `ui.action.moveStep`). VectorCraft's own rules, which the page does not cover: with no action selected Begin Recording adds a new action; a step can go into an empty action or an action in another set; a release off the actions' rows leaves the step where it was; a moved step keeps whether it is excluded; Undo does not move it back.
- Actions panel (record/playback, persisted), generic parameter dialogs for every "…" command.
@@ -929,7 +930,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- Actions panel: the panel menu's Playback Options… sets how actions play: Accelerated (the default) plays every step at once, Step by Step plays one step at a time with the canvas drawn after each, and Pause For waits the given number of seconds between steps ([Specify playback speed](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/specify-playback-speed.html); `ui.action.playbackOptions`). VectorCraft's own rules, which the page does not cover: the pause is a whole number of seconds from 1 to 60, the setting is kept with the UI preferences, a paced playback ends at Stop Playing/Recording or when a step comes due while another document is active, each step of a paced playback is its own undo step, and Batch… plays at full speed.
- Actions panel: the panel menu's Insert Stop… opens Record Stop, with a Message box and Allow Continue, and adds a stop to the recording in progress, after the selected command, or at the end of the selected action ([Insert stops in actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-stops-in-actions.html); `ui.action.insertStop`). A playing action waits at the stop and shows the message so the user can do a manual task, and Play Current Selection plays the rest ([Illustrator CS5 help](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=459); `ui.action.continue`). With Allow Continue, the message box also has Continue. VectorCraft's own rules, which the pages do not cover: an empty message still waits, Stop Playing/Recording ends the playback and keeps the steps already played, the rest plays on the document active then, a stop waits at every playback speed, at Accelerated the steps between two stops are one undo step, Batch… refuses an action with an included stop, and Delete Selection on a selected step deletes that step, a stop or a command, without asking (`ui.action.deleteStep`).
- Actions panel: the panel menu's Insert Menu Item… adds a menu command to the recording in progress, after the selected step, or at the end of the selected action, without running it, and playback runs it as the menu does ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); `ui.action.insertMenuItem`). The dialog's Find box picks the one item that matches the words typed, and a click on a listed item picks it. VectorCraft's own rules, which the page does not cover: items that open a dialog, Image Trace's Make and Make and Expand, Pattern's Make and Edit Pattern, and the File, Window and Help menu items are not listed, and an action holds at most 10,000 steps and its set file at most 8 MiB, for stops too.
- Actions panel: Insert Menu Item… also lists the Object › Align items and the View menu commands that act on the window rather than the document (Outline, Pixel Preview, Trim View, Presentation Mode, Screen Mode, zoom, fit, Rotate View, and the show, hide and snap items), which the help page names among the commands that cannot be recorded ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); [Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html); `ui.action.insertMenuItem`, `ui.action.play`). VectorCraft's own rules, which the pages do not cover: an Align step keeps the Align To choice of its insertion, and one that aligns to the key object stops the playback when there is no key; a View menu step plays in its place at every speed and adds no undo step, so at Accelerated the steps on each side of it are one undo step each; Batch… refuses an action with one; and a set file with one is version 6. Tests `panels::actions::tests::{an_inserted_view_item_plays_in_its_place_at_accelerated, an_inserted_view_item_plays_step_by_step_and_with_pauses, an_inserted_view_item_plays_up_to_a_stop, a_view_step_played_while_recording_is_recorded, a_saved_view_step_survives_as_version_6, an_inserted_align_item_keeps_the_align_to_of_its_insertion, an_align_step_to_the_key_object_fails_without_a_key}`.
- Actions panel: Insert Menu Item… also lists the Object › Align items and the View menu commands that act on the window rather than the document (Outline, Pixel Preview, Trim View, Presentation Mode, Screen Mode, zoom, fit, Rotate View, and the show, hide and snap items), which the help page names among the commands that cannot be recorded ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); [Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html); `ui.action.insertMenuItem`, `ui.action.play`). VectorCraft's own rules, which the pages do not cover: an Align step keeps the Align To choice of its insertion, and one that aligns to the key object stops the playback when there is no key, unless the action has Choose Align To at playback on; a View menu step plays in its place at every speed and adds no undo step, so at Accelerated the steps on each side of it are one undo step each; Batch… refuses an action with one; and a set file with one is version 6, or version 7 when the set also uses Choose Align To at playback or holds an Align step with `to: "auto"`. Tests `panels::actions::tests::{an_inserted_view_item_plays_in_its_place_at_accelerated, an_inserted_view_item_plays_step_by_step_and_with_pauses, an_inserted_view_item_plays_up_to_a_stop, a_view_step_played_while_recording_is_recorded, a_saved_view_step_survives_as_version_6, an_inserted_align_item_keeps_the_align_to_of_its_insertion, an_align_step_to_the_key_object_fails_without_a_key}`.
- Actions panel: the error of a played step that fails names the step by its place in the expanded action, 1 for the first step, counting excluded steps and stops, at every playback speed and after a stop (`ui.action.play`, `ui.action.continue`). A failing step of a recorded batch is named by the batch's place and its own command. The numbering is VectorCraft's own rule. Tests `panels::actions::tests::{an_error_after_a_view_item_names_the_step_in_the_action, a_failing_view_item_names_the_step_in_the_action, an_error_counts_excluded_steps, an_error_in_a_recorded_batch_names_the_batch_step, an_error_of_the_whole_batch_names_no_step, a_paced_error_names_the_step_in_the_action, an_error_after_a_stop_names_the_step_in_the_action}`.
- Actions panel: with a path selected, the panel menu's Insert Select Path adds a step that selects that path to the recording in progress, after the selected step, or at the end of the selected action, without changing the selection ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); `ui.action.insertSelectPath`, `select.storedPath`). VectorCraft's own rules, which the page does not cover: the selection must be one whole path or compound path that can be selected, the step stores the path's id and a fingerprint of its anchors, and playback selects the path only while it is still there unchanged and can be selected, else the step is an error and the selection stays; the row reads Select Path, and a set file with the step is version 5.
- Actions panel: the panel menu's Select Object… opens Set Selection, where the note typed names the objects to select, and adds a step to the recording in progress, after the selected step, or at the end of the selected action; playback selects the objects whose Attributes note matches it, and the steps after it act on them ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); `ui.action.insertSelectObject`, `select.byNote`). VectorCraft's own rules, which the page does not cover: the note matches anywhere and in any letter case unless Case Sensitive or Whole Word is checked, hidden and locked objects are left out, the objects found replace the selection, a step that finds none stops the playback with an error, and the note is at most 1,024 bytes. Action sets with the step save as version 4.