mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-02 20:18:38 -05:00
Merge pull request #9048 from dotCooCoo/feat/scripts-api-d3-layers-artboards
Scripts: documents give scripts their layers, groups, compound paths and artboards
This commit is contained in:
21 files changed
+3507
-100
No files matched your search
@@ -234,7 +234,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Clear",
|
||||
["Edit"],
|
||||
Some("Delete"),
|
||||
"{ids?, guides?: bool (with ids: also delete the selected ruler guides), keepJoined?: bool (without ids: the direct-selected anchors of a path with no selected segment are removed as path.removeAnchors removes them, without opening the path, and the next anchor along is selected (the one before at an open path's end); default: prefs deleteKeepsPathsJoined), keepEmpty?: bool (keep a compound path left with no members)} delete the objects `ids`, else the selection (fully selected objects and direct-selected anchors together, else ruler guides; a compound-path member selected on its own is deleted alone, and a compound left with no members goes too unless keepEmpty); without ids, refused while an object of a symbol instance's art is selected",
|
||||
"{ids?, guides?: bool (with ids: also delete the selected ruler guides), keepJoined?: bool (without ids: the direct-selected anchors of a path with no selected segment are removed as path.removeAnchors removes them, without opening the path, and the next anchor along is selected (the one before at an open path's end); default: prefs deleteKeepsPathsJoined), keepEmpty?: bool (keep a compound path left with no members)} delete the objects `ids`, else the selection (fully selected objects and direct-selected anchors together, else ruler guides; a compound-path member selected on its own is deleted alone, and a compound left with no members goes too unless keepEmpty); a clipping group or layer left without art releases its mask in the same undo step; without ids, refused while an object of a symbol instance's art is selected",
|
||||
has_selection_or_guides,
|
||||
clear
|
||||
),
|
||||
@@ -1312,6 +1312,20 @@ fn cut_direct_selection(s: &mut Session, roots: &[NodeId]) -> Result<Value> {
|
||||
ok()
|
||||
}
|
||||
|
||||
pub(super) fn clipped_ancestors(d: &Document, ids: impl IntoIterator<Item = NodeId>) -> BTreeSet<NodeId> {
|
||||
ids.into_iter().flat_map(|id| d.ancestry(id).unwrap_or_default()).filter(|id| d.node(*id).is_some_and(Node::clips)).collect()
|
||||
}
|
||||
|
||||
pub(super) fn release_empty_clips(d: &mut Document, ids: BTreeSet<NodeId>) {
|
||||
for id in ids {
|
||||
if let Some(n) = d.node_mut(id)
|
||||
&& n.children().is_some_and(|c| c.iter().all(|n| n.is_ruler_guide()))
|
||||
{
|
||||
n.set_clips(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn clear(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let guides = switch_or(p, "guides", false, "edit.clear")?;
|
||||
let keep_empty = switch_or(p, "keepEmpty", false, "edit.clear")?;
|
||||
@@ -1348,6 +1362,7 @@ fn clear(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
return ok();
|
||||
}
|
||||
s.edit("Clear", |d, sel| {
|
||||
let clipped = clipped_ancestors(d, ids.iter().copied());
|
||||
let parents: Vec<_> = if keep_empty {
|
||||
Vec::new()
|
||||
} else {
|
||||
@@ -1363,6 +1378,7 @@ fn clear(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let gone = sel.guides.clone();
|
||||
d.retain_guides(sel, |g| !g.id.is_some_and(|id| gone.contains(&id)));
|
||||
}
|
||||
release_empty_clips(d, clipped);
|
||||
if is_explicit {
|
||||
sel.remove_all(ids.iter().copied());
|
||||
sel.prune(d);
|
||||
|
||||
@@ -129,7 +129,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Reorder",
|
||||
[],
|
||||
None,
|
||||
"{id, parent?: id (null = top level), index} put a row at `index` (0 = bottom) of `parent` (layers only at the top level or in layers; an Intertwine group takes and gives up members as layer.move does), deselecting every selected object left hidden or locked (the key object too); a Live Paint group or its paths take a row as layer.move does",
|
||||
"{id, parent?: id (null = top level), index} put a row at `index` (0 = bottom) of `parent` (layers only at the top level or in layers; a path other than a clip group's or clipping layer's clipping path also goes into a shown, unlocked compound path and gives up its own paint (the compound path becomes pixel-aligned when the path or the compound path it leaves was), and an empty compound path takes the paint the first path that goes in was drawn with; a path that leaves a compound path for a layer or a group takes its paint and pixel alignment; an Intertwine group takes and gives up members as layer.move does), deselecting every selected object left hidden or locked (the key object too); a Live Paint group or its paths take a row as layer.move does",
|
||||
has_doc,
|
||||
move_node
|
||||
),
|
||||
@@ -1001,9 +1001,32 @@ fn move_node(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let index = p.get("index").and_then(Value::as_u64).map_or(usize::MAX, index);
|
||||
let d = &s.doc()?.doc;
|
||||
let n = d.node(id).ok_or(EngineError::NoNode(id))?;
|
||||
if !accepts(d, parent, n) {
|
||||
let compound = parent.and_then(|p| d.node(p)).filter(|p| matches!(p.kind, NodeKind::Compound { .. }));
|
||||
if let Some(c) = compound {
|
||||
if !matches!(n.kind, NodeKind::Path { guide: false, .. }) {
|
||||
return Err(bad(C, "a compound path holds only paths"));
|
||||
}
|
||||
// A clip group's or clipping layer's clipping path stays where it is: without it, the
|
||||
// next object up would become the clipping path.
|
||||
if d.position(id).is_some_and(|(from, i, _)| i == 0 && from.and_then(|f| d.node(f)).is_some_and(Node::clips)) {
|
||||
return Err(bad(C, "a clipping path does not go into a compound path; release the clipping mask first"));
|
||||
}
|
||||
if !d.is_editable(c.id) {
|
||||
return Err(bad(C, "the compound path is hidden or locked"));
|
||||
}
|
||||
} else if !accepts(d, parent, n) {
|
||||
return Err(bad(C, "layers go only at the top level or in layers, objects in layers and groups"));
|
||||
}
|
||||
// An empty compound path takes the paint of the first path that goes into it: the path's own,
|
||||
// or the paint of the compound path it leaves, which is what painted it.
|
||||
let from_compound = d.parent_of(id).and_then(|p| d.node(p)).filter(|p| matches!(p.kind, NodeKind::Compound { .. }));
|
||||
let shown = from_compound.map_or(&n.appearance, |p| &p.appearance);
|
||||
let paint = compound.filter(|c| c.children().is_some_and(Vec::is_empty)).map(|c| (c.id, shown.clone()));
|
||||
let into = compound.map(|c| c.id);
|
||||
let from_aligned = from_compound.is_some_and(|c| c.extras().pixel_aligned);
|
||||
// A path that leaves a compound path for a layer or a group takes the compound path's paint and
|
||||
// pixel alignment, as Release Compound Path gives them to its paths.
|
||||
let out_of = from_compound.filter(|_| compound.is_none()).map(|c| (c.appearance.clone(), c.extras().pixel_aligned));
|
||||
if let Some(what) = super::intertwine::refused_in(d, parent, n) {
|
||||
return Err(bad(C, format!("{what} can't be intertwined")));
|
||||
}
|
||||
@@ -1013,6 +1036,36 @@ fn move_node(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let left = super::intertwine::groups_of(d, &[id]);
|
||||
s.edit(label, |d, sel| {
|
||||
d.move_node(id, parent, index)?;
|
||||
if let Some((c, appearance)) = paint
|
||||
&& let Some(n) = d.node_mut(c)
|
||||
{
|
||||
n.appearance = appearance;
|
||||
}
|
||||
// A path in a compound path keeps no paint, live shape or pixel alignment of its own, as
|
||||
// Make Compound Path leaves its paths; the compound path becomes pixel-aligned instead when
|
||||
// the path was, or when the compound path it leaves was.
|
||||
if let Some(c) = into {
|
||||
let mut aligned = from_aligned;
|
||||
if let Some(m) = d.node_mut(id) {
|
||||
m.appearance = vectorcraft_doc::Appearance::default().into();
|
||||
aligned |= std::mem::take(&mut m.extras_mut().pixel_aligned);
|
||||
if let NodeKind::Path { live, .. } = &mut m.kind {
|
||||
*live = None;
|
||||
}
|
||||
}
|
||||
if aligned && let Some(cn) = d.node_mut(c) {
|
||||
cn.extras_mut().pixel_aligned = true;
|
||||
super::object::snap_if_aligned(cn);
|
||||
}
|
||||
}
|
||||
if let Some((appearance, aligned)) = out_of
|
||||
&& let Some(m) = d.node_mut(id)
|
||||
{
|
||||
m.appearance = appearance;
|
||||
if aligned {
|
||||
m.extras_mut().pixel_aligned = true;
|
||||
}
|
||||
}
|
||||
super::intertwine::settle_members(d, &[(id, from)], &left)?;
|
||||
live_paint.finish(d, sel, &[id])?;
|
||||
sel.prune(d);
|
||||
|
||||
@@ -105,6 +105,49 @@ pub(super) fn group(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
Ok(json!({ "id": gid.0 }))
|
||||
}
|
||||
|
||||
/// `object.newGroup`: an empty group, or with `compound` an empty compound path, in a layer or a
|
||||
/// group (default: the current layer), on top of its contents or at `index` (0 = bottom). The
|
||||
/// selection stays as it is.
|
||||
pub(super) fn new_group(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const C: &str = "object.newGroup";
|
||||
// Only an omitted key takes its default; `null` is refused like any other bad value.
|
||||
let compound = match p.get("compound") {
|
||||
None => false,
|
||||
Some(v) => v.as_bool().ok_or_else(|| bad(C, "compound must be true or false"))?,
|
||||
};
|
||||
let st = s.doc()?;
|
||||
let parent = match p.get("parent") {
|
||||
None => st.current_layer().or_else(|| st.doc.default_layer()).ok_or_else(|| bad(C, "the document has no layer"))?,
|
||||
Some(v) => NodeId(v.as_u64().ok_or_else(|| bad(C, "parent must be a layer or group id"))?),
|
||||
};
|
||||
let index = match p.get("index") {
|
||||
None => usize::MAX,
|
||||
Some(v) => v.as_u64().and_then(|i| usize::try_from(i).ok()).ok_or_else(|| bad(C, "index must be a whole number"))?,
|
||||
};
|
||||
let d = &st.doc;
|
||||
let Some(n) = d.node(parent) else { return Err(bad(C, format!("no layer or group {}", parent.0))) };
|
||||
if !matches!(n.kind, NodeKind::Layer { .. } | NodeKind::Group { .. }) || n.extras().graph.is_some() {
|
||||
return Err(bad(C, format!("{} is not a layer or group", parent.0)));
|
||||
}
|
||||
if !d.is_editable(parent) {
|
||||
return Err(bad(C, "the layer or group is hidden or locked"));
|
||||
}
|
||||
let label = if compound { "Compound Path" } else { "Group" };
|
||||
let gid = s.edit(label, |d, _| {
|
||||
let gid = d.alloc_id();
|
||||
let clips = d.node(parent).is_some_and(Node::clips);
|
||||
let index = if clips { index.max(1) } else { index };
|
||||
let node = if compound {
|
||||
Node::new(gid, NodeKind::Compound { children: Vec::new(), rule: vectorcraft_geom::FillRule::NonZero })
|
||||
} else {
|
||||
Node::group(gid, Vec::new())
|
||||
};
|
||||
d.insert(Some(parent), index, node)?;
|
||||
Ok(gid)
|
||||
})?;
|
||||
Ok(json!({ "id": gid.0 }))
|
||||
}
|
||||
|
||||
/// Put `ids` (top-level objects, in paint order) in a new group where the front-most one was.
|
||||
pub(crate) fn group_nodes(d: &mut Document, ids: &[NodeId]) -> Result<NodeId> {
|
||||
if ids.is_empty() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::align::{align, can_distribute, distribute, distribute_spacing};
|
||||
use super::arrange::{Arrange, arrange, exit_isolation, group, hide, isolate, lock, send_to_current_layer, show_all, ungroup, unlock_all};
|
||||
use super::arrange::{Arrange, arrange, exit_isolation, group, hide, isolate, lock, new_group, send_to_current_layer, show_all, ungroup, unlock_all};
|
||||
use super::bounds::set_bounds;
|
||||
use super::compound::{clip_edit, clip_make, clip_release, compound_make, compound_release};
|
||||
use super::pixelgrid::set_pixel_aligned;
|
||||
@@ -137,6 +137,15 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
has_selection,
|
||||
group
|
||||
),
|
||||
cmd!(
|
||||
"object.newGroup",
|
||||
"Group",
|
||||
[],
|
||||
None,
|
||||
"{parent?: layer or group id (default: the current layer), index?: n (0 = bottom, or directly above the clipping path in a clipping layer or group; default: on top), compound?: bool (default false; true: an empty compound path instead of a group)} → {id}: an empty group or compound path in a shown, unlocked layer or group; an omitted key takes its default; null is refused for parent, index and compound; the selection stays as it is",
|
||||
has_doc,
|
||||
new_group
|
||||
),
|
||||
cmd!(
|
||||
"object.ungroup",
|
||||
"Ungroup",
|
||||
|
||||
@@ -1921,6 +1921,7 @@ pub(crate) fn delete_anchors_joined(s: &mut Session, p: &Value, keep_joined: boo
|
||||
.copied()
|
||||
.filter(|id| !d.ancestry(*id).unwrap_or_default().iter().rev().skip(1).any(|ancestor| targets.contains(ancestor)))
|
||||
.collect();
|
||||
let clipped = super::edit::clipped_ancestors(d, whole_ids.iter().chain(sel.keys()).chain(segments.keys()).copied());
|
||||
// The compound paths that hold a deleted object; one left with no members goes too, unless `keepEmpty`.
|
||||
let compounds: BTreeSet<NodeId> = if keep_empty {
|
||||
BTreeSet::new()
|
||||
@@ -2002,6 +2003,7 @@ pub(crate) fn delete_anchors_joined(s: &mut Session, p: &Value, keep_joined: boo
|
||||
d.remove(p)?;
|
||||
}
|
||||
}
|
||||
super::edit::release_empty_clips(d, clipped);
|
||||
selection.set(survivors);
|
||||
for (id, next) in following {
|
||||
if !next.is_empty() {
|
||||
|
||||
@@ -346,6 +346,7 @@ pub(super) const ALLOWED: &[&str] = &[
|
||||
"object.mesh.movePoints",
|
||||
"object.mesh.setPointColor",
|
||||
"object.move",
|
||||
"object.newGroup",
|
||||
"object.nudge",
|
||||
"object.objectsOnPath.attach",
|
||||
"object.objectsOnPath.detach",
|
||||
|
||||
@@ -253,7 +253,17 @@ fn do_script(h: &Host, a: &[Data]) -> std::result::Result<Data, HostError> {
|
||||
h.charge_call(16 + s.id.len() as u64 + s.bytes)?;
|
||||
// Saved steps run as they run in the Actions panel: keys their commands no longer read are
|
||||
// passed over.
|
||||
let start = Start { active: &h.active_artboards, picks: h.artboard_picks.as_ref(), batch: s.artboard };
|
||||
// A document whose active artboard the script chose uses that choice, not the one the run
|
||||
// started with.
|
||||
let chosen = h.session.borrow().active().and_then(|st| {
|
||||
h.dom.chosen_artboards.borrow().iter().find(|(uid, reverts)| *uid == st.uid && *reverts == st.reverts)?;
|
||||
Some((st.uid, super::dom::active_artboard(st)))
|
||||
});
|
||||
let active = match &chosen {
|
||||
Some(chosen) => std::slice::from_ref(chosen),
|
||||
None => h.active_artboards.as_slice(),
|
||||
};
|
||||
let start = Start { active, picks: h.artboard_picks.as_ref(), batch: s.artboard };
|
||||
let params = on_active_artboard(&h.session.borrow(), &start, &s.id, &s.params);
|
||||
let outer = h.session.borrow_mut().set_replaying(true);
|
||||
let r = command(h, &s.id, ¶ms);
|
||||
|
||||
+103
-56
@@ -18,7 +18,8 @@
|
||||
//!
|
||||
//! Collections are counted from 0, and `pageItems` lists art topmost first, as
|
||||
//! <https://ai-scripting.docsforadobe.dev/jsobjref/CMYKColor/> reads the frontmost path as
|
||||
//! `pathItems[0]`. A collection read with a name, `pageItems["name"]`, gives the object `getByName`
|
||||
//! `pathItems[0]`; the `layers` module gives the order of a layer's, a group's and a compound
|
||||
//! path's lists. A collection read with a name, `pageItems["name"]`, gives the object `getByName`
|
||||
//! gives, and a script may name the application's members without `app.`, as
|
||||
//! <https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/> describes; here
|
||||
//! that holds for `activeDocument`, `documents` and `selection`. `documents[0]` is the active
|
||||
@@ -99,6 +100,7 @@ use crate::{DocState, Document, NodeId, NodeKind, Session, WindowView};
|
||||
|
||||
mod clipboard;
|
||||
mod images;
|
||||
pub(super) mod layers;
|
||||
mod matrix;
|
||||
pub mod preferences;
|
||||
mod print;
|
||||
@@ -182,6 +184,14 @@ pub(super) enum Coords {
|
||||
const DOCUMENT_COORDS: &str = "CoordinateSystem.DOCUMENTCOORDINATESYSTEM";
|
||||
const ARTBOARD_COORDS: &str = "CoordinateSystem.ARTBOARDCOORDINATESYSTEM";
|
||||
|
||||
#[cfg(test)]
|
||||
thread_local! {
|
||||
/// How many nodes the layer lists of `Layers` objects have looked at on this thread.
|
||||
pub(crate) static LAYER_SCANS: Cell<u64> = const { Cell::new(0) };
|
||||
/// How many lists of art the art collections have built on this thread.
|
||||
pub(crate) static ART_SCANS: Cell<u64> = const { Cell::new(0) };
|
||||
}
|
||||
|
||||
/// What the object model keeps for one run: its coordinate system, the lists of page items and the
|
||||
/// answers of which objects are on a locked artboard for the last [`ITEM_LISTS`] documents read,
|
||||
/// each kept while its document is unchanged, the lists of paths, the point changes of a path not
|
||||
@@ -219,6 +229,21 @@ pub(super) struct State {
|
||||
editing: Cell<Option<Item>>,
|
||||
locked: RefCell<Vec<LockedList>>,
|
||||
saving: Cell<bool>,
|
||||
/// The last [`layers::ART_LISTS`] lists of art [`layers`]' collections gave, least recently
|
||||
/// used first, each kept while its document is unchanged.
|
||||
art: RefCell<Vec<layers::ArtList>>,
|
||||
/// The last [`layers::ART_LISTS`] lists of layers `Layers` objects gave, least recently used
|
||||
/// first, each kept while its document is unchanged.
|
||||
layers: RefCell<Vec<layers::LayerList>>,
|
||||
/// The uids of the documents whose active artboard `setActiveArtboardIndex` changed.
|
||||
pub(super) active_artboards: RefCell<Vec<u64>>,
|
||||
/// Each document's uid and revert generation when `setActiveArtboardIndex` last chose it.
|
||||
pub(super) chosen_artboards: RefCell<Vec<(u64, u64)>>,
|
||||
/// Each open document's uid and the index of its active artboard when the run started.
|
||||
pub(super) boards_at_start: Vec<(u64, usize)>,
|
||||
/// Each document made during the run whose active artboard `setActiveArtboardIndex` chose,
|
||||
/// with the index it chose the first time.
|
||||
pub(super) boards_chosen_in_new: RefCell<Vec<(u64, usize)>>,
|
||||
/// `app.userInteractionLevel` ([`save_open`]).
|
||||
save_options: save_open::State,
|
||||
/// The print option objects ([`print`]).
|
||||
@@ -236,9 +261,9 @@ pub(super) struct State {
|
||||
}
|
||||
|
||||
impl State {
|
||||
/// The state of a run whose heap is `heap_bytes`.
|
||||
pub(super) fn new(heap_bytes: usize) -> Self {
|
||||
Self { preset_limit: heap_bytes as u64, ..Self::default() }
|
||||
/// The state of a run that starts with the documents `docs` open and whose heap is `heap_bytes`.
|
||||
pub(super) fn new(docs: &[DocState], heap_bytes: usize) -> Self {
|
||||
Self { boards_at_start: docs.iter().map(|st| (st.uid, active_artboard(st))).collect(), preset_limit: heap_bytes as u64, ..Self::default() }
|
||||
}
|
||||
|
||||
/// Whether a call's own savepoint is open: its commands take none of their own.
|
||||
@@ -445,7 +470,7 @@ pub(super) fn returns(data_type: &str, arguments: &[(&str, &str)]) -> MemberInfo
|
||||
}
|
||||
|
||||
/// A member the help pages list that is not available yet: reading or assigning it throws, after
|
||||
/// the check that a document, page item, path point or text range `this` is still there.
|
||||
/// the check that a document, layer, page item, path point or text range `this` is still there.
|
||||
/// `hasOwnProperty` is false for it, so a script that checks for the member first skips it, and
|
||||
/// `reflect` leaves it out.
|
||||
pub(super) fn later(link: &Link, class: &'static str, name: &'static str) -> Described {
|
||||
@@ -458,7 +483,10 @@ pub(super) fn later(link: &Link, class: &'static str, name: &'static str) -> Des
|
||||
"Document" => {
|
||||
doc_of(&h, arg(&a, 0), "Document")?;
|
||||
}
|
||||
"PageItem" | "PathItem" | "TextFrame" | "PlacedItem" | "RasterItem" => {
|
||||
"Layer" => {
|
||||
layers::layer_of(&h, arg(&a, 0))?;
|
||||
}
|
||||
c if c == "PageItem" || ITEM_CLASSES.contains(&c) => {
|
||||
item_of(&h, arg(&a, 0))?;
|
||||
}
|
||||
"PathPoint" => {
|
||||
@@ -926,14 +954,27 @@ fn on_doc<T>(
|
||||
keep_selection: bool,
|
||||
f: impl FnOnce(&Host) -> std::result::Result<T, HostError>,
|
||||
) -> std::result::Result<T, HostError> {
|
||||
atomically(h, |h| on_doc_steps(h, uid, keep_selection, f))
|
||||
on_doc_layer(h, uid, keep_selection, true, f)
|
||||
}
|
||||
|
||||
/// The steps of [`on_doc`].
|
||||
/// [`on_doc`], with `keep_layer` false for `f`s that choose the current layer (`layers.add()`,
|
||||
/// `activeLayer = layer`): the selection is put back, and the layer `f` left current stays current.
|
||||
fn on_doc_layer<T>(
|
||||
h: &Host,
|
||||
uid: u64,
|
||||
keep_selection: bool,
|
||||
keep_layer: bool,
|
||||
f: impl FnOnce(&Host) -> std::result::Result<T, HostError>,
|
||||
) -> std::result::Result<T, HostError> {
|
||||
atomically(h, |h| on_doc_steps(h, uid, keep_selection, keep_layer, f))
|
||||
}
|
||||
|
||||
/// The steps of [`on_doc_layer`].
|
||||
fn on_doc_steps<T>(
|
||||
h: &Host,
|
||||
uid: u64,
|
||||
keep_selection: bool,
|
||||
keep_layer: bool,
|
||||
f: impl FnOnce(&Host) -> std::result::Result<T, HostError>,
|
||||
) -> std::result::Result<T, HostError> {
|
||||
let (index, active, before, layer, activated) = {
|
||||
@@ -947,6 +988,12 @@ fn on_doc_steps<T>(
|
||||
command(h, "document.activate", &json!({"index": index}))?;
|
||||
}
|
||||
let r = f(h);
|
||||
let layer = if keep_layer {
|
||||
layer
|
||||
} else {
|
||||
let s = h.session.borrow();
|
||||
s.active().filter(|st| st.uid == uid).map_or(layer, |st| (st.active_layer, st.highlighted_rows()))
|
||||
};
|
||||
let mut restored = Ok(());
|
||||
if keep_selection {
|
||||
let doc = {
|
||||
@@ -2169,22 +2216,35 @@ fn items_doc(h: &Host, a: &[Data]) -> std::result::Result<Doc, HostError> {
|
||||
}
|
||||
|
||||
fn items_length(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_length(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
let n = with_doc(h, doc, |_, st| page_items(h, st).map(|ids| ids.len()))?;
|
||||
Ok(num(float(n as u64)))
|
||||
}
|
||||
|
||||
fn items_typename(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_typename(h, a);
|
||||
}
|
||||
items_doc(h, a)?;
|
||||
Ok(text("PageItems"))
|
||||
}
|
||||
|
||||
fn items_to_string(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
layers::scoped_typename(h, a)?;
|
||||
return Ok(text("[PageItems]"));
|
||||
}
|
||||
items_doc(h, a)?;
|
||||
Ok(text("[PageItems]"))
|
||||
}
|
||||
|
||||
fn items_parent(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_parent(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
Ok(doc_ref(h, doc.uid))
|
||||
}
|
||||
@@ -2204,6 +2264,9 @@ fn position(n: f64) -> Option<usize> {
|
||||
/// number but not an array index, such as `-1` or `1.5`, reaches the indexer as a number and is
|
||||
/// looked up as that name, giving `undefined` when no object has it.
|
||||
fn items_at(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_at(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
match arg(a, 1) {
|
||||
Data::String(_) => match items_by_name(h, a) {
|
||||
@@ -2227,6 +2290,9 @@ fn item_at(h: &Host, doc: Doc, i: usize) -> Answer {
|
||||
}
|
||||
|
||||
fn items_by_name(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_by_name(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
let Data::String(name) = arg(a, 1) else { return Err(HostError::Type("give a name, as a string".into())) };
|
||||
items_named(h, doc, name)
|
||||
@@ -2243,6 +2309,9 @@ fn items_named(h: &Host, doc: Doc, name: &str) -> Answer {
|
||||
}
|
||||
|
||||
fn items_index(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_index(h, a);
|
||||
}
|
||||
match arg(a, 1) {
|
||||
Data::String(_) => items_by_name(h, a),
|
||||
Data::Number(n) => {
|
||||
@@ -2260,6 +2329,9 @@ fn items_index(h: &Host, a: &[Data]) -> Answer {
|
||||
/// locked object, or one in a hidden or locked layer or group, stops it before anything is deleted,
|
||||
/// and so does an object on a locked artboard.
|
||||
fn items_remove_all(h: &Host, a: &[Data]) -> Answer {
|
||||
if layers::is_scoped(a, "PageItems") {
|
||||
return layers::scoped_remove_all(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
let (ids, refused, on_locked) = with_doc(h, doc, |_, st| {
|
||||
let ids = top_items(&st.doc);
|
||||
@@ -2434,8 +2506,14 @@ fn item_set_locked(h: &Host, a: &[Data]) -> Answer {
|
||||
set_props(h, a, |n| n.locked == locked, json!({"locked": locked}))
|
||||
}
|
||||
|
||||
/// The percentage a page item's or a layer's `opacity` reports for `opacity`, rounded to four
|
||||
/// decimals.
|
||||
fn reported_opacity(opacity: f32) -> f64 {
|
||||
(f64::from(opacity) * 100.0 * 1e4).round() / 1e4
|
||||
}
|
||||
|
||||
fn item_opacity(h: &Host, a: &[Data]) -> Answer {
|
||||
read_item(h, a, |_, n| Ok(num((f64::from(n.opacity) * 100.0 * 1e4).round() / 1e4)))
|
||||
read_item(h, a, |_, n| Ok(num(reported_opacity(n.opacity))))
|
||||
}
|
||||
|
||||
fn item_set_opacity(h: &Host, a: &[Data]) -> Answer {
|
||||
@@ -2452,7 +2530,7 @@ fn item_set_opacity(h: &Host, a: &[Data]) -> Answer {
|
||||
let (now, keeps_other) = with_doc(h, item.doc, |_, st| {
|
||||
let d = &st.doc;
|
||||
// Only the exact number the getter reports counts as the same opacity.
|
||||
let now = d.node(item.id).map(|n| f64::from(n.opacity) * 100.0).filter(|now| (now * 1e4).round() / 1e4 == v);
|
||||
let now = d.node(item.id).filter(|n| reported_opacity(n.opacity) == v).map(|n| f64::from(n.opacity) * 100.0);
|
||||
let keeps_other =
|
||||
crate::cmd::graph::series_object_opacity_differs(d, &[item.id]) || crate::cmd::graph::label_object_opacity_differs(d, &[item.id]);
|
||||
(now, keeps_other)
|
||||
@@ -2831,7 +2909,11 @@ fn destination(h: &Host, item: Item, target: &Data, how: &Data, copy: bool) -> s
|
||||
}
|
||||
let (parent, beside) = match how {
|
||||
Placement::Top | Placement::Bottom => {
|
||||
if !matches!(t.kind, NodeKind::Layer { .. } | NodeKind::Group { .. }) {
|
||||
if matches!(t.kind, NodeKind::Compound { .. }) {
|
||||
if !d.node(item.id).is_some_and(|n| matches!(n.kind, NodeKind::Path { guide: false, .. })) {
|
||||
return Err(HostError::Error("a compound path holds only paths".into()));
|
||||
}
|
||||
} else if !matches!(t.kind, NodeKind::Layer { .. } | NodeKind::Group { .. }) {
|
||||
return Err(HostError::Error(format!("{} cannot hold objects", typename(t).unwrap_or("Layer"))));
|
||||
}
|
||||
(target, None)
|
||||
@@ -3089,19 +3171,6 @@ fn item_z_order(h: &Host, a: &[Data]) -> Answer {
|
||||
Ok(Data::Undefined)
|
||||
}
|
||||
|
||||
fn layer_name(h: &Host, a: &[Data]) -> Answer {
|
||||
let Some(handle) = handle_of(arg(a, 0), "Layer") else { return Err(HostError::Type("this is not a Layer".into())) };
|
||||
let [run, uid, _, _, _] = handle.as_slice() else { return Err(HostError::Type("this is not a Layer".into())) };
|
||||
find_doc(h, *run, *uid).ok_or_else(|| HostError::Error(STALE_DOCUMENT.into()))?;
|
||||
let (doc, id) = node_of(h, &handle).ok_or_else(|| HostError::Error(STALE_ITEM.into()))?;
|
||||
with_doc(h, doc, |_, st| st.doc.node(id).map(|n| text(n.name.clone().unwrap_or_default())).ok_or_else(|| HostError::Error(STALE_ITEM.into())))
|
||||
}
|
||||
|
||||
fn layer_typename(h: &Host, a: &[Data]) -> Answer {
|
||||
layer_name(h, a)?;
|
||||
Ok(text("Layer"))
|
||||
}
|
||||
|
||||
/// `toString()` of an object with a name: `[Class name]`, `[PathItem ]` for an object with no name.
|
||||
fn named_text(class: &str, name: Answer) -> Answer {
|
||||
match name? {
|
||||
@@ -3118,10 +3187,6 @@ fn doc_to_string(h: &Host, a: &[Data]) -> Answer {
|
||||
named_text("Document", doc_name(h, a))
|
||||
}
|
||||
|
||||
fn layer_to_string(h: &Host, a: &[Data]) -> Answer {
|
||||
named_text("Layer", layer_name(h, a))
|
||||
}
|
||||
|
||||
/// `toString()` of an object without a name: `[Class]`.
|
||||
fn class_text(name: &'static str) -> HostMember {
|
||||
HostMember::Method(Rc::new(move |_| Ok(text(format!("[{name}]")))))
|
||||
@@ -3314,7 +3379,8 @@ fn classes(link: &Link) -> Vec<HostClass> {
|
||||
]);
|
||||
document.extend(defaults::document_members(l));
|
||||
document.extend(text::styles::doc_members(l));
|
||||
document.extend(["layers", "artboards", "groupItems", "swatches", "symbols", "activeLayer"].into_iter().map(|m| later(l, "Document", m)));
|
||||
document.extend(["swatches", "symbols"].into_iter().map(|m| later(l, "Document", m)));
|
||||
document.extend(layers::document_members(l));
|
||||
document.extend(variables::document_members(l));
|
||||
document.extend(save_open::document_members(l));
|
||||
document.extend(print::document_members(l));
|
||||
@@ -3353,7 +3419,7 @@ fn classes(link: &Link) -> Vec<HostClass> {
|
||||
named(vec![
|
||||
("typename", get(l, items_typename), typed("string")),
|
||||
("length", get(l, items_length), typed("number")),
|
||||
("parent", get(l, items_parent), typed("Document")),
|
||||
("parent", get(l, items_parent), typed("*")),
|
||||
("index", method(l, items_index), returns("PageItem", &[("itemKey", "*")])),
|
||||
("getByName", method(l, items_by_name), returns("PageItem", &[("name", "string")])),
|
||||
("removeAll", method(l, items_remove_all), returns("undefined", &[])),
|
||||
@@ -3457,28 +3523,18 @@ fn classes(link: &Link) -> Vec<HostClass> {
|
||||
),
|
||||
),
|
||||
]);
|
||||
page_item.extend(layers::page_item_members(l));
|
||||
page_item.extend(
|
||||
[
|
||||
"artworkKnockout",
|
||||
"isIsolated",
|
||||
"layer",
|
||||
"pixelAligned",
|
||||
"sliced",
|
||||
"uRL",
|
||||
"uuid",
|
||||
"wrapInside",
|
||||
"wrapOffset",
|
||||
"wrapped",
|
||||
"bringInPerspective",
|
||||
]
|
||||
.into_iter()
|
||||
.map(|m| later(l, "PageItem", m)),
|
||||
["artworkKnockout", "isIsolated", "pixelAligned", "sliced", "uRL", "uuid", "wrapInside", "wrapOffset", "wrapped", "bringInPerspective"]
|
||||
.into_iter()
|
||||
.map(|m| later(l, "PageItem", m)),
|
||||
);
|
||||
page_item.extend(variables::page_item_members(l));
|
||||
classes.push(class("PageItem", None, page_item, None));
|
||||
let own = |c: &&&str| **c == "TextFrame" || images::CLASSES.contains(c) || tracing::CLASSES.contains(c);
|
||||
classes.extend(ITEM_CLASSES.iter().filter(|c| !own(c)).map(|c| {
|
||||
let mut members = variables::item_members(l, c);
|
||||
let mut members = layers::members(c, l);
|
||||
members.extend(variables::item_members(l, c));
|
||||
if *c == "PathItem" {
|
||||
members.extend(paths::path_item_members(l));
|
||||
}
|
||||
@@ -3488,21 +3544,12 @@ fn classes(link: &Link) -> Vec<HostClass> {
|
||||
classes.extend(colors::classes(l));
|
||||
classes.extend(text::classes(l));
|
||||
classes.extend(variables::classes(l));
|
||||
classes.extend(layers::classes(l));
|
||||
classes.extend(images::classes(l));
|
||||
tracing::add_trace(&mut classes, l);
|
||||
classes.extend(tracing::classes(l));
|
||||
classes.extend(save_open::classes(l));
|
||||
classes.extend(print::classes(l));
|
||||
classes.push(class(
|
||||
"Layer",
|
||||
None,
|
||||
named(vec![
|
||||
("typename", get(l, layer_typename), typed("string")),
|
||||
("name", get(l, layer_name), typed("string")),
|
||||
("toString", method(l, layer_to_string), returns("string", &[])),
|
||||
]),
|
||||
None,
|
||||
));
|
||||
classes.extend(tags::classes(l));
|
||||
classes
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ const CLASSES: &[(&str, &[&str])] = &[
|
||||
("PatternColor", &[]),
|
||||
];
|
||||
|
||||
fn color_object(class: &str, values: &[(&str, f64)]) -> Data {
|
||||
pub(super) fn color_object(class: &str, values: &[(&str, f64)]) -> Data {
|
||||
let mut items = vec![("typename".to_string(), text(class))];
|
||||
items.extend(values.iter().map(|(k, v)| ((*k).to_string(), num(*v))));
|
||||
Data::Object(items)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -397,21 +397,33 @@ pub(super) fn doc_path_items(h: &super::Host, a: &[Data]) -> Answer {
|
||||
}
|
||||
|
||||
fn items_doc(h: &super::Host, a: &[Data]) -> std::result::Result<Doc, HostError> {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return Err(HostError::Error("creating paths in a compound path is not available yet; move a path into it".into()));
|
||||
}
|
||||
doc_of(h, arg(a, 0), "PathItems")
|
||||
}
|
||||
|
||||
/// `typename` of the paths of a document that is still open.
|
||||
fn items_typename(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_typename(h, a);
|
||||
}
|
||||
items_doc(h, a)?;
|
||||
Ok(Data::String("PathItems".into()))
|
||||
}
|
||||
|
||||
fn items_length(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_length(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
Ok(num(float(with_doc(h, doc, |_, st| path_items(h, st).map(|ids| ids.len()))? as u64)))
|
||||
}
|
||||
|
||||
fn items_parent(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_parent(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
Ok(host_ref("Document", &[float(h.run), float(doc.uid)]))
|
||||
}
|
||||
@@ -420,6 +432,9 @@ fn items_parent(h: &super::Host, a: &[Data]) -> Answer {
|
||||
/// number but not an array index, such as `-1` or `1.5`, reaches the indexer as a number and is
|
||||
/// looked up as that name, giving `undefined` when no path has it.
|
||||
fn items_at(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_at(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
match arg(a, 1) {
|
||||
Data::String(_) => match items_by_name(h, a) {
|
||||
@@ -443,6 +458,9 @@ fn item_at(h: &super::Host, doc: Doc, i: usize) -> Answer {
|
||||
}
|
||||
|
||||
fn items_by_name(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_by_name(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
let Data::String(name) = arg(a, 1) else { return Err(HostError::Type("give a name, as a string".into())) };
|
||||
items_named(h, doc, name)
|
||||
@@ -459,6 +477,9 @@ fn items_named(h: &super::Host, doc: Doc, name: &str) -> Answer {
|
||||
}
|
||||
|
||||
fn items_index(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_index(h, a);
|
||||
}
|
||||
match arg(a, 1) {
|
||||
Data::String(_) => items_by_name(h, a),
|
||||
Data::Number(n) => {
|
||||
@@ -476,6 +497,9 @@ fn items_index(h: &super::Host, a: &[Data]) -> Answer {
|
||||
/// path, one in a hidden or locked layer or group, or one on a locked artboard stops it before
|
||||
/// anything is deleted, as `PageItems.removeAll()` does.
|
||||
fn items_remove_all(h: &super::Host, a: &[Data]) -> Answer {
|
||||
if super::layers::is_scoped(a, "PathItems") {
|
||||
return super::layers::scoped_remove_all(h, a);
|
||||
}
|
||||
let doc = items_doc(h, a)?;
|
||||
let (ids, refused, on_locked) = with_doc(h, doc, |_, st| {
|
||||
let ids = path_items(h, st)?;
|
||||
@@ -1813,8 +1837,9 @@ pub(super) fn classes(l: &Link) -> Vec<HostClass> {
|
||||
None,
|
||||
named(vec![
|
||||
("typename", get(l, items_typename), typed("string")),
|
||||
("toString", super::class_text("PathItems"), returns("string", &[])),
|
||||
("length", get(l, items_length), typed("number")),
|
||||
("parent", get(l, items_parent), typed("Document")),
|
||||
("parent", get(l, items_parent), typed("*")),
|
||||
("index", method(l, items_index), returns("PathItem", &[("itemKey", "*")])),
|
||||
("getByName", method(l, items_by_name), returns("PathItem", &[("name", "string")])),
|
||||
("removeAll", method(l, items_remove_all), returns("undefined", &[])),
|
||||
|
||||
@@ -2431,7 +2431,7 @@ impl Session {
|
||||
eval_strict: Cell::new(None),
|
||||
dollar: dollar::RunState::new(&request.locale),
|
||||
args: RefCell::new((Data::Undefined, 0)),
|
||||
dom: dom::State::new(heap_bytes),
|
||||
dom: dom::State::new(self.documents(), heap_bytes),
|
||||
actions: request.actions,
|
||||
active_artboards: self.docs.iter().map(|d| (d.uid, dom::active_artboard(d))).collect(),
|
||||
artboard_picks,
|
||||
@@ -2748,6 +2748,10 @@ impl Session {
|
||||
"hostCalls": host.calls.get(),
|
||||
});
|
||||
host.more_written(&mut report);
|
||||
let start: Vec<(u64, usize)> = host.dom.boards_at_start.iter().chain(host.dom.boards_chosen_in_new.borrow().iter()).copied().collect();
|
||||
if let Some(boards) = dom::layers::active_artboards(&host.dom.active_artboards.borrow(), &start, self.documents()) {
|
||||
report["activeArtboards"] = boards;
|
||||
}
|
||||
// The run ran a Copy or Cut, and the clipboard still holds what one put there.
|
||||
if host.copied.get()
|
||||
&& self.clipboard_copied
|
||||
|
||||
@@ -262,6 +262,82 @@ fn steps_act_on_the_artboard_active_as_they_run() {
|
||||
assert_eq!(left(&s), was[0].x0, "a step that names artboard 0 keeps it");
|
||||
}
|
||||
|
||||
/// After the script makes another artboard active with `setActiveArtboardIndex`, a step that acts
|
||||
/// on the active artboard acts on that one.
|
||||
#[test]
|
||||
fn steps_act_on_the_artboard_the_script_made_active() {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 100, "height": 100, "units": "Points", "artboards": 3})).unwrap();
|
||||
let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 30})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("paint.setStroke", &json!({"none": true})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
let was: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
make_active(&mut s, 0);
|
||||
let actions = set(&[("Fit", vec![json!({"command": "artboard.fitToSelection"})])]);
|
||||
log_with(&mut s, "app.activeDocument.artboards.setActiveArtboardIndex(1); app.doScript('Fit', 'Set');", &actions);
|
||||
let now: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
assert_eq!(now[0], was[0], "the artboard active as the run started is unchanged");
|
||||
assert_ne!(now[1], was[1], "the artboard the script made active is fitted");
|
||||
// Choosing the artboard that is already active, after an insert moved it, also counts.
|
||||
make_active(&mut s, 0);
|
||||
let was: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
log_with(
|
||||
&mut s,
|
||||
"var b = app.activeDocument.artboards; b.insert([300, 300, 400, 200], 0); b.setActiveArtboardIndex(1); app.doScript('Fit', 'Set');",
|
||||
&actions,
|
||||
);
|
||||
let now: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
assert_ne!(now[1], was[0], "the artboard chosen again is fitted");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn steps_use_the_chosen_index_when_the_chosen_artboard_is_deleted() {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 100, "height": 100, "units": "Points", "artboards": 3})).unwrap();
|
||||
let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 30})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("paint.setStroke", &json!({"none": true})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
let was: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
make_active(&mut s, 2);
|
||||
let actions = set(&[("Fit", vec![json!({"command": "artboard.fitToSelection"})])]);
|
||||
let report = run_with(
|
||||
&mut s,
|
||||
"var b = app.activeDocument.artboards; b.setActiveArtboardIndex(2); b.remove(2);\
|
||||
vc.log(b.getActiveArtboardIndex()); app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;\
|
||||
vc.log(app.activeDocument.selection[0].position); app.doScript('Fit', 'Set');",
|
||||
&actions,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(report["log"], json!([0, [10, 10]]));
|
||||
assert_eq!(report["activeArtboards"], json!([{"document": 0, "artboard": 0}]));
|
||||
let now: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
assert_eq!(now.len(), 2);
|
||||
assert_ne!(now[0], was[0], "the fallback artboard is fitted");
|
||||
assert_eq!(now[1], was[1], "the other artboard is unchanged");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn steps_discard_the_chosen_artboard_after_revert() {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 100, "height": 100, "units": "Points", "artboards": 3})).unwrap();
|
||||
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 30})).unwrap();
|
||||
let folder = vectorcraft_testkit::TempDir::new("script-actions-revert-artboard");
|
||||
let path = folder.join("saved.vectorcraft");
|
||||
s.execute("document.save", &json!({"path": path.to_string_lossy()})).unwrap();
|
||||
let was: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
make_active(&mut s, 2);
|
||||
let actions = set(&[("Fit", vec![json!({"command": "artboard.fitToSelection"})])]);
|
||||
log_with(
|
||||
&mut s,
|
||||
"app.activeDocument.artboards.setActiveArtboardIndex(0); app.activeDocument.pageItems[0].name = 'changed'; vc.run('file.revert');\
|
||||
app.activeDocument.selection = app.activeDocument.pageItems[0]; app.doScript('Fit', 'Set');",
|
||||
&actions,
|
||||
);
|
||||
let now: Vec<_> = s.active().unwrap().doc.artboards.iter().map(|a| a.rect).collect();
|
||||
assert_eq!(now[..2], was[..2]);
|
||||
assert_ne!(now[2], was[2], "playback uses the run's original index after revert");
|
||||
}
|
||||
|
||||
/// A recorded `command.batch` step that names its `artboard` gives it to its steps that name none,
|
||||
/// past the last artboard the last one, as `command.batch` does; a step that names its own keeps it.
|
||||
#[test]
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -96,10 +96,11 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
),
|
||||
(
|
||||
"",
|
||||
"activeDocument activeDocument= app Application BlendModes CoordinateSystem Document DocumentArtboardLayout DocumentColorSpace \
|
||||
DocumentPreset DocumentPresetType DocumentPreviewMode DocumentRasterResolution DocumentTransparencyGrid documents \
|
||||
Documents ElementPlacement Layer PageItem PageItems PathItem PathItems PathPoint PathPointSelection PathPoints PlacedItem \
|
||||
PlacedItems PluginItem PointType PolarityValues Preferences RasterItem RasterItems RulerUnits ScreenMode selection \
|
||||
"activeDocument activeDocument= app Application Artboard Artboards BlendModes CompoundPathItem CompoundPathItems \
|
||||
CoordinateSystem Document DocumentArtboardLayout DocumentColorSpace DocumentPreset DocumentPresetType \
|
||||
DocumentPreviewMode DocumentRasterResolution DocumentTransparencyGrid documents Documents ElementPlacement \
|
||||
GroupItem GroupItems Layer Layers PageItem PageItems PathItem PathItems PathPoint PathPointSelection PathPoints \
|
||||
PlacedItem PlacedItems PluginItem PointType PolarityValues Preferences RasterItem RasterItems RulerUnits ScreenMode selection \
|
||||
selection= StrokeCap StrokeJoin Tag Tags TracingObject TracingOptions Transformation View Views ZOrderMethod",
|
||||
),
|
||||
("Application.", "prototype"),
|
||||
@@ -128,14 +129,14 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
("Document.", "prototype"),
|
||||
(
|
||||
"Document.prototype.",
|
||||
"activeLayer activeLayer= artboards artboards= characterStyles close constructor convertCoordinate \
|
||||
"activeLayer activeLayer= artboards characterStyles close compoundPathItems constructor convertCoordinate \
|
||||
defaultFillColor defaultFillColor= defaultFillOverprint defaultFillOverprint= defaultFilled defaultFilled= \
|
||||
defaultStrokeCap defaultStrokeCap= defaultStrokeColor defaultStrokeColor= defaultStrokeDashOffset \
|
||||
defaultStrokeDashOffset= defaultStrokeDashes defaultStrokeDashes= defaultStrokeJoin defaultStrokeJoin= \
|
||||
defaultStrokeMiterLimit defaultStrokeMiterLimit= defaultStrokeOverprint defaultStrokeOverprint= \
|
||||
defaultStrokeWidth defaultStrokeWidth= defaultStroked defaultStroked= documentColorSpace fullName groupItems \
|
||||
groupItems= height layers layers= name pageItems paragraphStyles parent path pathItems placedItems rasterItems \
|
||||
rulerOrigin rulerOrigin= rulerUnits saved saved= scaleFactor selection selection= stories swatches swatches= \
|
||||
height layers name pageItems paragraphStyles parent path pathItems placedItems rasterItems rulerOrigin \
|
||||
rulerOrigin= rulerUnits saved saved= scaleFactor selection selection= stories swatches swatches= \
|
||||
symbols symbols= tags textFrames toString typename views width",
|
||||
),
|
||||
("Views.", "prototype"),
|
||||
@@ -143,15 +144,48 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
("View.", "prototype"),
|
||||
("View.prototype.", "bounds centerPoint centerPoint= constructor parent screenMode screenMode= toString typename zoom zoom="),
|
||||
("Layer.", "prototype"),
|
||||
("Layer.prototype.", "constructor name toString typename"),
|
||||
(
|
||||
"Layer.prototype.",
|
||||
"artworkKnockout artworkKnockout= blendingMode blendingMode= color color= compoundPathItems constructor \
|
||||
dimPlacedImages dimPlacedImages= groupItems hasSelectedArtwork hasSelectedArtwork= isIsolated layers locked \
|
||||
locked= move name name= opacity opacity= pageItems parent pathItems pathItems= placedItems placedItems= preview \
|
||||
preview= printable printable= rasterItems rasterItems= remove sliced sliced= symbolItems symbolItems= textFrames \
|
||||
textFrames= toString typename visible visible= zOrder zOrderPosition",
|
||||
),
|
||||
("Layers.", "prototype"),
|
||||
("Layers.prototype.", "add constructor getByName index length parent removeAll toString typename"),
|
||||
("GroupItem.", "prototype"),
|
||||
(
|
||||
"GroupItem.prototype.",
|
||||
"clipped clipped= compoundPathItems constructor groupItems pageItems pathItems pathItems= placedItems placedItems= \
|
||||
rasterItems rasterItems= symbolItems symbolItems= textFrames textFrames=",
|
||||
),
|
||||
("GroupItems.", "prototype"),
|
||||
("GroupItems.prototype.", "add constructor createFromFile createFromFile= getByName index length parent removeAll toString typename"),
|
||||
("CompoundPathItem.", "prototype"),
|
||||
("CompoundPathItem.prototype.", "constructor pathItems"),
|
||||
("CompoundPathItems.", "prototype"),
|
||||
("CompoundPathItems.prototype.", "add constructor getByName index length parent removeAll toString typename"),
|
||||
("Artboard.", "prototype"),
|
||||
(
|
||||
"Artboard.prototype.",
|
||||
"artboardRect artboardRect= constructor name name= parent remove rulerOrigin rulerOrigin= rulerPAR rulerPAR= \
|
||||
showCenter showCenter= showCrossHairs showCrossHairs= showSafeAreas showSafeAreas= toString typename",
|
||||
),
|
||||
("Artboards.", "prototype"),
|
||||
(
|
||||
"Artboards.prototype.",
|
||||
"add constructor getActiveArtboardIndex getByName index insert length parent remove setActiveArtboardIndex \
|
||||
toString typename",
|
||||
),
|
||||
("PageItems.", "prototype"),
|
||||
("PageItems.prototype.", "constructor getByName index length parent removeAll toString typename"),
|
||||
("PageItem.", "prototype"),
|
||||
(
|
||||
"PageItem.prototype.",
|
||||
"artworkKnockout artworkKnockout= blendingMode blendingMode= bringInPerspective bringInPerspective= constructor \
|
||||
controlBounds duplicate editable geometricBounds height height= hidden hidden= isIsolated isIsolated= layer layer= \
|
||||
left left= locked locked= move name name= note note= opacity opacity= parent pixelAligned pixelAligned= position \
|
||||
controlBounds duplicate editable geometricBounds height height= hidden hidden= isIsolated isIsolated= layer left \
|
||||
left= locked locked= move name name= note note= opacity opacity= parent pixelAligned pixelAligned= position \
|
||||
position= remove resize rotate selected selected= sliced sliced= tags toString top top= transform translate \
|
||||
typename uRL uRL= uuid uuid= visibilityVariable visibilityVariable= visibleBounds \
|
||||
width width= wrapInside wrapInside= wrapOffset wrapOffset= wrapped wrapped= zOrder zOrderPosition",
|
||||
@@ -188,7 +222,10 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
viewVector=",
|
||||
),
|
||||
("PathItems.", "prototype"),
|
||||
("PathItems.prototype.", "add constructor ellipse getByName index length parent polygon rectangle removeAll roundedRectangle star typename"),
|
||||
(
|
||||
"PathItems.prototype.",
|
||||
"add constructor ellipse getByName index length parent polygon rectangle removeAll roundedRectangle star toString typename",
|
||||
),
|
||||
("PathItem.", "prototype"),
|
||||
(
|
||||
"PathItem.prototype.",
|
||||
@@ -520,12 +557,10 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
];
|
||||
|
||||
/// The classes the host adds with nothing but a prototype and its constructor: the page item types
|
||||
/// other than `PathItem`, `PlacedItem` and `RasterItem`, the color classes and the save and export
|
||||
/// option classes.
|
||||
const BARE_CLASSES: &str = "BlendItem CMYKColor CompoundPathItem EnvelopeItem GradientColor GraphItem GrayColor GroupItem \
|
||||
IntertwineItem LabColor MeshItem NoColor PatternColor PlacedDocumentItem RGBColor RepeatItem SpotColor SymbolItem \
|
||||
cmykColor EPSSaveOptions ExportOptionsAutoCAD ExportOptionsJPEG ExportOptionsPNG24 ExportOptionsSVG IllustratorSaveOptions \
|
||||
PDFSaveOptions";
|
||||
/// that have no members of their own, the color classes, and the save and export option classes.
|
||||
const BARE_CLASSES: &str = "BlendItem CMYKColor EnvelopeItem GradientColor GraphItem GrayColor IntertwineItem LabColor \
|
||||
MeshItem NoColor PatternColor PlacedDocumentItem RGBColor RepeatItem SpotColor SymbolItem cmykColor \
|
||||
EPSSaveOptions ExportOptionsAutoCAD ExportOptionsJPEG ExportOptionsPNG24 ExportOptionsSVG IllustratorSaveOptions PDFSaveOptions";
|
||||
|
||||
/// The name the checker does not read, which also stands for its members: `vc` is VectorCraft's
|
||||
/// own API, and what `vc.run` does depends on the command it runs.
|
||||
|
||||
@@ -997,6 +997,15 @@ fn a_host_class_constructor_called_with_new_cannot_wait() {
|
||||
assert_eq!(could.get(), Some(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_host_class_constructor_called_with_new_cannot_give_a_primitive() {
|
||||
let mut r = realm(1_000_000);
|
||||
let make: HostFunction = Rc::new(|_| Ok(Data::Number(7.0)));
|
||||
with_thing(&mut r, Some(make));
|
||||
r.start("var r; try { r = new Thing(); } catch (e) { r = e instanceof TypeError; } r").unwrap();
|
||||
assert_eq!(finish(&mut r, 1_000).0.unwrap(), JsValue::Bool(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_on_a_host_constructor_that_gives_a_value_other_than_an_object_throws() {
|
||||
let mut r = realm(1_000_000);
|
||||
|
||||
@@ -60,6 +60,7 @@ pub fn poll(app: &mut VectorcraftApp) {
|
||||
script_run::forget::<GrowthQuestion>(app);
|
||||
script_run::settle_close(app);
|
||||
script_window::sync(app);
|
||||
let boards = result.as_ref().ok().and_then(|r| r["activeArtboards"].as_array().cloned()).unwrap_or_default();
|
||||
match result {
|
||||
// The commands it ran are journaled now: a recording they no longer fit in names its limit.
|
||||
Ok(report) => {
|
||||
@@ -88,6 +89,29 @@ pub fn poll(app: &mut VectorcraftApp) {
|
||||
}
|
||||
startup_failures(app);
|
||||
app.sync_views();
|
||||
show_artboards(app, &boards);
|
||||
}
|
||||
|
||||
/// Makes each artboard a run's `setActiveArtboardIndex` chose the active one of its document's view
|
||||
/// (`activeArtboards` in the run's report: `{document, artboard}`, both indexes). The end of a run
|
||||
/// starts the tool afresh, so the Artboard tool then takes the active document's active artboard as
|
||||
/// its only selected one, as choosing it in the Artboards panel does.
|
||||
fn show_artboards(app: &mut VectorcraftApp, boards: &[serde_json::Value]) {
|
||||
for b in boards {
|
||||
let index = |k: &str| b[k].as_u64().and_then(|i| usize::try_from(i).ok());
|
||||
let (Some(doc), Some(board)) = (index("document"), index("artboard")) else { continue };
|
||||
let count = app.session.documents().get(doc).map_or(0, |d| d.doc.artboards.len());
|
||||
if let Some(view) = app.views.get_mut(doc)
|
||||
&& board < count
|
||||
{
|
||||
view.artboard = board;
|
||||
}
|
||||
}
|
||||
if app.session.tool_id() == "artboard"
|
||||
&& let Some(n) = app.session.active().map(|d| d.doc.artboards.len()).filter(|n| *n > 0)
|
||||
{
|
||||
crate::panels::artboards::select(app, crate::panels::artboards::selected(app, n));
|
||||
}
|
||||
}
|
||||
|
||||
/// The running script reads each drawn window in `Document.views`, with its last drawn area.
|
||||
|
||||
@@ -217,6 +217,36 @@ fn stop_puts_the_document_back_and_says_so() {
|
||||
assert_eq!(app.ui.status, "The script was stopped and its changes were undone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_active_artboard_index_shows_the_artboard_in_the_view() {
|
||||
let mut app = app();
|
||||
app.session.prefs.show_external_script_warning = false;
|
||||
app.run("artboard.new", json!({"x": 1000, "y": 0, "width": 100, "height": 100})).unwrap();
|
||||
app.views[0].artboard = 0;
|
||||
let source = "app.activeDocument.artboards.setActiveArtboardIndex(1);";
|
||||
menus::run_ui_command(&mut app, "ui.runScript", &json!({ "source": source })).unwrap().unwrap();
|
||||
finish(&mut app);
|
||||
assert_eq!(app.views[0].artboard, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_artboard_tool_follows_the_artboard_a_script_makes_active() {
|
||||
let mut app = app();
|
||||
app.session.prefs.show_external_script_warning = false;
|
||||
app.run("artboard.new", json!({"x": 1000, "y": 0, "width": 100, "height": 100})).unwrap();
|
||||
app.run("artboard.new", json!({"x": 2000, "y": 0, "width": 100, "height": 100})).unwrap();
|
||||
app.select_tool("artboard");
|
||||
crate::panels::artboards::select(&mut app, 2);
|
||||
// A run starts the tool afresh; it keeps the view's active artboard, then the one the script chose.
|
||||
for (source, active) in [("vc.log(1);", 2), ("app.activeDocument.artboards.setActiveArtboardIndex(1);", 1)] {
|
||||
menus::run_ui_command(&mut app, "ui.runScript", &json!({ "source": source })).unwrap().unwrap();
|
||||
finish(&mut app);
|
||||
assert_eq!(app.views[0].artboard, active, "{source}");
|
||||
assert_eq!(app.session.tool_options()["active"], json!(active), "{source}");
|
||||
assert_eq!(app.session.tool_options()["selected"], json!([active]), "{source}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_canceled_pick_does_not_take_a_dropped_script() {
|
||||
let mut app = app();
|
||||
|
||||
+3
-3
@@ -857,9 +857,9 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
|
||||
|
||||
## G6 Automation and scripting
|
||||
|
||||
- **Missing:** the rest of the document object model for scripts (layers, artboards, gradient stops and the other classes)
|
||||
and the `#engine` script directive (#1183 is open). Scripts have `app`, the open
|
||||
documents, new documents, each document's selection and its page items, its text frames with their text ranges and
|
||||
- **Missing:** the rest of the document object model for scripts (gradient stops and the other classes) and the
|
||||
`#engine` script directive (#1183 is open). Scripts have `app`, the open documents, new documents, each document's
|
||||
selection, its page items, layers, groups, compound paths and artboards, its text frames with their text ranges and
|
||||
character and paragraph attributes, their links to each other and the stories they form, its character and
|
||||
paragraph styles, the installed fonts, each document's variables, data sets and variable libraries, and its
|
||||
linked and embedded images (`placedItems` and `rasterItems`, with `PlacedItem` and `RasterItem`); tracing,
|
||||
|
||||
+104
-11
@@ -3133,9 +3133,9 @@ through `$`:
|
||||
`transform` (https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/). `move` runs `node.move` unless the object is
|
||||
already in the place it names. `duplicate` runs `edit.duplicate`, and with a relative object it then runs `node.move`
|
||||
on the copy the same way; without one, the copy stays where `edit.duplicate` puts it. The relative object is a page item or a layer of the same
|
||||
document; `ElementPlacement.INSIDE` and `PLACEATBEGINNING` (the default) put the object on top of a layer's or a
|
||||
group's contents, `PLACEATEND` under them, `PLACEBEFORE` directly above the relative object and `PLACEAFTER`
|
||||
directly below it. A move that leaves the object where it is runs no command. The clipping path of a clip group or clipping layer stays at its bottom: `PLACEATEND` puts the
|
||||
document; `ElementPlacement.INSIDE` and `PLACEATBEGINNING` (the default) put the object on top of a layer's, a
|
||||
group's or a compound path's contents, `PLACEATEND` under them (a compound path takes only paths), `PLACEBEFORE`
|
||||
directly above the relative object and `PLACEAFTER` directly below it. A move that leaves the object where it is runs no command. The clipping path of a clip group or clipping layer stays at its bottom: `PLACEATEND` puts the
|
||||
object directly above the clipping path, and `PLACEAFTER` with the clipping path as the relative object throws
|
||||
`an object cannot go below a clipping mask` and moves or copies nothing (VectorCraft's own rule). The one exception
|
||||
is `mask.move(mask, ElementPlacement.PLACEAFTER)` on the clipping path itself, which succeeds and leaves the
|
||||
@@ -3215,10 +3215,12 @@ through `$`:
|
||||
a position only (VectorCraft's own rule). `JSON.stringify` does not read `toJSON` from a collection this way. `name` and `note`
|
||||
take a number or a Boolean as the text `String(value)` gives. `String(object)` gives
|
||||
`[PathItem Logo]` for a page item named `Logo` (`[PathItem ]` with no name), `[Document <name>]`,
|
||||
`[Layer <name>]`, `[Application]` and `[PageItems]` (VectorCraft's own rule).
|
||||
`[Layer <name>]`, `[Artboard <name>]`, `[Application]`, `[PageItems]`, `[Layers]`, `[GroupItems]`,
|
||||
`[CompoundPathItems]` and `[Artboards]` (VectorCraft's own rule).
|
||||
`documents[0]` is always the active document, as the same page says. VectorCraft's own rules: the other
|
||||
documents follow from the one active most recently to the one active longest ago, and a change a script
|
||||
makes to a document in the back does not move it in the list; page items are listed with the objects inside groups and compound paths after their group and without layers and ruler guides. A document's
|
||||
makes to a document in the back does not move it in the list; page items are listed with the objects inside groups and compound paths after their group and without layers and ruler guides (the layers
|
||||
paragraph below gives the order of a layer's, a group's and a compound path's lists). A document's
|
||||
`selection`, and `app.selection` while a document is open, is an empty list when nothing is selected. Script coordinates
|
||||
are points with Y up from the bottom-left corner of the first artboard, or, with
|
||||
`CoordinateSystem.ARTBOARDCOORDINATESYSTEM`, Y down from the top-left corner of the active artboard. `typename`
|
||||
@@ -3228,7 +3230,12 @@ through `$`:
|
||||
tab as it was. A command that selects the objects it changes leaves the current layer and the highlighted Layers
|
||||
panel rows as they were before the change. A bad value throws an error and changes nothing. An object that was
|
||||
deleted, that a named engine kept from an earlier run, or whose document was reverted with `file.revert`, throws
|
||||
`Stale page item`. Layer objects also become stale after their document is reverted. `remove()` on an object that
|
||||
`Stale page item`. Layer objects also become stale after their document is reverted, and so do the `pageItems`,
|
||||
`groupItems` and `compoundPathItems` of a layer or group, the `pathItems` of a compound path (`Stale page item`)
|
||||
and `Artboard` objects (`Stale artboard`); the document's own collections list the reverted document.
|
||||
`removeAll()` on a layer's or group's `pageItems`, `groupItems` or `compoundPathItems`, or on the document's
|
||||
`groupItems` or `compoundPathItems`, throws and deletes nothing when it would delete the clipping path of a group
|
||||
or layer that keeps other objects. `remove()` on an object that
|
||||
is hidden or locked, is inside a hidden or locked layer or group, or is a group that holds one, and `removeAll()`
|
||||
when any object is, throw `cannot delete hidden or locked objects` and delete nothing. `remove()` on an object on
|
||||
a locked artboard, and `removeAll()` when any object is on one, throw `cannot delete objects on a locked artboard`
|
||||
@@ -3248,7 +3255,7 @@ through `$`:
|
||||
`..`, a network path, a NUL character or more than 4,096 bytes throws an error. `app.redraw()` returns `undefined`
|
||||
and does not change the documents or add an undo step. In the app, the documents are drawn as they were before the
|
||||
run until the run ends, with or without the call. Some members the Application,
|
||||
Document and PageItem pages list, such as `Document.layers`, `PageItem.isIsolated`, `PageItem.bringInPerspective` and
|
||||
Document and PageItem pages list, such as `Document.swatches`, `PageItem.isIsolated`, `PageItem.bringInPerspective` and
|
||||
`app.beep`, throw an error that says they are not available yet when they are read or assigned.
|
||||
`hasOwnProperty` and `propertyIsEnumerable` are false for those members and true for every other member of an
|
||||
object's class, so `item.hasOwnProperty("opacity")` is true on a page item, and `for (k in item)` lists the
|
||||
@@ -3258,6 +3265,86 @@ through `$`:
|
||||
strict-mode code, which throws a `TypeError`. On a collection it throws `Not found`, except for the text of a number that is not an array index, as described above. Other members
|
||||
those pages list, such as `app.version` and `Document.save()`, and the members of the pages of the page-item kinds
|
||||
themselves that this page does not describe are not defined yet and read as `undefined`.
|
||||
- A document also has `layers`, `activeLayer`, `groupItems`, `compoundPathItems` and `artboards`.
|
||||
`layers` (https://ai-scripting.docsforadobe.dev/jsobjref/Layers/) and a layer's own `layers` have `length`, `[i]`,
|
||||
`index(key)`, `getByName(name)`, `add()` and `removeAll()`. On the document, `add()` runs `layer.new` and makes a
|
||||
layer above every top-level layer; on a layer it runs `layer.newSublayer` and makes a sublayer on top of that
|
||||
layer's contents. The new layer becomes the current one. `removeAll()` runs `layer.delete`; on the document's
|
||||
layers it throws, since a document keeps at least one layer. Assigning a layer to `activeLayer` runs
|
||||
`layer.setCurrent`. A `Layer` (https://ai-scripting.docsforadobe.dev/jsobjref/Layer/) has `typename`, `name`,
|
||||
`visible`, `locked`, `printable`, `preview`, `dimPlacedImages`, `opacity` (0 to 100), `color`, `parent`,
|
||||
`layers`, `pageItems`, `groupItems`, `compoundPathItems`, `zOrderPosition`, `hasSelectedArtwork`, `isIsolated`,
|
||||
`move(relativeObject, insertionLocation?)`, `remove()` and `zOrder(method)`. Its properties run
|
||||
`layer.setProps`, and `opacity` runs `object.setProps`. `move` and `zOrder` run `node.move`; a layer goes into
|
||||
another layer, to the top level of the document, or directly above or below another layer. Every page item has
|
||||
`layer`, the layer it is in. A `GroupItem` (https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/) also has
|
||||
`clipped`, `pageItems`, `groupItems` and `compoundPathItems`, and a `CompoundPathItem`
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItem/) has `pathItems`. `groupItems`
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/GroupItems/) and `compoundPathItems` have `length`, `[i]`,
|
||||
`index(key)`, `getByName(name)`, `add()` and `removeAll()`. `groupItems.add()` runs `object.newGroup`.
|
||||
`clipped` runs `layer.clippingMask.toggle`. `artboards` (https://ai-scripting.docsforadobe.dev/jsobjref/Artboards/)
|
||||
has `length`, `[i]`, `index(key)`, `getByName(name)`, `add(artboardRect)` (runs `artboard.new` and returns
|
||||
the new artboard), `insert(artboardRect, index)` (runs `artboard.new` and `artboard.reorder`, returns nothing;
|
||||
read `artboards[index]` afterward), `remove(index)` (runs
|
||||
`artboard.delete`), `getActiveArtboardIndex()` and `setActiveArtboardIndex(index)`. An `Artboard`
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/Artboard/) has `typename`, `parent`, `artboardRect`, `name`,
|
||||
`rulerOrigin`, `rulerPAR` (0.1 to 10), `showCenter`, `showCrossHairs`, `showSafeAreas` and `remove()`; its
|
||||
properties run `artboard.setProps`, and `rulerOrigin` runs `document.setRulerOrigin`. One document always keeps
|
||||
one artboard.
|
||||
VectorCraft's own rules: `layers` lists layers top first, as the Layers panel shows them. A layer's or group's
|
||||
`pageItems`, `groupItems` and `compoundPathItems`, and a compound path's `pathItems`, list the objects directly in
|
||||
it, topmost first. The document's `groupItems` and `compoundPathItems` hold every group or compound path at any
|
||||
depth, in the order of the document's `pageItems`. A layer's `pageItems` leave out its sublayers, and a compound
|
||||
path's `pathItems` are `PathItems` objects with `length`, `[i]`, `index`, `getByName`, `removeAll` and string conversion.
|
||||
Their path creation methods throw an error; a script can move existing paths into the compound path.
|
||||
Scoped collections support `toString()` and `String()`. For `Layers`, `GroupItems`, `CompoundPathItems` and
|
||||
`Artboards`, the conversion throws the same error as `typename` once the container is deleted or the document is
|
||||
closed. A layer's or artboard's `name` takes a number or a boolean as
|
||||
`String()` writes it. `locked` true means the layer is locked. `color` is an `RGBColor` object with `typename` and `{red, green, blue}` of whole
|
||||
numbers from 0 to 255. A layer's name is from 1 to 512 characters. A layer's `zOrderPosition` counts the layers
|
||||
beside it from 1 at the bottom, leaving out art; each scan counts toward the script's operation budget.
|
||||
`zOrder` with `BRINGFORWARD` or `SENDBACKWARD` moves it past
|
||||
the next layer beside it and any art between them.
|
||||
`hasSelectedArtwork = true` adds the layer's shown, unlocked art to the selection (`select.add`), and `false`
|
||||
deselects only the layer's art (`select.toggle`); the rest of the selection, ruler guides included, stays. A layer
|
||||
with nothing to add or deselect runs no command. Each assignment counts the current selection toward the script's
|
||||
operation budget, and `true` also counts every node of the layer it looks at, hidden and locked ones included.
|
||||
`clipped = true` makes the group's topmost object, which must be a path, a compound path or type, its clipping
|
||||
path; `false` releases the mask; the group keeps its id. Changes are refused when the group or its layer is
|
||||
hidden or locked, or its artboard is locked. A scoped `removeAll()` that leaves a clipping group or layer
|
||||
without art releases its mask in the same undo step. `groupItems.add()` makes an empty group on top of the
|
||||
layer's or group's contents, or of the current layer's for the document's collection, and `compoundPathItems.add()`
|
||||
makes an empty compound path in the same place
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItems/). A path that `move` or `duplicate` puts into a
|
||||
compound path becomes one of its paths and gives up its own paint, as Make Compound Path leaves its paths. The
|
||||
compound path becomes pixel-aligned when the path was, or when the compound path it leaves was. A path moved
|
||||
into an already pixel-aligned compound path is snapped to the pixel grid. An empty
|
||||
compound path takes the paint the first path that goes in was drawn with: the path's own, or the paint of the
|
||||
compound path it leaves. Other objects are refused. A path that `move` takes out of a compound path into a layer or
|
||||
a group takes the compound path's paint and pixel alignment, as Release Compound Path gives them to its paths.
|
||||
`artboards.add` and `insert` stop at 100 artboards in a document, the limit `Documents.add` uses. An artboard's rectangle is
|
||||
`[left, top, right, bottom]` in script coordinates, with its right side right of its left side, its bottom below
|
||||
its top, each side from 1 to 3,999,856 points and every edge at most 4,000,000 points from the document origin.
|
||||
Artboard names are trimmed, an empty name gives the artboard its default name (`Artboard N` for the Nth artboard),
|
||||
and two artboards may have the same name. `add` and `insert` name the new artboard `Artboard N`, with N the first number from one past the artboard count that no other artboard's
|
||||
name uses. `rulerOrigin` is `[x, y]` from the artboard's top-left corner with Y down.
|
||||
`setActiveArtboardIndex` changes the view's active artboard with no undo step, and `script.run`'s report lists the
|
||||
change in `activeArtboards` (`[{document, artboard}]`, both indexes, with each document's active artboard as the
|
||||
run leaves it). The report also lists a document whose active artboard has another index when the run ends because
|
||||
artboards were inserted, removed or reordered before it. An index outside the list throws a
|
||||
`RangeError`. A layer that was deleted throws `Stale layer`, and an artboard that was deleted throws
|
||||
`Stale artboard`. `Layer.pathItems`, `blendingMode`, `artworkKnockout` and `sliced`, `GroupItem.pathItems` and
|
||||
`GroupItems.createFromFile` throw an error that says they are not available yet.
|
||||
- `object.newGroup {parent?, index?, compound?}` adds an empty group to a shown, unlocked layer or group (`parent`;
|
||||
default: the current layer), on top of its contents or at `index` (0 is the bottom; in a clipping layer or group,
|
||||
index 0 puts it directly above the clipping path), as one undo step named Group, and
|
||||
gives `{id}`. With `compound: true` it adds an empty compound path instead, as one undo step named Compound Path.
|
||||
An omitted key takes its default (`parent`: the current layer; `index`: on top; `compound`: false).
|
||||
Explicit `null` is refused for `parent`, `index` and `compound`.
|
||||
The selection stays as it is. `node.move` also puts a path into a shown, unlocked compound path, where the path
|
||||
gives up its own paint (a clip group's or clipping layer's clipping path is refused until its mask is released), and an empty compound path takes the paint the first path that goes in was drawn with. A
|
||||
path that `node.move` takes out of a compound path into a layer or a group takes the compound path's paint and pixel
|
||||
alignment.
|
||||
- `app.preferences` (https://ai-scripting.docsforadobe.dev/jsobjref/Preferences/) has `getBooleanPreference(key)`,
|
||||
`getIntegerPreference(key)`, `getRealPreference(key)`, `getStringPreference(key)`, the four matching `set…(key,
|
||||
value)` and `removePreference(key)`. The key `ShowExternalJSXWarning` is the preference `showExternalScriptWarning`.
|
||||
@@ -3786,9 +3873,13 @@ through `$`:
|
||||
app passes the Actions panel's actions with their included steps, and a recorded `command.batch` step gives its own
|
||||
steps. 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, Select › All on Active Artboard, Edit Symbol, Fit to Artwork Bounds and Fit to
|
||||
Selected Art) and does not name one acts on the active document's active artboard, by the index it had as the run
|
||||
started, which the view keeps: after the script deletes artboards, the artboard now at that index, or the last one
|
||||
past the end. While the Artboard tool has several artboards selected as the run starts, a paste step and a Fit to
|
||||
Selected Art) and does not name one acts on the active document's active artboard. Once the script has called
|
||||
`setActiveArtboardIndex` on that document, it is the artboard the script chose while that artboard exists. If it
|
||||
has been deleted, playback uses the same fallback as `getActiveArtboardIndex()`, script coordinates and the view:
|
||||
the saved active artboard if it still exists, otherwise index 0. File > Revert discards the script's stored choice.
|
||||
If the script has not chosen an artboard on that document since its last revert, the step uses the index of its active artboard
|
||||
as the run started: after the script deletes artboards, the artboard now at that index, or the last one past the
|
||||
end. While the Artboard tool has several artboards selected as the run starts, a paste step and a Fit to
|
||||
Artwork Bounds step act on those instead, as in the panel's playback. A step of a recorded `command.batch` step that
|
||||
names its `artboard` acts on that artboard, or the last one past the end, as `command.batch` gives it. VectorCraft's
|
||||
own rules: the action and its set are matched by their exact names, and a name that matches no action or more than
|
||||
@@ -4880,6 +4971,7 @@ With `ids`, `guides: true` also deletes the selected ruler guides. The command r
|
||||
boolean or `null`. A compound path left with no paths is deleted too, unless `keepEmpty: true` is given, which keeps
|
||||
it, empty, also when the deleted parts are direct-selected anchors; a `keepEmpty` value that is not a boolean or `null`
|
||||
is rejected. `null` for `guides`, `keepEmpty` or `keepJoined` counts as leaving the key out.
|
||||
A clipping group or layer left without art releases its mask in the same undo step.
|
||||
Without `ids`, `keepJoined: true` removes the direct-selected anchors of each path that has no selected segment as
|
||||
`path.removeAnchors` does (see Removing anchor points): the path stays joined, and the next anchor along is selected
|
||||
(the one before at an open path's end). When no subpath that lost an anchor keeps two anchors, the path stays selected
|
||||
@@ -8165,7 +8257,8 @@ and `layerRows`, the rows highlighted in the panel.
|
||||
bottom layer's into the empty space under the list) places them, unless objects are copied with a top-level layer
|
||||
that is the target, which would put them inside it (#8237). Dragging the
|
||||
selected-art square is `layer.move` with the selected objects. `node.move {id, parent?, index}` is the low-level
|
||||
form with the same nesting rules; unlike `layer.move`, it also moves a row into a locked layer or group. A row that
|
||||
form with the same nesting rules; unlike `layer.move`, it also moves a row into a locked layer or group, and it puts
|
||||
a path into a shown, unlocked compound path (see `object.newGroup` for the paint the path keeps or takes). A row that
|
||||
either command puts into a Live Paint group from elsewhere (inside it, or above or below one of its rows) joins the
|
||||
group's paths as `livePaint.merge` adds them, in one "Merge Live Paint" undo step, and the group is selected and
|
||||
listed in `layer.move`'s `ids` in its place; paths, compound paths, groups of them and Live Paint groups can join,
|
||||
|
||||
@@ -1125,16 +1125,17 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- Scripts: `document.characterStyles` and `document.paragraphStyles` add, find, rename, redefine, apply and remove character and paragraph styles, with the Normal styles listed first and kept, and a text range lists the styles its text is in, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/CharacterStyles/, https://ai-scripting.docsforadobe.dev/jsobjref/CharacterStyle/, https://ai-scripting.docsforadobe.dev/jsobjref/ParagraphStyles/, https://ai-scripting.docsforadobe.dev/jsobjref/ParagraphStyle/ and https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ describe them (`docs/mcp.md`). Style names of 1 to 256 characters without control characters, and at most 4,096 styles named in one run, are VectorCraft's own rules. Load Character Styles, Load Paragraph Styles and Load All Styles refuse a file larger than 64 MB. A paragraph style's character attributes are not there yet. `crates/engine/src/tests/script_styles.rs`.
|
||||
- Scripts: a text frame's `nextFrame` and `previousFrame` read and set its links to the frames before and after it, `areaText` and `pathText` thread a new frame to a base frame, and `document.stories` lists the stories, each with its frames in thread order and its text across them as one text range with its characters, words and paragraphs, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItem/, https://ai-scripting.docsforadobe.dev/jsobjref/Story/ and https://ai-scripting.docsforadobe.dev/jsobjref/Stories/ describe them; `text.thread.setNeighbor` links or unlinks two frames by id (`docs/mcp.md`). Which links are refused, and how a story is listed and found, are VectorCraft's own rules. `crates/engine/src/tests/script_threads.rs`.
|
||||
- Scripts: `PageItem.tags` reads, adds, renames and deletes an object's tags, name and value pairs that the native file keeps, and `Document.tags` reads, renames and deletes the tags of every page item but adds none (its `add` throws; a script adds a tag through the page item's `tags`), as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Tags/ and https://ai-scripting.docsforadobe.dev/jsobjref/Tag/ describe them, through `object.tags` and the `object.tag.*` commands, at most 64 tags an object (`docs/mcp.md`). `crates/engine/src/tests/script_tags.rs`.
|
||||
- Scripts: a document's layers and sublayers with their options, stacking and current layer, its groups and compound paths with clipping masks, new empty groups and compound paths and paths moved into compound paths, and its artboards with their rectangles, names, ruler origins and display options, added, inserted, removed and made active, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Layer/, https://ai-scripting.docsforadobe.dev/jsobjref/Layers/, https://ai-scripting.docsforadobe.dev/jsobjref/GroupItems/, https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItems/, https://ai-scripting.docsforadobe.dev/jsobjref/Artboard/ and https://ai-scripting.docsforadobe.dev/jsobjref/Artboards/ describe them (`docs/mcp.md`); `artboards.add` returns the new artboard and `artboards.insert` returns nothing. Scoped collections support string conversion, which fails for `Layers`, `GroupItems`, `CompoundPathItems` and `Artboards` once their container is gone; compound paths expose `PathItems` objects and reject unsupported path creation. Empty clipping containers release their masks in the deletion's undo step, and `clipped` changes check locks. Layer selection changes keep unrelated selected objects, layer colors are assignable `RGBColor` values, stacking scans count toward the script budget, and paths moved into pixel-aligned compound paths are snapped. `crates/engine/src/tests/script_dom.rs`, `crates/ui-egui/src/tests/script_run.rs`.
|
||||
- Scripts: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets (`docs/mcp.md`); `CUSTOMPROFILE` without a profile `name` throws. `crates/engine/src/tests/script_print.rs`.
|
||||
- Scripts: `Document.exportFile` with `ExportType.AutoCAD` writes a DXF file with the `ExportOptionsAutoCAD` options and the AutoCAD enumerations that https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsAutoCAD/ and https://ai-scripting.docsforadobe.dev/jsobjref/scripting-constants/ describe; DWG throws an error that says it is not available (`docs/mcp.md`). `crates/engine/src/tests/script_save_open.rs`.
|
||||
- Scripts: `Document.print` without a file prints to the printer `PrintOptions.printerName` names, or the default printer, and `app.printerList` lists the installed printers as `Printer` objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/Application/ and https://ai-scripting.docsforadobe.dev/jsobjref/Printer/ describe. VectorCraft's own rules: the jobs are sent after the run's changes are kept and the person at the keyboard clicks Print or presses Space on it, which takes no click or focus for the first second, nothing is sent from a failed run, and the web build, and MCP or the command line without the app, cannot print to a printer from a script (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`, `crates/ui-egui/src/tests/script_print.rs`.
|
||||
- Scripts: `Document.saveAs`, `Document.exportFile` and `app.open` save, export and open documents, `Document.fullName` and `saved` give a document's file and saved state, setting `saved` records that state (`document.setSaved`), `Document.path` gives its folder as a `Folder` (VectorCraft's own type), and `Document.close` closes it, saving to its file first with `SaveOptions.SAVECHANGES`, with the option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/IllustratorSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/EPSSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/PDFSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsPNG24/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsJPEG/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsSVG/, https://ai-scripting.docsforadobe.dev/jsobjref/PDFFileOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/Document/ describe (the enumerations of the options that keep their defaults included), and read and write only where the script's `File` objects may, refusing a path whose real file name is not valid UTF-8; the warnings of each save, export and open go to the console (`docs/mcp.md`). `crates/engine/src/tests/script_save_open.rs`.
|
||||
- Scripts: the global `app` gives the open documents, new documents from a startup preset and a `DocumentPreset`, the active document, each document's selection and its page items with their names, notes, visibility, lock, opacity, position, size, bounds and stacking order, and moves and copies them into or beside other objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Application/, https://ai-scripting.docsforadobe.dev/jsobjref/Documents/, https://ai-scripting.docsforadobe.dev/jsobjref/DocumentPreset/, https://ai-scripting.docsforadobe.dev/jsobjref/Document/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItem/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ describe them; each change runs a command inside the run's transaction (`docs/mcp.md`). A script can check a member with `hasOwnProperty`, and can read a collection by name and name `activeDocument`, `documents` and `selection` without `app.` (https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/). A key such as `1` is an array index and reads that position; in `pageItems` and `documents`, a number that is not an array index, such as `-1` or `1.5`, is looked up by name when the key is the text JavaScript writes for that number. VectorCraft's own rule. `app.executeMenuCommand` runs the menu items Select All, Deselect, Group, Ungroup, Make and Release Clipping Mask, Make and Release Compound Path, and Fit to Artwork Bounds by their menu command names (https://community.adobe.com/questions-652/a-list-of-illustrator-menu-commands-we-can-call-from-javascript-769510, https://gist.github.com/shalakolee/df3246659d4289eb99149b9ed00a00ee). The `parent` of a page item at the top of a layer is a `Layer` with `name`, `typename` and `toString`. A page item's `blendingMode` reads and sets its blend mode with the `BlendModes` values (https://ai-scripting.docsforadobe.dev/jsobjref/scripting-constants/).
|
||||
`Document.views` lists the document's drawn windows with their bounds, center, zoom and screen mode (https://ai-scripting.docsforadobe.dev/jsobjref/View/). Zoom follows each window's displayed percentage, including display density with Display Print Size at 100% Zoom enabled; bounds retain the physical camera scale. View objects keep their targets when windows are renumbered. View changes run no command, add no undo step, and remain when a script fails. A center outside the canvas after coordinate conversion throws a `RangeError`. `Document.layers`, `Document.activeLayer` and the other classes this list does not name are not there yet. `crates/engine/src/tests/script_dom.rs`.
|
||||
`Document.views` lists the document's drawn windows with their bounds, center, zoom and screen mode (https://ai-scripting.docsforadobe.dev/jsobjref/View/). Zoom follows each window's displayed percentage, including display density with Display Print Size at 100% Zoom enabled; bounds retain the physical camera scale. View objects keep their targets when windows are renumbered. View changes run no command, add no undo step, and remain when a script fails. A center outside the canvas after coordinate conversion throws a `RangeError`. Type and the other classes are not there yet. `crates/engine/src/tests/script_dom.rs`.
|
||||
- Scripts: `app.redraw()` (https://ai-scripting.docsforadobe.dev/jsobjref/Application/) returns without changing the documents or adding an undo step; the app goes on drawing the documents as they were before the run until the run ends. VectorCraft's own rule. `crates/engine/src/tests/script_dom.rs`.
|
||||
- Scripts: a document's variables and data sets, the variables its page items are bound to, Lock Variables, and importing and exporting a variable library through a `File`, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Variables/, https://ai-scripting.docsforadobe.dev/jsobjref/Variable/, https://ai-scripting.docsforadobe.dev/jsobjref/Datasets/ and https://ai-scripting.docsforadobe.dev/jsobjref/Dataset/ describe them; `variable.setBinding` binds one object for one slot, and `dataset.update {name}` updates a data set that is not the active one (`docs/mcp.md`). `crates/engine/src/tests/script_variables.rs`.
|
||||
- Scripts: `app.selectTool(name)` makes the named tool the current tool when the run ends without an error (https://community.adobe.com/questions-652/what-s-new-in-illustrator-scripting-cc2020-769942). `crates/engine/src/tests/script_dom.rs`.
|
||||
- Scripts: `app.doScript(action, set, dialogs?)` plays an action of the Actions panel inside the run, as the `DoScript` method of the scripting reference https://web.archive.org/web/20170621180804/https://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2015_3/Illustrator%20VBScript%20Reference.pdf describes it: its steps join the run's one undo step and keep the script's file limits, and a stop or a step a script may not run, or that plays an action or runs a script, is refused before any step runs (`docs/mcp.md`). `app.loadAction` and `app.unloadAction` are not there yet. `crates/engine/src/tests/script_actions.rs`.
|
||||
- Scripts: `app.doScript(action, set, dialogs?)` plays an action of the Actions panel inside the run, as the `DoScript` method of the scripting reference https://web.archive.org/web/20170621180804/https://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2015_3/Illustrator%20VBScript%20Reference.pdf describes it: its steps join the run's one undo step and keep the script's file limits, and a stop or a step a script may not run, or that plays an action or runs a script, is refused before any step runs (`docs/mcp.md`). After deletion of an artboard chosen by the script, playback uses the same fallback as script coordinates, `getActiveArtboardIndex()` and the view; File > Revert discards that stored choice. `app.loadAction` and `app.unloadAction` are not there yet. `crates/engine/src/tests/script_actions.rs`.
|
||||
- Scripts: Window › Script Console shows each run's `$.write` and `$.writeln` output, `vc.log` entries, uncaught error with the script's name, line and column, and a report of its time, host calls and slowest commands, keeping at most 2,048 lines and counting the lines it dropped. `script.run`'s report carries the same data, and `script.console`, `script.console.clear` and `ui.copyScriptConsole` read, clear and copy it. `crates/engine/src/tests/script_console.rs`.
|
||||
- Scripts: the status bar translates its own words around a failed run's error and the app's own error messages, and shows text the script threw itself (a value, an error it made, or an error whose name or message it changed) as it is, even when that text reads like one of the app's messages. `script.run`'s report gives `messageOrigin` (`script` or `built-in`), and the advice about objects other applications give their scripts follows only the app's own reference errors. VectorCraft's own rule. `crates/js/src/interp_tests.rs`, `crates/engine/src/tests/script_run.rs`, `crates/ui-egui/src/chrome/tests.rs`.
|
||||
- Scripts: the warning before File › Scripts › Other Script… runs a script lists what `script.check` finds the script reaches outside the document (files it writes, moves or deletes, other apps, the network, native code, environment variables, preferences, code the checker can't read), the files and dialogs it needs, features only the reference app has and its included files, read without running it. It says when the script is too large to check, compiled, not a script or not read, and when a list was cut short. VectorCraft's own rule. `crates/ui-egui/src/tests/script_run.rs`.
|
||||
|
||||
Reference in new issue
Block a user