Scripts get the global UnitValue constructor: a number with one of the
length units (inches, feet, yards, miles, millimeters, centimeters,
meters, kilometers, points, picas, traditional points and picas,
ciceros), pixels or percent. as() and convert() give or change the
unit, baseUnit sets what one pixel and 100% measure, and the arithmetic,
comparison and unary operators calculate with the object's number. With
two objects the right one is converted to the left one's unit.
Conversions go through exact ratios to the inch, so 1 in is exactly
72 pt. An unknown unit or text makes an invalid object; converting it or
using it with an operator, a result that is not finite and a comparison
with a number that is not finite throw a RangeError.
A realm without UnitValue keeps the standard operators. docs/mcp.md
describes the class.
File › Open with a PSD or PSB file's layers as objects now reads the
nvrt, thrs and post blocks of the PSD file format specification and
merges each such adjustment layer with the visible layers below it in
its group, changing their colors. Clipped to a layer, it changes only
that layer and the layers clipped to it. In a pass-through group with
nothing below it in the group, it changes what is below the group when
the group is merged.
Each channel is taken as an 8-bit sRGB value: Invert turns v into
255 - v, Threshold compares the Rec. 709 luminance with its level, and
Posterize maps each channel to the nearest of its evenly spaced levels.
The adjusted color is composited in the layer's blend mode at its
opacity and fill opacity, through its layer mask.
A hidden one is left out. One that layers are clipped to, one clipped
to another adjustment layer, one whose data can't be read and one
whose merge needs more memory than allowed are not applied and are
counted in the existing adjustment-layer warning. Other adjustment
kinds are still not applied.
Docs: docs/mcp.md, docs/target-app-parity.md.
A dimension of a whole path whose line lay across the path, made vertical
or horizontal with dimension.update, now goes as far past the path as it
lay from its first point. Before, its line landed on the path's edge. A
line on the edge to within rounding still counts as outside the path.
When the new place would be more than 1,000,000 pt from the first point,
the update is an error unless it also gives offset, and the dimension is
left as it was. A dimension whose measured node is missing or is not a
path, as in a file that names a node it does not hold, is unlinked at the
next edit.
Tests: a dimension of a whole path saved in a native file and opened
again still follows the path, and one that names a missing node is
unlinked at the next edit; past a corner of the path the side the
pointer is farther out on decides; after the first point Alt picks a
point; a hovered segment's length stays by the pointer at a high zoom.
The line in docs/target-app-parity.md now attributes only the Alt hover
over a path to the linear dimensions help page. Docs: docs/dimensions.md
and dimension.update's params text.
A press on one part of a dimension now also checks its other parts for
a geometry effect, so an effect on an extension line keeps the drag
from moving the dimension (and from drawing the parts again without
the effect). In isolation mode, only art inside the isolated object is
compared with the dimension when the press decides between them.
With the Linear Dimension tool and Alt (Option on macOS) held, hovering a
path shows a box through its outermost points (a Smart Guide when Smart
Guides are on), with its width and height beside the pointer when
Measurement Labels are on. A click on the path, then a placing click, or a
drag out from it, places a dimension of the whole path. With the pointer
above or below the path it measures the width, between the leftmost and
rightmost points; beside the path it measures the height, between the
topmost and bottommost points. The linear dimensions help page describes
the Alt hover; which side gives which measure is VectorCraft's own rule.
dimension.create takes a new source, {kind: extent, node}, for linear
dimensions. Its points are the outermost points of the segments the path
draws, curves included, and are read again whenever the path changes, so a
turned path shows its new overall width or height. The line keeps its
distance from the whole path when the path changes or is reflected, and
when dimension.update changes the orientation, which now reads the other
pair of points. When the box through the path's outermost points stays
where it was, as after Reverse Path Direction, the line stays on its side.
A version without the extent source does not open a file that holds one.
The measurement label beside the pointer while two points are picked now
keeps its distance in screen pixels at any zoom.
The Help Bar hint names Alt+Click. Docs: docs/dimensions.md and
docs/target-app-parity.md.
A module may carry its manifest in a `vc_manifest` custom section, with
`"abi": 1` in place of the `vc_abi_version` export. When it does,
Plugin::load parses the manifest from the section and does not
instantiate the module: its start function, data segments,
`vc_abi_version` and `vc_manifest` do not run when it is inspected,
installed or loaded at startup. The host checks the imports against the
manifest's permissions, the exports `memory`, `vc_alloc` and `vc_run`
by type, and the initial memory and the tables against the limits a run
has (at most 4 tables of 100,000 elements). A module with more than one
such section is refused, and so is a section over 64 KiB, before its
contents are decoded, and a manifest in the section without `"abi": 1`.
The host uses the section and does not call a `vc_manifest` export.
Modules without the section load as before.
The Desaturate example carries the section and keeps the export, and
its fixture is rebuilt with Rust 1.100.0. build.sh clears RUSTFLAGS:
.cargo/config.toml sets `+simd128` for wasm32, and the host refuses
SIMD instructions. wat::sectioned builds test plug-ins with the section.
The settings and cache imports could move up to 1 GiB a run while the
instruction budget charged only for the calls themselves. The bytes they
read or write now cost the run one instruction per 64 bytes, counted
over the whole run so that splitting a transfer into calls costs the
same. A get also pays for the bytes it copies into the module's memory
that the store didn't count, such as a setting answered from memory.
A storage call pays from the store's fuel and from the part of the
budget not yet handed out. The meter it gives the storage holds no more
bytes than those instructions pay for, so a read or write the run can't
pay for doesn't happen, and the run ends with "instruction budget". A
read or write past the 1 GiB still returns -7. Bytes beyond the current
slice are read or written only before the deadline and Cancel, and the
host checks the deadline and Cancel after every storage call, so a run
past either stops after the call instead of at the next slice.
The plug-in fuzz test now also makes writes of up to about 1 MiB on
small instruction budgets.
Docs: docs/plugins.md.
A group or layer whose raster effects are not all shadows and outer
glows (a blur, feather or inner glow) becomes one image of what it
draws, and the groups and layers in it make no images of their own. The
Safe Mode plug-in check still looked into every group with a raster
effect inside it, so a hidden blurred group there holding a plain symbol
instance with a plug-in effect in its art stopped the expansion. The
check now stops at such a group. Under shadows and outer glows the
members still expand on their own, so their groups are still checked.
The image a group's or layer's raster effect makes is drawn with
templates skipped, so it leaves out template layers, guides and ruler
guides with everything in them. The Safe Mode plug-in check still looked
into a template sublayer, so a plain symbol instance there whose symbol
art holds a plug-in effect stopped Expand Appearance of the layer. The
check now skips them as the renderer does.
The image a group's or layer's raster effect makes leaves out hidden
objects and everything in them, as the renderer does. The Safe Mode
plug-in check looked into every object of such a group, so a hidden
plain symbol instance whose symbol art holds a plug-in effect stopped
Expand Appearance of the group. The check now skips hidden objects
inside the group's image. The group itself still counts when it, or a
group around it, is hidden, since expansion still makes its image.
With no points or lines picked, a press within 8 pixels of what a
visible, unlocked dimension draws (its lines, arrowheads and label),
where it is the topmost object that can be edited, followed by a drag
moves that dimension as one undo step. A segment of the art as near
the press as the dimension's lines and label, or nearer, takes the
press instead, and a click there without a drag still picks a point.
The part grabbed follows the pointer: a linear dimension's line moves
as far across as the pointer moves, an angular arc moves as far as the
pointer moves away from or toward the vertex, and a radius or diameter
line turns about the center as the pointer turns, or toward the
pointer when grabbed at the center. The dimension keeps what it
measures and its link to the art. With Smart Guides on, a linear
dimension's line lands on the level of a parallel dimension line, as
when it is placed, and of two lines on one level the one nearer the
pointer along it wins. Isolation mode, clipping masks and locked artboards
apply as they do to a click; with a part of a dimension isolated, the
dimension is not dragged. A dimension that a geometry effect on it, on
one of its parts or on a group around it draws elsewhere is not
dragged, except in Outline view and on a layer whose Preview is off.
dimension.update takes `at: [x,y]`, which puts a linear dimension's
line through the point, gives an angular arc a radius of the point's
distance from the vertex (at least 12 pt), or turns a radius or
diameter line toward it. With Real-time Drawing off, a dimension.update
preview that names its dimensions outlines only those dimensions.
A dimension pasted into a document that had none now marks the
document as holding dimensions (Document::insert), so the Dimension
tool drags it like one drawn there and edits refresh it. Opening a
native file sets the flag from the objects it holds, which covers files
saved after such a paste.
Docs: docs/dimensions.md, docs/target-app-parity.md.
A linear dimension line placed near another dimension's line lands on its
level only when that line is parallel. Before, the check compared the two
directions only, so a long line at a slight angle passed it: with its first
end within the snapping tolerance, the new line landed on a level the other
line had already left, and the guide ran at an angle between the lines. A
line is now parallel when it moves off its level by no more than 0.000001 pt
across the span of both lines.
A level that would put the line more than 1,000,000 pt from its points is
passed over. Before, the tool took it, the preview failed validation and
was not sent, and a click committed the earlier preview position. The next
level within reach is taken instead, or the line goes where the pointer is.
The level guide also needs Smart Guides on when it is drawn, so turning
Smart Guides off before the next pointer move hides it.
The nonparallel case in the placement test now puts the pointer within
reach of the first line's end, so it fails without the parallel check, and
the guide test expects exactly one guide.
colored_revolve_faces_leave_no_alpha_holes_at_one_to_one compared each
representation only with its own 3x render, so a 60% opacity lost or
applied twice by SVG or PDF import passed at both scales. The test now
also reads the alpha inside the body: 153 within 3 levels with a fill
opacity of 60%, 214 within 3 levels with 60% gradient stops (front and
back faces at 60% each), and 255 when opaque.
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/
* 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>
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.
A plain symbol instance does not expand on its own, so the Safe Mode
plug-in check skipped its symbol's art. When a group or layer around the
instance has a raster effect (its own, or on one of its fills or
strokes), the group's image draws that art, plug-in effect included, and
Expand Appearance committed pixels without the plug-in effect instead of
returning the Safe Mode error. The check now looks into every object of
such a group or layer, symbol art included.
Show the native point marker at the existing cut target, respecting consumer endpoint eligibility/canonicalization and current snapping/selection. Keep cut commands unchanged.
Closes#8655.
A handle drag kept the Alt and Cmd/Ctrl state it had before Space was
pressed, so pressing Alt or releasing Cmd/Ctrl during a Space translation
changed nothing until Space was released and the pointer moved. Both
modifiers are now read on every drag event. The Space translation still
keeps the accepted handle position.
The handle drag that keeps Space translation sent path.setHandle without
`symmetric`, so Cmd/Ctrl no longer mirrored the opposite handle on an
ordinary path. The drag now records the mirror with the handle it accepts
and sends it on every preview, so the opposite handle stays mirrored while
Space moves the anchor. Alt still takes priority.