DocState::proxy_mixed, which decides whether the Fill and Stroke proxies
show "?", walked every node of the document to find the selected
objects, even with one object selected. The Tools panel proxies, the
paint chips and the task bar ask for it on every frame whose revision
changed, which includes each frame of a drag preview, and new art asks
for it after a selection change.
Document::nodes_in_order finds every node with one of the given ids in
tree order. When the id cache holds each id once at a path that still
checks out, it reads the nodes along those paths; otherwise, and for a
selection of an eighth of the document or more, it walks the tree once,
as before. Unlike Document::index_paths it returns every node with a
repeated id, so a damaged file that repeats an id keeps the question
marks it had. proxy_mixed now gathers the selected objects through it.
Tests compare the result with a copy of the old walk for one object,
different fills and strokes, a group, a group with one of its objects,
two layers, a hidden object, Appearance items, picked gradient mesh
points beside another object, ids not in the document and a repeated id
with different paints, with the cache built and dropped, and for 200
random selections. A cost test shows that with one object selected only
that object is read and the tree is not walked. Document tests compare
nodes_in_order with a walk.
The gain shows on large documents. On 50,000 rectangles in 500 groups
on 5 layers (release build on Linux, thread CPU time, median of seven
alternating runs of both versions in one process; an ignored test,
proxy_mixed_timing, times them):
Selection old new
1 object 995 us under 5 us
2 objects, different fills 810 us under 5 us
a group of 100 875 us 5 us
all 500 groups 3,615 us 2,575 us
all 50,000 objects 4,075 us 3,470 us
Web shift and web snap now run before lossy compression again, so a pixel
is compared with the color its neighbor's entry is written as. Colors
shifted by hand are written after lossy, which still moves no pixel into
or out of them.
With transparent pixels and Colors at 256, a custom palette of one opaque color and 255 colors mapped to transparent has no room for the last of those, and its pixels took the nearest entry left, which could be the opaque color. Such pixels now take the transparent entry when their nearest color is one that did not fit.
layer.new without `top` or `below` now reads the drawing mode: in Draw
Behind the new layer goes directly below the current layer, at its level
(a sibling below a current sublayer), as the help page describes
(https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=234).
The Layers panel button, the panel menu, Ctrl/Cmd+L and the Layer
Options dialog all go through layer.new. `top` and `below` keep their
meaning in every mode, Draw Normal and Draw Inside keep a new layer
above the current one, and New Sublayer is not affected.
Common Tangents (addon.pathtools.commonTangents) now also takes a point,
a path of one anchor, together with a convex closed path. The lines run
from the point to where they touch the path: two from a point outside
it, one from a point on its outline (centered on the point and as long
as the path is wide along it, or the whole straight side the point lies
on), and none from a point inside, which leaves the document unchanged
and returns a warning. Centerline adds the line from the point to the
path's center. Every Tangents value gives the same lines; two points
are refused.
The geometry treats the point as an outline whose support value is
p . n, so the existing root search finds the lines.
Docs: docs/mcp.md, docs/target-app-parity.md, ROADMAP. The new warning
has a row in every catalog.
A call with outLeft or outRight but no outIndex set the incoming point
alone and reported success, so the outgoing widths were dropped. It is
now refused as a missing outIndex, and the document and history stay
as they are.
layer.highlight searched the highlighted rows once for every id it was
given, so a range of n rows took about n^2/2 comparisons, and the panel's
preview of the rows (apply_row_click) did the same before sending the
command. Both now keep a set of the highlighted rows beside the ordered
list. layer.highlight builds the set only for more than 8 ids, so a
one-row Ctrl/Cmd-click toggle does not pay for it.
The rows, their order, the returned rows, the current layer and the
revision are unchanged; tests compare the command with the per-id search
on 3,000 rows and the widget with it on 5,000 rows.
Each press collected every object Select All can reach into a set and then
tested only the siblings of the selected object. The siblings are now tested
one at a time against the layers and groups that hold them, with the same
rules as the walk: sublayers and the ruler guides of a layer are passed over,
and an isolated object on its own is the one there is to select. The selected
object is the same.
A random-document test compares every node and every step, isolation mode
included, with a copy of the earlier search. On 100,000 rectangles a step
took a median of 11.5 ms of thread CPU time before and 0.08 us after
(next_object_perf, release build).
Cut with direct-selected anchors or segments removed each object selected
whole, and each path it left with no segment, with its own remove. Every
removal shifted the siblings after it, so later lookups walked the
document's tree again. With 2,000 roots removed whole, the old loop
walked the tree 10,005 times.
These removals now go through the same batch that already places the
surviving pieces, which rebuilds the children of each layer or group
once, and compound paths left with no members are removed after it. A
compound path left with one member stays a compound path. The document,
the selection, the clipboard and the undo step are the same as before.
With 2,000 of 10,000 squares on one layer selected whole and two anchors
of another picked, Cut walks the tree 8 times instead of 10,005 and
takes a median of 11 ms of CPU time instead of 573 ms (release build on
Linux, seven alternating runs in one process).
The transform tool runs move, rotate, scale, reflect and shear as separate
commands. A shear angle that object.shear refuses, such as 90, a reflect
axis other than vertical or horizontal, or a scale of 0 failed only after
the earlier steps had changed the art and recorded undo steps. The tool now
checks those params first with the rules the commands use
(scale_factors, reflect_axis and shear_tangent, shared with object.scale,
object.reflect and object.shear), so a refused request changes nothing and
records no undo step.
The dialog and stroke.widthPoint.set each tested whether two width
points are the halves of one discontinuous point. The test is now one
engine function, width_point_pair: a point and the next one are the
two halves when they are the only points within 1e-6 of the first
one's place. The dialog still picks which point to test, and the
command still returns its error when the indices are not a pair.
With a fixed palette (Custom table), the colors listed in colorTable.transparent
all become the one transparent entry, so together they now take a single slot of
Colors, and the opaque colors fill the remaining slots in palette order. Before,
the palette was cut to its first entries; when those were all mapped to
transparent, every opaque pixel took one of them and the whole image turned
transparent, and with a deleted color the export was refused although an opaque
color was left past the cut. The check that a deletion leaves an opaque color
now reads the whole palette.
When no pixel is transparent and no pixel takes a color mapped to transparent,
that slot goes to the next opaque color. At 256 colors one entry stays for a
color mapped to transparent.
Session::execute asked about a command's params description several
times per command (the key check, whether `id` stands for `ids`, whether
it takes `ids`), and each question parsed the description again, with a
command lookup for each word after the first of each `…` entry. The
engine now reads every built-in description, and the ones its `…`
entries name, once into a table keyed by the description's address and
length, and answers accepted_keys, takes_key, id_stands_for_ids and
check_keys from it.
A plug-in command's description, and a built-in description whose `…`
entries name a plug-in command, are still parsed where they are used,
since plug-ins change while the app runs. The keys, answers and error
messages are the same; tests::params_cache compares them for every
built-in command against a fresh parse.
In a release build on a one-object document, object.move with ids and
dx takes 48 us of thread CPU time per command instead of 61 us, and
select.set with ids 2.3 us instead of 3.2 us (medians of 7 alternating
runs of 20,000 commands in one process, while other builds were running;
tests::params_cache::bench_params_keys_once). The time is saved per
command, in scripts, batches and MCP or plug-in call loops, and does not
grow with the size of the document.
The tangent of 180 degrees in radians is about 1e-16, not 0, so a shear
by 180 or -180 moved coordinates very slightly and recorded an undo
step. Angles within 1e-9 degrees of 0, 180 or -180 now shear by 0:
without `copy`, nothing moves and no undo step is recorded.
Docs: params text, docs/mcp.md.
With Adjust Adjoining on, the outgoing half of a discontinuous point
looked for the point after it as the first one farther than 1e-6 from
its own place, so a point within 1e-6 of the outgoing half but not of
the pair's place was skipped. Both halves now measure from the pair's
place.
The Blend panel, the Object › Blend, Envelope Distort and Gradient Mesh
menu items and their commands looked up every ancestor of each selected
object by id to find its nearest blend, envelope or mesh, and dropped
repeats with a linear scan. They now read the object's cached place in
the tree once, test the nodes on that path, and keep a set of the ones
already listed. The checks of whether one is selected stop at the first
selected object that has one. An id that the lookup cache does not
place on that path (a repeated id, or a cache older than the tree) is
still looked up by id, so the results, their order and the errors are
the same. Explicit ids given to the live commands drop nested ones with
a set as well.
With Select All of 102,200 objects (100,000 rectangles, 2,000 blends and
200 envelopes), a release build took a median of 16.5 ms of thread CPU
time for the Blend check before and 0.5 ms after.
object.shear clamped its angle to -89..89 without an error, so any angle
past 89 sheared by 89. It now takes the Shear dialog's documented range
of -359 to 359 degrees and shears by the angle's tangent, so 120 slants
as -60. An angle outside that range, and +-90 and +-270 (within 1e-9
degrees), where the tangent is unbounded, return an error naming
`angle`; nothing moves and no undo step is recorded.
Docs: params text, docs/mcp.md, docs/target-app-parity.md.
Opening Width Point Edit on either half of a discontinuous width point
now shows the Incoming and Outgoing side widths, each with Side 1,
Side 2, Total Width and its own link. OK sets both halves in one
stroke.widthPoint.set and one undo step, and Delete removes both.
Single Width Only keeps the incoming or the outgoing widths as one
continuous point. A continuous point keeps the one-set layout.
stroke.widthPoint.set takes outIndex, outLeft, outRight and single for
this. With adjustAdjoining, the nearest point before follows the
incoming change and the nearest point after follows the outgoing
change, once each. Indices that are not the two halves of one
discontinuous point, another t, or another single value are refused
without changing the document or its history.
Help page: https://helpx.adobe.com/illustrator/using/stroke-object.html
describes editing the widths on each side of a discontinuous point in
this dialog. The group labels, the adjoining rule and Delete removing
both halves are VectorCraft's own.
With a sublayer isolated, Exit Isolation Mode now isolates its parent layer
and selects the sublayer, so repeated use goes up one layer at a time and
leaves isolation mode from the top-level layer, as the help page describes:
https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html
This applies to the Layers panel menu item, the isolation bar's back arrow,
the Control bar button, the canvas context menu, a double-click outside the
art and object.exitIsolation {}. Before, each of them left isolation mode in
one step.
- object.exitIsolation takes all (default false); all: true leaves
isolation mode from a sublayer at any depth. Any other value is an error.
- Esc and the top-level layer's crumb on the isolation bar pass all: true,
so they still leave in one step. A sublayer's crumb isolates that
sublayer.
- A hidden or locked parent layer is not isolated; the call leaves
isolation mode. A step up records no undo step. Groups keep their rule.
Lossy compression compared each pixel with the reduction's colors, so a pixel next to a color shifted by hand could join that color and be written in its new color, and a pixel of the shifted color could leave it. Lossy now leaves the entries of shifted colors alone, as it does the transparent entry.
New type started in [Normal Character Style]'s fill only and always used the
default font and size. It now takes the style's font, style, size and other
character attributes too, so redefining that style in a New Document profile
sets the default font of the profile's documents. A font, style, size or
color given to text.create still wins.
Part of #8350
Double-clicking an opaque GIF or PNG-8 color-table swatch opens the
Color Picker. Its OK writes that color as the color picked wherever it
appears in the image; Cancel changes nothing. A shifted swatch shows the
original color at its upper left and the new one at its lower right,
with the lock mark. Double-clicking it opens the picker on the original
color, and OK on it takes the shift away. Unshift All Colors in the
table's menu clears shifts and web shifts.
- colorTable.shifted {"#source": "#rrggbb"} carries the shifts by
source color, in the settings, the remembered settings and presets.
A shifted color is kept when reducing, before locked colors, and wins
over Web Shift, Web Snap and Lock; a color mapped to transparent stays
transparent. Bad colors, duplicate keys and more than 256 entries are
refused. The preview marks shifted colors.
- GIF lossy compression compares pixels with the reduction's colors
before the table's edits, so a shifted or web-shifted color does not
take in the pixels of a nearby color.
- Web Shift replaces a shift by hand, Lock stays on for a shifted color,
and Delete Color drops a deleted color's shift.
Docs: docs/mcp.md, docs/target-app-parity.md.
find_command searched the list of about 1,000 built-in command specs in
order on every call, and a top-level command looks its id up at least
three times before it runs. It now finds a built-in in a map from id to
spec that is made on the first call. When an id is listed twice, the
map keeps the first spec, which is the one the search returned. An id
that is not a built-in still goes to the installed plug-ins' commands
at the time of the call, so installing or removing a plug-in shows at
once and built-ins keep precedence.
A scatter brush takes a Hue Jitter amount from 0 to 180 degrees (0 by
default). Each copy turns the hue of its solid fills and strokes, type
included, by its own amount up to that far either way, after the
colorization. The amounts come from the stroke's path and the brush
name, so a stroke draws the same colors on every redraw, after Save and
Open, and in export. Copies keep their places, sizes and rotations.
A color turns in its own model (RGB in the HSB of its values, CMYK over
C, M and Y with K kept, Lab by turning a and b). White, black and grays
stay as they are, and a symbol instance in the art turns only its stain.
A brush at 0 draws its copies in the colors the colorization gives them
and saves no hue_jitter key; a brush without the key reads as 0.
- brush.options takes hue_jitter, and brush.get shows it for every
scatter brush. Brush Options shows a Hue Jitter field (ui.brushOptions
field hueJitter) with rows in every catalog.
- The .ai editing data writer does not write the amount, so a jittered
brush is left out of the Brushes panel there and reported, as other
brushes that would open with other settings are.
Docs: docs/mcp.md, docs/target-app-parity.md.
When a New Document profile's Default Graphic Style differs from the shipped
one (white fill, 1 pt black stroke), file.new resets new art in documents
from that profile to the style's fills, strokes and effects, not linked to
the style. Default Fill and Stroke (paint.default, D) gives the defaults and
the selected art the same look in those documents; type still gets a black
fill and no stroke. A profile with the shipped style leaves the current fill
and stroke as they were.
Part of #8350
Running Locate Object or Locate Layer again on the row it already
highlighted wrote the same highlight, so the Layers panel did not open
the layers around the row or scroll to it: a sublayer whose layer was
closed since stayed hidden. layer.locate now leaves a one-time request
on the document (DocState::locate_reveal) that the panel takes on its
next frame, opening the layers around the located row and scrolling to
it whether or not the highlight changed. The request is not saved and
adds no undo step, and the panel drops it when the row is no longer
highlighted.
The Circle tool, in the Ellipse tool's flyout, draws a circle with
shape.circleThroughPoints. A drag from one point to another, or a click
on each, draws the circle with the two points as the ends of a diameter.
A click on a first point, then a press on a second point dragged to a
third, draws the circle through the three. Shift keeps the second point
at 45° steps from the first. For a circle on two points, Alt rounds the
diameter to the nearest ruler tick at the current zoom in the General
unit. Each point snaps to Smart Guides. Until the release the tool shows
the circle as a dashed outline (solid once it is more than 50,000 screen
points around), a cross at its center, a line from the center to each
point and, with Measurement Labels on, the diameter by the pointer.
Three different points on one line, or a circle past the canvas, show
"Circle too large" by the pointer instead, and the release draws
nothing. Escape, a dropped press, and an edit, Undo or Redo made outside
the tool drop the first point. A second press within 3 screen points of
the first point, or one that snaps to it, places nothing when let go
there, and draws the circle on the diameter it drags out when dragged.
Each circle is one undo step. The tool's icon is new and drawn for
VectorCraft.
shape.circleThroughPoints also takes two points, or two selected anchor
points, as the ends of a diameter. Its two errors about the number of
points now say "two or three", in every catalog that translates them.
Part of #7178.
Making a new symbol from the selected art with Shift held now adds the
symbol and leaves the art as ordinary art, as the Create a symbol section
of the help page describes
(https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=192).
Without Shift the art still becomes an instance.
- symbol.new takes keepArt (default false). With true the art keeps its
ids, layer and stacking position and stays selected, apart from art
that cannot be selected, frames of threaded text stay in their
thread, and the result's id is null. A keepArt that is not true or
false is an error.
- The Symbols panel's New Symbol button and its New Symbol... menu item
read Shift when clicked and carry it through Symbol Options' OK;
Shift with Alt on the button makes the symbol at once and keeps the
art. Art dragged onto the panel reads Shift as it is released.
- ui.symbolOptions takes keepArt for a new symbol and refuses it when
editing a symbol.
Docs: docs/mcp.md, docs/target-app-parity.md.
DXF export with Use Artboards baked the whole document's live effects
and placed symbol art again for every artboard. export_drawings now
checks the options and every region, bakes once, and writes each
drawing from the same baked document. export calls it with one drawing,
and the encoder makes one call for all the chosen artboards. Each
drawing's bytes, linked images, warnings and setting notes are the same
as before; the tests compare them with drawings baked one at a time.