- remove() on the last path of a compound path keeps the compound path,
empty, as move() does, so a script that holds it can still read it.
edit.clear takes keepEmpty: true for this, and passes it on to
path.deleteAnchors when it deletes direct-selected anchors; without
it, Clear still deletes a compound path it empties.
- note, like name, takes a number or a Boolean as the text String()
gives it.
- Assigning a graph mark or label the opacity it already has throws
Cannot edit in a hidden or locked layer when the graph keeps another
opacity for its series or kind, since the assignment would still
change the graph.
- Only the exact opacity the getter reports counts as the opacity an
object already has; a value that differs from it by less than 0.0001
is now applied instead of being dropped.
- Reading a document's selection orders only the selected objects, by
their place in the tree, so its cost no longer grows with the size of
the document.
- docs/mcp.md: the opacity exception, note, keepEmpty, and that
strict-mode code throws a TypeError when it assigns a member an object
lacks.
Docs: docs/mcp.md.
- zOrder() on an object in a hidden or locked layer throws Cannot edit
and changes nothing, as the other setters do.
- Assigning an object the opacity it already has no longer throws when
its layer is hidden or locked. hidden and locked are still refused
there, whatever the value.
- The docs say that a top-level var selection = ... assigns the
selection, that the selection order and the tab order of documents
differ from the objectReferences page, and that assigning a member a
collection lacks throws Not found.
Docs: docs/mcp.md.
- Assigning hidden, locked, position, left, top, width or height to an
object in a hidden or locked layer throws Cannot edit, as opacity
does, and changes nothing. Its name and note still change.
- An object with nothing in it, such as an empty group or a compound
path whose paths moved out, reads its bounds, position, width and
height as zeros, and assigning them does nothing, so reading every
property for-in lists does not throw on it.
- Assigning selection without app. sets the active document's
selection, and app.selection can be assigned the same way. Assigning
activeDocument without app. activates a document, and assigning
documents keeps its value.
- JSON.stringify writes a collection, or data that holds one, without
reading toJSON through the collection's name lookup, which threw
Not found.
- The docs state that Object.keys, Object.getOwnPropertyNames and
Object.getOwnPropertyDescriptor do not report the members, that a
value assigned to a member the class lacks is not kept, and that the
selection order is VectorCraft's own rule.
Docs: docs/mcp.md, docs/target-app-parity.md.
Scripts that check a member with hasOwnProperty before using it skipped
every page item, because the members live on the class prototype. Now
hasOwnProperty and propertyIsEnumerable are true for each member of an
object's class that is available, and for-in lists its properties but
not its methods. Members that only throw "not available yet" stay false.
- An empty selection is an empty list instead of null.
- pageItems lists art topmost first, as the CMYKColor example reads the
frontmost path as pathItems[0]
(https://ai-scripting.docsforadobe.dev/jsobjref/CMYKColor/). A
document's selection lists the selected objects in that order too,
whatever order they were picked in. That selection order is
VectorCraft's own rule.
- A collection read with a name, such as pageItems["Logo"], gives what
getByName gives, as
https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/
shows. A name nothing has throws Not found, and assigning to such a
name throws the same error.
- activeDocument, documents and selection can be named without app., as
that page describes for the application's members.
- move() with the object itself and PLACEBEFORE or PLACEAFTER leaves it
where it is and adds no undo step.
- move() keeps a compound path whose last path moves out, so a script
that holds it can still read it.
- Assigning opacity to an object in a hidden or locked layer throws
Cannot edit and changes nothing.
- name takes a number or a Boolean as its text.
- String() of an object gives its class and name, such as
[PathItem Logo].
Docs: docs/mcp.md, docs/target-app-parity.md.
pageItems walked into groups and compound paths only, so the objects inside a blend,
an envelope, a repeat or an intertwine were missing from length, [i], index and
getByName, although each of them reports that container as its parent. The walk now
goes into every container's children.
- Document.selection and PageItem.selected refuse a path made into a
guide while Lock Guides is on, instead of passing the check and then
selecting nothing. The locked artboards are measured once per
assignment.
- An edit whose command selects the objects it changes puts the current
layer and the highlighted Layers panel rows back as they were.
layer.setCurrent takes keepRows, which leaves the highlighted rows as
they are.
- move on an object on a locked artboard throws Cannot move, as editable
reads false for it. duplicate, with or without a relative object, on a
hidden or locked object or an object on a locked artboard throws
Cannot duplicate and makes no copy.
- When move takes the last path out of a compound path, the empty
compound path is deleted in the same undo step.
- addDocument writes each warning from reading the profile's file to the
Script Console as addDocument: <warning>, and a previewMode of
PixelPreview throws an error that says it is not available yet.
- PageItem.editable is false for art on a locked artboard, as remove()
refuses it. A group on a locked artboard is measured once for all its
members.
- The lists of page items are kept for the last four documents read, so
a script that reads two documents in turn does not walk each one again
on every index.
A New Document profile file that is a link or a folder is no longer read:
the read is exempt from a script's file gate, which never checked where a
link leads. file.new reports it as a profileError with the reason "not a
plain file".
Reading a DocumentPreset setting now counts the value it returns toward
the data a run may pass, as assigning it does, and addDocument counts the
preset's settings before copying them.
The removeAll() test on a locked artboard now also holds an object on an
unlocked artboard and checks it is still there after the call throws.
PageItem.remove() and PageItems.removeAll() checked only whether the
object and its layers and groups were shown and unlocked, then passed the
ids to edit.clear, which deletes named objects without checking artboard
locks. Both now throw "cannot delete objects on a locked artboard" with
the object ids and delete nothing, as art on a locked artboard is not
editable elsewhere in the document.
Setting selected to true or false runs select.add or select.toggle for that one object, so the
other objects keep their direct-selected anchors and segments and the key object. Before, it
replaced the selection with whole objects.
- new DocumentPreset() now makes an object of the DocumentPreset class whose settings the run
keeps, so addDocument refuses a plain object, one with a typename of DocumentPreset included,
with a TypeError naming presetSettings.
- When file.new reports a profileError, addDocument throws an error that names the profile and
the reason, and the document made with the defaults is put back.
- A script's file.new reads the New Document profile file in the app's own profiles folder;
the automation roots in force still apply. Before, the script's file gate refused the folder,
so a scripted addDocument never used an edited profile.
Docs: docs/mcp.md.
remove() on an object that is hidden or locked, sits in a hidden or locked layer or group, or is a group holding such an object now throws and deletes nothing, the same rule pageItems.removeAll() applies. docs/mcp.md states both rules and that width and height scale along the page's axes.
The host name test now has rows for app, the document model classes and the enumerations the script host adds. zOrder on a path inside a compound path throws an error and leaves the document unchanged, as duplicate does.
- An edit a script makes puts back a Layers panel target, an object
chosen inside a dynamic symbol instance and an object chosen in an
Objects on Path group, each with its own selection command.
- Assigning a document's selection selects a symbol instance or an
Objects on Path group as a whole when one of its objects was chosen.
- file.newPresets lists a grid by column's rows as set, also when there
are fewer artboards than rows, and New Document's Columns shows the
columns those rows give the current number of artboards.
- docs/roadmap.md's M13 row names the script object model that is
available.
- duplicate() runs Edit > Duplicate, the place and the selection
restore under one savepoint, so a refused place leaves the documents,
the selection and the undo history as they were. It reads the copy's
id from the command's own result, so ids above 2^53 return the copy.
A path inside a compound path throws an error instead of copying the
whole compound path.
- An edit restores a mixed selection (direct-selected anchors and whole
objects) in its original order with one select.anchorsMany.
- Assigning the selection clears a Layers panel target.
- A call on an inactive document switches back even when the selection
restore fails.
- documents.add with a grid by column passes the row count to file.new,
which takes a new artboardLayout.rows key: 5 artboards in 4 rows give
columns of 4 and 1. A preset keeps the rows until columns without
rows, or another layout, is given, and New Document drops them when
Columns or the layout changes.
- A held page item stays the same object when its class changes in the
same family (a placed image that is embedded becomes a RasterItem).
- A waiting class member's answer is read as a class instance, and a
class constructor called with new cannot wait.
Docs: docs/mcp.md (DocumentPreset, duplicate, file.new rows), docs/gaps.md
(G6).
Scripts get an app object with its documents, the active document and its
selection, and the page items of a document, read and edited through
commands so each edit is one undo step and is journaled. Host classes in
the JavaScript engine give each document or item one object while a script
holds it, answer `in` and indexed reads, and throw on stale objects and on
members that are not available yet.
Docs: docs/mcp.md, docs/target-app-parity.md.
A live edit changes the document without an undo step, so the tool was
not told about it. Circles found while a preview moved the second
segment stayed cached under the same segment key, and a click after the
preview was canceled drew the cached circle instead of one touching the
segment where it is again. A first segment picked during a preview kept
its old shape the same way.
The cache key now holds the shapes of the first segment and of the
segments a circle may touch, so moving along an unchanged segment still
reuses the search. The first segment is forgotten when its shape no
longer matches the document, and a press on the second segment follows
the segments as they are at the release; a pressed segment that is gone
leaves nothing to touch.
docs/target-app-parity.md gets a line for the file.write report on a
File object's length, hidden and readonly and for the test that lists
every name the script host adds, with the tests that cover them. The
test's comment on vc no longer names another app.
Setting a File object's length truncates or pads the file, and setting
readonly or hidden changes it, but script.check reported no outside
category for those assignments. It now reports file.write and
filesWritten for them: plain and compound assignment, ++ and -- before
or after, and the property name as a string literal in brackets.
A new integration test lists every global and member the script host
adds to the JavaScript engine (the own properties of the global object,
of each object or function it holds and of each function's prototype,
compared with a plain engine) and fails when one has no row. Each name
that reaches outside the document has a probe script, and the test
checks that script.check gives it the expected outside id. vc is listed
as not checked: script.check reads scripts written for the reference
app's scripting, and what vc.run does depends on the command. The test
also checks that the checker lists every preprocessor directive the
host reads, through the new DirectiveName::ALL.
File object properties:
https://extendscript.docsforadobe.dev/file-system-access/file-object/
A folder load checked each .wasm path and then opened it with a blocking
open. When a named pipe replaced the file between the two, the open held
the load until something wrote to the pipe, and with it startup or a
prefs.set of the folder. On Unix the file is now opened
without waiting and without making a terminal the controlling terminal,
and the opened file is checked again: anything that is not a regular file,
or is over the module limit, is refused and listed in the folder report.
A folder load still reads at most 1,000 .wasm files, the first by file
name, and now holds only those paths while it lists the folder. The
files past the first 1,000 were dropped and not reported; plugin.reload
and plugin.list now return their count as leftOut. An error while the
folder is listed fails the load, as an error opening the folder does,
instead of dropping the entries after it.
* refactor(cdr): depend on shared craft-cdr from craft-libs (#1665)
Replaces the local crates/cdr (vectorcraft-cdr) crate with craft-cdr
from storytold/craft-libs#2697 (storytold/craft-libs#778), keeping
VectorCraft's document/artboard/layer/shape mapping in crates/engine.
Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
* build(cdr): pin craft-cdr to craft-libs main (75d179f8df)
* build(cdr): pin craft-cdr to craft-libs main (9b28b56bc7)
* docs(cdr): point CDR/CMX provenance and test paths to craft-cdr
---------
Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
The first point followed its moved art by overwriting the stored point, so
when that art was then deleted the point stayed at the moved position
instead of where it was picked. The tool now keeps the pick separately and
falls back to it for the marker, the rubber band, Shift and the dimension.
A first anchor whose path is deleted is dropped from the point, so the
second click still places the dimension.
Plugin::load now validates each module with wasmparser and a fixed list
of WebAssembly features before wasmi reads it: mutable globals, sign
extension, saturating conversions, multi-value, bulk memory, reference
types, tail calls, extended constant expressions and floats. A module
that uses any other feature is refused, so a wasmi upgrade, a change to
its defaults or one of its crate features turned on elsewhere in the
build does not change what a plug-in may use. wasmi's Config is set to
the same list for every setter it has in this build.
The list is the set wasmi accepted before, without multi-memory. A
second memory was already refused by the one-memory limit; its error
now says "multiple memories". No module that loaded before is refused.
wasmparser 0.228.0 is the version wasmi 2.0.0 already uses.
A new test loads a plug-in that uses each listed feature and checks
that modules using SIMD, relaxed SIMD, memory64, a second memory,
custom page sizes, wide arithmetic, threads, exceptions, legacy
exceptions, function references or garbage collection are refused with
an error that names the feature.
docs/plugins.md lists the whole set; it named only four of the allowed
features before.
The mesh sentence in docs/mcp.md no longer lists the .ai writers among
the exports that draw a mesh. Both docs now say the fallback applies to
an image nested 8 deep, name the containers each writer counts (ordinary
groups and layers do not count), and say an image nested deeper is not
written. The Perspective Distort line cites the two nesting tests.
The mesh paragraph in docs/mcp.md named DXF, WMF and HP-GL as the only
exports that do not draw a distorted image as a mesh. The editing data
of a .ai file writes an image inside 8 or more nested opacity masks,
symbols, live objects and pattern tiles as the parallelogram nearest its
corners, and a legacy .ai (version 7) does so inside 8 or more nested
symbols and live objects, each with a warning. The paragraph and the
Perspective Distort line in docs/target-app-parity.md now say so.
Part of #1210.
- `cargo xtask corpus --scripts` fetches 397 scripts and 1 included file
from 19 MIT and Apache-2.0 repositories at pinned commits into
corpus/scripts, each repository's license file beside its scripts.
xtask/script-corpus.txt lists every file with its size and SHA-256; a
download replaces the previous copy only when both match. One more
candidate is listed as excluded because it is over the 1 MiB limit for
one script. The fetch caps 64 MiB of scripts and 128 MiB of transfer,
refuses `..`, absolute paths, reserved names, case-fold collisions and
links, and holds a lock file while it runs.
- `cargo xtask corpus` takes at most one of --download, --affinity and
--scripts, and refuses other arguments with the usage text.
- `cargo xtask scripts --pass-rate [--report <path>]` runs each script in
a process of its own (the ignored `row` test in
crates/engine/tests/script_corpus.rs): a new document, 5,000,000
instructions, no dialog answers, file reads only in the script's
repository folder and a new folder of its own, file writes only in that
folder, stopped after 10 seconds. It writes a JSON report with the pass
rate overall, per repository and for scripts without dialogs or
windows, how many parse, and each script's outcome, with local folders
removed from messages. Script failures never fail the command, and
without the corpus it prints a skip line and exits 0.
Since #8289 a saved .ai's editing copy keeps live the blends the .ai
reader opens with their settings and as they are drawn. The three File
formats rows in docs/target-app-parity.md still listed every live
object other than four graph types as read back as art. They now name
those blends as kept live too. Blends written as their steps stay in
the gap, and file-format-parity.md lists them.