diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rs index 27d5d58336..5f83152beb 100644 --- a/crates/engine/src/cmd/layer.rs +++ b/crates/engine/src/cmd/layer.rs @@ -120,7 +120,7 @@ pub fn specs() -> Vec { "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; a path also in a shown, unlocked compound path, and an empty compound path takes the paint of the first path that goes in; 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 also goes into a shown, unlocked compound path and gives up its own paint, 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 ), @@ -930,8 +930,15 @@ fn move_node(s: &mut Session, p: &Value) -> Result { } 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. - let paint = compound.filter(|c| c.children().is_some_and(Vec::is_empty)).map(|c| (c.id, n.appearance.clone())); + // 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); + // 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"))); } @@ -946,6 +953,30 @@ fn move_node(s: &mut Session, p: &Value) -> Result { { 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. + if let Some(c) = into { + let mut aligned = false; + 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); diff --git a/crates/engine/src/cmd/object/arrange.rs b/crates/engine/src/cmd/object/arrange.rs index bd770334e8..36b3cef6fe 100644 --- a/crates/engine/src/cmd/object/arrange.rs +++ b/crates/engine/src/cmd/object/arrange.rs @@ -131,8 +131,8 @@ pub(super) fn new_group(s: &mut Session, p: &Value) -> Result { if !d.is_editable(parent) { return Err(bad(C, "the layer or group is hidden or locked")); } - let name = if compound { "Compound Path" } else { "Group" }; - let gid = s.edit(name, |d, _| { + 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 }; diff --git a/crates/engine/src/script/dom.rs b/crates/engine/src/script/dom.rs index c8741952d4..1aeb8d333a 100644 --- a/crates/engine/src/script/dom.rs +++ b/crates/engine/src/script/dom.rs @@ -14,9 +14,11 @@ //! not the active one makes it active for the command and makes the other one active again after. //! //! VectorCraft's own rules, which the help pages do not state: -//! - Collections list documents in tab order and art in paint order (bottom first), counted from 0. -//! `pageItems` lists every object, with the objects inside groups and compound paths after the -//! group or compound path, and leaves out layers and ruler guides. An index out of range gives +//! - Collections list documents in tab order and the document's art in paint order (bottom first), +//! counted from 0; the `layers` module gives the order of a layer's, a group's and a compound +//! path's lists. The document's `pageItems` lists every object, with the objects inside groups +//! and compound paths after the group or compound path, and leaves out layers and ruler guides. +//! An index out of range gives //! `undefined`; `index` and `getByName` throw `Not found` when nothing matches. //! - Script coordinates are points with Y up from the bottom of the first artboard //! (`DOCUMENTCOORDINATESYSTEM`, the default) or points with Y down from the top-left corner of diff --git a/crates/engine/src/script/dom/layers.rs b/crates/engine/src/script/dom/layers.rs index 15171be00d..3fafaf684b 100644 --- a/crates/engine/src/script/dom/layers.rs +++ b/crates/engine/src/script/dom/layers.rs @@ -13,8 +13,8 @@ //! VectorCraft's own rules, which the help pages do not state: //! - `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`. +//! 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`. //! - `layers.add()` on the document makes a layer above every top-level layer; on a layer it makes //! a sublayer on top of that layer's contents. The new layer becomes the current one. //! - `locked` true means the layer is locked. @@ -587,9 +587,9 @@ pub(super) type ArtList = (u64, Arc, u8, Option, Rc) -> Result>> { { let mut lists = h.dom.art.borrow_mut(); @@ -1048,23 +1048,21 @@ fn board_name(h: &Host, a: &[Data]) -> Answer { read_board(h, a, |_, ab, _| Ok(text(ab.name.clone()))) } -/// A new artboard name: not empty and at most [`MAX_TEXT_BYTES`] bytes; a number or boolean as -/// `String()` writes it. Another artboard may have the same name. → the name, trimmed as -/// `artboard.rename` trims it. -fn board_name_arg(d: &Data) -> Result { +/// A new artboard name: at most [`MAX_TEXT_BYTES`] bytes; a number or boolean as `String()` writes +/// it. Another artboard may have the same name. → the name, trimmed as `artboard.setProps` trims +/// it; an empty one gives the artboard its default name, `Artboard N` for the Nth artboard. +fn board_name_arg(d: &Data, index: usize) -> Result { let name = name_text(d)?; if name.len() > MAX_TEXT_BYTES { return Err(HostError::Range("the name is too long".into())); } let name = name.trim(); - if name.is_empty() { - return Err(HostError::Range("an artboard's name cannot be empty".into())); - } - Ok(name.to_string()) + Ok(if name.is_empty() { format!("Artboard {}", index + 1) } else { name.to_string() }) } fn board_set_name(h: &Host, a: &[Data]) -> Answer { - let name = board_name_arg(arg(a, 1))?; + let (_, i) = this_board(h, a)?; + let name = board_name_arg(arg(a, 1), i)?; set_board(h, a, |ab| ab.name == name, json!({"name": &name})) } diff --git a/crates/engine/src/tests/script_dom.rs b/crates/engine/src/tests/script_dom.rs index 4fe40ddad2..e3d0a46807 100644 --- a/crates/engine/src/tests/script_dom.rs +++ b/crates/engine/src/tests/script_dom.rs @@ -1616,7 +1616,7 @@ fn compound_path_items_add_makes_an_empty_compound_path_that_takes_paths() { for src in [ "var d = app.activeDocument, g = d.groupItems.add(); g.move(d.compoundPathItems.getByName('C'));", "var d = app.activeDocument, g = d.groupItems.add(); g.move(d.compoundPathItems.getByName('C').pathItems[0], ElementPlacement.PLACEBEFORE);", - "app.activeDocument.compoundPathItems.add('x').move(app.activeDocument.compoundPathItems.getByName('C'));", + "app.activeDocument.compoundPathItems.add().move(app.activeDocument.compoundPathItems.getByName('C'));", ] { assert!(failure(&mut s, src).contains("only paths"), "{src}"); } @@ -1624,6 +1624,146 @@ fn compound_path_items_add_makes_an_empty_compound_path_that_takes_paths() { assert!(s.execute("object.newGroup", &json!({"compound": 1})).unwrap_err().to_string().contains("true or false")); } +/// The paint of a compound path's only path is the compound path's: moved into an empty compound +/// path, the path gives it that paint, not its own default one. +#[test] +fn a_path_moved_out_of_a_compound_path_gives_an_empty_one_the_paint_it_was_drawn_with() { + let (mut s, a, _) = doc(); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + let red = s.active().unwrap().doc.node(a).unwrap().appearance.clone(); + s.execute("object.compoundPath.make", &json!({})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let out = log( + &mut s, + "var d = app.activeDocument, old = d.compoundPathItems[0], c = d.compoundPathItems.add(); c.name = 'C';\ + old.pathItems[0].move(c); vc.log(d.compoundPathItems.getByName('C').pathItems.length);", + ); + assert_eq!(out, [json!(1)]); + let d = &s.active().unwrap().doc; + let c = d.parent_of(a).and_then(|p| d.node(p)).unwrap(); + assert_eq!(c.name.as_deref(), Some("C")); + assert_eq!(c.appearance, red); + assert_ne!(d.node(a).unwrap().appearance, red); +} + +/// `node.move` into a compound path leaves the path without paint or pixel alignment of its own, +/// as Make Compound Path leaves its paths, and the compound path takes the alignment. +#[test] +fn node_move_into_a_compound_path_clears_the_paths_own_paint() { + let (mut s, a, b) = doc(); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + s.execute("object.compoundPath.make", &json!({})).unwrap(); + let cid = s.active().unwrap().doc.parent_of(a).unwrap(); + s.execute("select.set", &json!({"ids": [b.0]})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#00ff00"})).unwrap(); + s.execute("object.setPixelAligned", &json!({"on": true})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let painted = s.active().unwrap().doc.node(b).unwrap().appearance.clone(); + let member = s.active().unwrap().doc.node(a).unwrap().appearance.clone(); + let steps = undo_steps(&s); + s.execute("node.move", &json!({"id": b.0, "parent": cid.0, "index": 1})).unwrap(); + assert_eq!(undo_steps(&s), steps + 1); + let d = &s.active().unwrap().doc; + assert_eq!(d.parent_of(b), Some(cid)); + let n = d.node(b).unwrap(); + assert_ne!(n.appearance, painted); + assert_eq!(n.appearance, member); + assert!(!n.extras().pixel_aligned); + assert!(d.node(cid).unwrap().extras().pixel_aligned); +} + +#[test] +fn node_move_refuses_a_guide_and_a_locked_or_hidden_compound_path() { + let (mut s, a, b) = doc(); + let cid = NodeId(s.execute("object.newGroup", &json!({"compound": true})).unwrap()["id"].as_u64().unwrap()); + assert!(matches!(s.active().unwrap().doc.node(cid).unwrap().kind, NodeKind::Compound { .. })); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + s.execute("view.guides.make", &json!({})).unwrap(); + let before = format!("{:?}", s.active().unwrap().doc.layers); + let err = s.execute("node.move", &json!({"id": a.0, "parent": cid.0, "index": 0})).unwrap_err().to_string(); + assert!(err.contains("only paths"), "{err}"); + for hide in ["object.lock", "object.hide"] { + s.execute("select.set", &json!({"ids": [cid.0]})).unwrap(); + s.execute(hide, &json!({})).unwrap(); + let before = format!("{:?}", s.active().unwrap().doc.layers); + let err = s.execute("node.move", &json!({"id": b.0, "parent": cid.0, "index": 0})).unwrap_err().to_string(); + assert!(err.contains("hidden or locked"), "{hide}: {err}"); + assert_eq!(format!("{:?}", s.active().unwrap().doc.layers), before); + s.execute("edit.undo", &json!({})).unwrap(); + } + assert_eq!(format!("{:?}", s.active().unwrap().doc.layers), before); +} + +/// `duplicate(compoundPath)` puts the copy into the compound path; an empty one takes its paint. +#[test] +fn a_path_duplicated_into_an_empty_compound_path_becomes_its_path() { + let (mut s, a, _) = doc(); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#0000ff"})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let blue = s.active().unwrap().doc.node(a).unwrap().appearance.clone(); + let out = log( + &mut s, + "var d = app.activeDocument, c = d.compoundPathItems.add(), p = d.layers[0].pageItems[2]; var q = p.duplicate(c);\ + vc.log(c.pathItems.length); vc.log(q.parent.typename); vc.log(p.parent.typename);", + ); + assert_eq!(out, [json!(1), json!("CompoundPathItem"), json!("Layer")]); + let d = &s.active().unwrap().doc; + let lid = d.layer_containing(a).unwrap(); + let c = d.node(lid).unwrap().children().unwrap().iter().find(|n| matches!(n.kind, NodeKind::Compound { .. })).unwrap(); + assert_eq!(c.appearance, blue); + assert_eq!(d.node(a).unwrap().appearance, blue); + // The copy keeps no paint, live shape or pixel alignment of its own. + let q = &c.children().unwrap()[0]; + assert_ne!(q.appearance, blue); + assert!(matches!(q.kind, NodeKind::Path { live: None, .. })); + assert!(!q.extras().pixel_aligned); +} + +/// A compound path's `pathItems` list its topmost path first. +#[test] +fn a_compound_paths_path_items_list_the_topmost_path_first() { + let (mut s, a, b) = doc(); + s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); + s.execute("object.compoundPath.make", &json!({})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let cid = s.active().unwrap().doc.parent_of(a).unwrap(); + let source = "var P = app.activeDocument.compoundPathItems[0].pathItems; vc.log(P[0].width); vc.log(P[1].width);"; + // `b` (50 pt wide) on top, then `a` (30 pt wide) on top. + s.execute("node.move", &json!({"id": b.0, "parent": cid.0, "index": 1})).unwrap(); + assert_eq!(log(&mut s, source), [json!(50), json!(30)]); + s.execute("node.move", &json!({"id": a.0, "parent": cid.0, "index": 1})).unwrap(); + assert_eq!(log(&mut s, source), [json!(30), json!(50)]); +} + +/// A path that leaves a compound path for a layer is drawn as it was: it takes the compound +/// path's paint and pixel alignment, as Release Compound Path gives them. +#[test] +fn a_path_moved_out_of_a_compound_path_keeps_the_paint_it_was_drawn_with() { + let (mut s, a, b) = doc(); + s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); + s.execute("object.compoundPath.make", &json!({})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + s.execute("object.setPixelAligned", &json!({"on": true})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let (cid, red, lid) = { + let d = &s.active().unwrap().doc; + let cid = d.parent_of(a).unwrap(); + (cid, d.node(cid).unwrap().appearance.clone(), d.layer_containing(a).unwrap()) + }; + assert_ne!(s.active().unwrap().doc.node(a).unwrap().appearance, red); + s.execute("node.move", &json!({"id": a.0, "parent": lid.0})).unwrap(); + let d = &s.active().unwrap().doc; + assert_eq!(d.parent_of(a), Some(lid)); + let n = d.node(a).unwrap(); + assert_eq!(n.appearance, red); + assert!(n.extras().pixel_aligned); + // The path left behind keeps none of its own. + assert_eq!(d.parent_of(b), Some(cid)); + assert_ne!(d.node(b).unwrap().appearance, red); +} + #[test] fn a_compound_paths_path_items_are_path_items() { let (mut s, a, b) = doc(); @@ -1737,16 +1877,38 @@ fn new_artboards_get_a_name_no_other_artboard_has() { } #[test] -fn names_take_numbers_and_artboards_may_share_a_name() { +fn names_take_numbers_and_booleans() { let (mut s, _, _) = doc(); let out = log( &mut s, - "var d = app.activeDocument, A = d.artboards, L = d.layers[0]; A.add([500, 300, 700, 100]);\ + "var d = app.activeDocument, L = d.layers[0];\ L.name = 5; vc.log(L.name); vc.log(typeof L.name); L.name = 1.5; vc.log(L.name); L.name = true; vc.log(L.name);\ - A[0].name = 7; vc.log(A[0].name); A[1].name = 'Same'; A[0].name = 'Same'; vc.log([A[0].name, A[1].name]);\ - vc.log(A.getByName('Same').artboardRect[0]);", + d.artboards[0].name = 7; vc.log(d.artboards[0].name); vc.log(typeof d.artboards[0].name);", ); - assert_eq!(out, [json!("5"), json!("string"), json!("1.5"), json!("true"), json!("7"), json!(["Same", "Same"]), json!(0)]); + assert_eq!(out, [json!("5"), json!("string"), json!("1.5"), json!("true"), json!("7"), json!("string")]); +} + +#[test] +fn an_empty_artboard_name_gives_the_default_name() { + let (mut s, _, _) = doc(); + let out = log( + &mut s, + "var A = app.activeDocument.artboards; A.add([500, 300, 700, 100]);\ + A[0].name = 'Front'; A[1].name = 'Back'; A[0].name = ''; A[1].name = ' ';\ + vc.log([A[0].name, A[1].name]);", + ); + assert_eq!(out, [json!(["Artboard 1", "Artboard 2"])]); +} + +#[test] +fn two_artboards_may_share_a_name() { + let (mut s, _, _) = doc(); + let out = log( + &mut s, + "var A = app.activeDocument.artboards; A.add([500, 300, 700, 100]);\ + A[1].name = 'Same'; A[0].name = 'Same'; vc.log([A[0].name, A[1].name]); vc.log(A.getByName('Same').artboardRect[0]);", + ); + assert_eq!(out, [json!(["Same", "Same"]), json!(0)]); let names: Vec = s.active().unwrap().doc.artboards.iter().map(|a| a.name.clone()).collect(); assert_eq!(names, ["Same", "Same"]); } @@ -1769,7 +1931,6 @@ fn artboards_reject_bad_arguments_before_any_change() { ("app.activeDocument.artboards.insert([0, 0, 10, -10]);", "needs an index"), ("app.activeDocument.artboards.remove(2);", "index must be"), ("app.activeDocument.artboards.remove(-1);", "index must be"), - ("app.activeDocument.artboards[0].name = '';", "cannot be empty"), ("app.activeDocument.artboards[0].name = null;", "must be a string"), ("app.activeDocument.artboards[0].name = new Array(5000).join('x');", "too long"), ("app.activeDocument.artboards[0].rulerPAR = 20;", "from 0.1 to 10"), diff --git a/docs/mcp.md b/docs/mcp.md index 4cec59e36b..5bbf805842 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -2657,9 +2657,9 @@ app through the global object `vc`, and writes to the Script Console and runs ot `move(relativeObject, insertionLocation?)`, `remove()` and `zOrder(method)` (https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/). `move` runs `node.move`, and `duplicate` runs `edit.duplicate` and then `node.move` on the copy. 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. An object of another document throws `Cross-document placement is not available`, and when + 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. An object of another document throws `Cross-document placement is not available`, and when `node.move` refuses the place of a copy, `duplicate` throws that error and leaves the documents, the selection and the undo history as they were before the call. `move` on an object that is hidden or locked, inside a hidden or locked layer or group, or on a locked artboard throws `Cannot move` and moves nothing. `duplicate` on such an @@ -2671,8 +2671,9 @@ app through the global object `vc`, and writes to the Script Console and runs ot enumerations `ElementPlacement`, `ZOrderMethod`, `RulerUnits`, `DocumentColorSpace`, `CoordinateSystem`, `DocumentArtboardLayout`, `DocumentPresetType`, `DocumentPreviewMode`, `DocumentRasterResolution` and `DocumentTransparencyGrid` hold strings such as `"ZOrderMethod.BRINGTOFRONT"`. - VectorCraft's own rules: documents are listed in tab order, and page items in paint order from the bottom, with the - objects inside groups and compound paths after their group and without layers and ruler guides. Script coordinates + VectorCraft's own rules: documents are listed in tab order, and the document's page items in paint order from the + bottom, 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). 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` is `TextFrame` for type, and `BlendItem`, `EnvelopeItem`, `RepeatItem`, `PlacedDocumentItem` and `IntertwineItem` @@ -2738,14 +2739,17 @@ app through the global object `vc`, and writes to the Script Console and runs ot path; `false` releases the mask; the group keeps its id. `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` puts into a compound path - becomes one of its paths, and an empty compound path takes the paint of the first path that goes in; other objects - are refused. `artboards.add` and `insert` stop - at 100 artboards in a document, the limit `Documents.add` uses. An artboard's rectangle is + (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. 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 and cannot be empty, 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. + 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 @@ -2757,8 +2761,10 @@ app through the global object `vc`, and writes to the Script Console and runs ot 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. - The selection stays as it is. `node.move` also puts a path into a shown, unlocked compound path, and an empty - compound path takes the paint of the first path that goes in. + 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, 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. - `$.write(...values)` writes the values to the Script Console with no separator, each as `String(value)` gives it, and `$.writeln(...values)` does the same and ends the line. Each call counts as a host call. - `$.evalFile(path, timeout?)` runs the file `path` names, relative to the file being run, in the same global @@ -6463,7 +6469,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,