From e4ce03a9065377ce569a0afa7e789a525e759f72 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 17:58:55 -0800 Subject: [PATCH 1/3] Plug-ins: a filter keeps a compound path's hidden and locked members A filter that handed a compound path back rebuilt every member from the returned path, even when the path was unchanged, so its hidden members were shown and its locked members unlocked after any run. - A compound path whose path comes back as it was, or is left out, keeps its members as they are. - While a member is hidden, locked or a guide, a changed path or `type: "path"` is refused with an error naming the compound path. A guide member is allowed when the output also sets `guide`. - A changed path still replaces the members, one per subpath, keeping the old members' ids by position. Docs: docs/plugins.md. --- crates/engine/src/tests/plugins.rs | 104 ++++++++++++++++++++++++++++ crates/plugins/src/objects.rs | 26 ++++++- crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/plugins.md | 8 +++ 28 files changed, 162 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 947a3ec42d..402a24eb68 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -182,6 +182,110 @@ fn filters_make_guides_and_locked_objects_left_unselected() { assert_eq!(st.history.undo.len(), undo + 1); } +/// A compound path handed back with its path as it was keeps its members, hidden and locked ones +/// included. A changed path replaces its members, and is refused while a member is hidden, locked +/// or a guide, as is turning it into a plain path. +#[test] +fn a_filter_keeps_or_replaces_a_compound_path_s_members_whole() { + use std::sync::Arc; + use vectorcraft_doc::{Appearance, Node, NodeKind}; + use vectorcraft_geom::FillRule; + let mut s = session(); + let compound_of = |s: &mut Session, members: Vec| { + let mut id = NodeId(0); + s.edit("Set up", |d, _| { + let n = Node::new(d.alloc_id(), NodeKind::Compound { children: members.into_iter().map(Arc::new).collect(), rule: FillRule::NonZero }); + let layer = d.layers[0].id; + id = d.insert(Some(layer), usize::MAX, n).unwrap(); + Ok(()) + }) + .unwrap(); + id + }; + let members = |s: &Session, id: NodeId| match &node(s, id).kind { + NodeKind::Compound { children, .. } => children.iter().map(|c| (c.id, c.visible, c.locked, c.path_data().cloned())).collect::>(), + _ => Vec::new(), + }; + let new_ids = |s: &mut Session| s.edit("Set up", |d, _| Ok([d.alloc_id(), d.alloc_id(), d.alloc_id(), d.alloc_id()])).unwrap(); + let [a, b, c, d] = new_ids(&mut s); + let [g, h, i, j] = new_ids(&mut s); + let hidden = |id: NodeId, x: f64| { + let mut n = Node::path(id, square_at(x), Appearance::default()); + n.visible = false; + n + }; + let locked = |id: NodeId, x: f64| { + let mut n = Node::path(id, square_at(x), Appearance::default()); + n.locked = true; + n + }; + // A member with an empty subpath, which plug-in output can't hold, still counts as handed back. + let empty = Node::path(g, PathData::single(SubPath::polyline(&[], false)), Appearance::default()); + let kept = compound_of(&mut s, vec![hidden(a, 40.0), locked(b, 80.0), empty]); + let plain = + compound_of(&mut s, vec![Node::path(c, square_at(120.0), Appearance::default()), Node::path(d, square_at(160.0), Appearance::default())]); + let was = members(&s, kept); + install_wat(&mut s, &tpl::module(&tpl::manifest("test.engine.compound.echo", "filter", "{}"), tpl::ECHO, "", 1)); + run(&mut s, "plugin.run", json!({"id": "test.engine.compound.echo", "ids": [kept.0]})); + assert_eq!(members(&s, kept), was, "handed back as it was, the members stay as they were"); + // New geometry for a compound with a hidden or a locked member, or the same geometry as a plain + // path, is refused, and the document is left alone. + let mut moved = square_at(200.0); + moved.subpaths.extend(square_at(240.0).subpaths); + let reshape = |id: &str, target: NodeId, extra: Value| { + let mut o = json!({"id": target.0, "path": moved.clone()}); + o.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone()); + tpl::returning(&tpl::manifest(id, "filter", "{}"), &json!({ "objects": [o] }).to_string()) + }; + let hidden_only = compound_of(&mut s, vec![hidden(h, 360.0)]); + let locked_only = compound_of(&mut s, vec![Node::path(i, square_at(360.0), Appearance::default()), locked(j, 380.0)]); + for target in [hidden_only, locked_only] { + install_wat(&mut s, &reshape("test.engine.compound.reshape", target, json!({}))); + let flatten = tpl::returning( + &tpl::manifest("test.engine.compound.flatten", "filter", "{}"), + &json!({"objects": [{"id": target.0, "type": "path"}]}).to_string(), + ); + install_wat(&mut s, &flatten); + let before = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); + for id in ["test.engine.compound.reshape", "test.engine.compound.flatten"] { + let e = s.execute("plugin.run", &json!({"id": id, "ids": [target.0]})).unwrap_err().to_string(); + assert!(e.contains(&format!("compound path {} has a hidden, locked or guide member", target.0)), "{id}: {e}"); + assert_eq!((s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()), before, "{id}"); + } + } + // Without such members, new geometry replaces the members: one per subpath, in the old members' places. + install_wat(&mut s, &reshape("test.engine.compound.reshape", plain, json!({}))); + run(&mut s, "plugin.run", json!({"id": "test.engine.compound.reshape", "ids": [plain.0]})); + let now = members(&s, plain); + assert_eq!(now.iter().map(|m| m.3.clone()).collect::>(), [Some(square_at(200.0)), Some(square_at(240.0))]); + assert!(now.iter().all(|m| m.1 && !m.2), "shown and unlocked members: {now:?}"); + assert_eq!(now.iter().map(|m| m.0).collect::>(), [c, d], "the members keep their places' ids"); + // A guide member is refused the same way, unless the output sets `guide` for the whole object. + let guide_of = |s: &mut Session| { + let [e, f, ..] = new_ids(s); + let mut guide_member = Node::path(e, square_at(280.0), Appearance::default()); + if let NodeKind::Path { guide, .. } = &mut guide_member.kind { + *guide = true; + } + compound_of(s, vec![guide_member, Node::path(f, square_at(320.0), Appearance::default())]) + }; + let guides = |s: &Session, id: NodeId| match &node(s, id).kind { + NodeKind::Compound { children, .. } => children.iter().map(|c| matches!(c.kind, NodeKind::Path { guide: true, .. })).collect::>(), + _ => Vec::new(), + }; + let guide = guide_of(&mut s); + install_wat(&mut s, &reshape("test.engine.compound.reshape", guide, json!({}))); + let err = s.execute("plugin.run", &json!({"id": "test.engine.compound.reshape", "ids": [guide.0]})).unwrap_err().to_string(); + assert!(err.contains("guide member"), "{err}"); + for (id, on) in [("test.engine.compound.unguide", false), ("test.engine.compound.reguide", true)] { + let target = guide_of(&mut s); + install_wat(&mut s, &reshape(id, target, json!({ "guide": on }))); + run(&mut s, "plugin.run", json!({"id": id, "ids": [target.0]})); + assert_eq!(members(&s, target).iter().map(|m| m.3.clone()).collect::>(), [Some(square_at(200.0)), Some(square_at(240.0))], "{id}"); + assert_eq!(guides(&s, target), [on, on], "{id}: every new member takes the output's `guide`"); + } +} + #[test] fn failing_plugins_leave_the_document_and_history_alone() { let mut s = session(); diff --git a/crates/plugins/src/objects.rs b/crates/plugins/src/objects.rs index 19a90500ce..7445b10863 100644 --- a/crates/plugins/src/objects.rs +++ b/crates/plugins/src/objects.rs @@ -1031,12 +1031,36 @@ fn members(doc: &mut Document, old: &[Arc], path: PathData) -> Vec bool { + returned.subpaths.iter().eq(current.subpaths.iter().filter(|sp| !sp.anchors.is_empty())) +} + +/// Refuses an output that replaces the members of compound path `n` while one of them is hidden, +/// locked or (unless the output sets `guide`) a guide. +fn check_members_replaceable(n: &Node, children: &[Arc], sets_guide: bool, at: &str) -> Result<()> { + if children.iter().any(|c| !c.visible || c.locked || (!sets_guide && is_guide(c))) { + let id = n.id.0; + return Err(out_err(at, format!("compound path {id} has a hidden, locked or guide member, so its members can't be replaced"))); + } + Ok(()) +} + /// Writes `o` into `n` (an input object, or a fresh node for a new one); its effect records once /// `admit` lets them in. fn write(doc: &mut Document, n: &mut Node, o: OutObject, at: &str, admit: AdmitEffects) -> Result<()> { let (cur_path, cur_rule, cur_compound) = geometry(n).unwrap_or((PathData::default(), FillRule::NonZero, false)); let compound = o.compound.unwrap_or(cur_compound); let rule = o.rule.unwrap_or(cur_rule); + // A compound path handed back with its path as it was keeps its members as they are. + let same_members = cur_compound && o.path.as_ref().is_none_or(|p| same_geometry(p, &cur_path)); + if let NodeKind::Compound { children, .. } = &n.kind + && (!same_members || !compound) + { + let at = if compound { format!("{at}.path") } else { format!("{at}.type") }; + check_members_replaceable(n, children, o.guide.is_some(), &at)?; + } match (&mut n.kind, compound) { (NodeKind::Path { path, rule: r, live, .. }, false) => { // A path handed back as it was stays the live shape it was. @@ -1047,7 +1071,7 @@ fn write(doc: &mut Document, n: &mut Node, o: OutObject, at: &str, admit: AdmitE *r = rule; } (NodeKind::Compound { children, rule: r }, true) => { - if let Some(p) = o.path { + if let Some(p) = o.path.filter(|_| !same_members) { *children = members(doc, children, p); } *r = rule; diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index e4271f7926..1a4dc70fa3 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7786,6 +7786,7 @@ variable-list-end {0}, {1} {0} i {1} @msg `plates` requires a stop linked to a spot swatch `plates` requereix una parada vinculada a una mostra de color directe @msg the output la sortida @msg the path has no anchor points el traçat no té punts d’ancoratge +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced el traçat compost {id} té un membre ocult, bloquejat o guia, per tant no se’n poden substituir els membres @msg too many anchor points (limit {MAX_ANCHORS}) massa punts d’ancoratge (límit {MAX_ANCHORS}) @msg true or false true o false @msg a number >= {_1} un nombre >= {_1} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 488df173c3..dc683ca4f8 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7396,6 +7396,7 @@ axis Y Axis osa Y @msg `plates` requires a stop linked to a spot swatch `plates` vyžaduje zarážku propojenou se vzorkem přímé barvy @msg the output výstup @msg the path has no anchor points cesta nemá žádné kotevní body +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced složená cesta {id} má skrytý, zamčený nebo vodítkový člen, takže její členy nelze nahradit @msg too many anchor points (limit {MAX_ANCHORS}) příliš mnoho kotevních bodů (limit {MAX_ANCHORS}) @msg true or false true nebo false @msg a number >= {_1} číslo >= {_1} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 302ab6aa69..6886e7765e 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -627,6 +627,7 @@ liquify-list-end {0}, {1} {0} og {1} @msg `plates` requires a stop linked to a spot swatch `plates` kræver et gradientstop, der er knyttet til en spotfarveprøve @msg the output outputtet @msg the path has no anchor points kurven har ingen ankerpunkter +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced den sammensatte kurve {id} har et skjult, låst eller hjælpelinjemedlem, så dens medlemmer kan ikke erstattes @msg too many anchor points (limit {MAX_ANCHORS}) for mange ankerpunkter (grænse {MAX_ANCHORS}) @msg true or false true eller false @msg a number >= {_1} et tal >= {_1} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 9482345f18..5193dd73d2 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6979,6 +6979,7 @@ axis Y Axis Y-Achse @msg `plates` requires a stop linked to a spot swatch `plates` erfordert einen Farbstopp, der mit einem Volltonfarbfeld verknüpft ist @msg the output die Ausgabe @msg the path has no anchor points der Pfad hat keine Ankerpunkte +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced der zusammengesetzte Pfad {id} hat ein ausgeblendetes, gesperrtes oder als Hilfslinie dienendes Element, daher lassen sich seine Elemente nicht ersetzen @msg too many anchor points (limit {MAX_ANCHORS}) zu viele Ankerpunkte (Grenze {MAX_ANCHORS}) @msg true or false true oder false @msg a number >= {_1} eine Zahl >= {_1} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 434d0cc0b8..9ddf8dfec3 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7386,6 +7386,7 @@ axis Y Axis Άξονας Y @msg `plates` requires a stop linked to a spot swatch το `plates` απαιτεί σημείο χρώματος συνδεδεμένο με δείγμα πλακάτου χρώματος @msg the output η έξοδος @msg the path has no anchor points η διαδρομή δεν έχει σημεία αγκύρωσης +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced η σύνθετη διαδρομή {id} έχει κρυφό, κλειδωμένο ή οδηγό μέλος, οπότε τα μέλη της δεν μπορούν να αντικατασταθούν @msg too many anchor points (limit {MAX_ANCHORS}) πάρα πολλά σημεία αγκύρωσης (όριο {MAX_ANCHORS}) @msg true or false true ή false @msg a number >= {_1} αριθμός >= {_1} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 3f83e928e4..29a840f0f0 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7372,6 +7372,7 @@ axis Y Axis Eje Y @msg `plates` requires a stop linked to a spot swatch `plates` requiere una parada vinculada a una muestra de tinta plana @msg the output la salida @msg the path has no anchor points el trazado no tiene puntos de ancla +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced el trazado compuesto {id} tiene un miembro oculto, bloqueado o guía, por lo que sus miembros no se pueden reemplazar @msg too many anchor points (limit {MAX_ANCHORS}) demasiados puntos de ancla (límite {MAX_ANCHORS}) @msg true or false true o false @msg a number >= {_1} un número >= {_1} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index a4d85b23e8..6b37414b59 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7463,6 +7463,7 @@ axis Y Axis Y-akseli @msg `plates` requires a stop linked to a spot swatch `plates` vaatii väripisteen, joka on linkitetty spottivärin värimalliin @msg the output tuloste @msg the path has no anchor points polulla ei ole ankkuripisteitä +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced yhdistelmäpolulla {id} on piilotettu, lukittu tai apuviivana oleva jäsen, joten sen jäseniä ei voi korvata @msg too many anchor points (limit {MAX_ANCHORS}) liian monta ankkuripistettä (raja {MAX_ANCHORS}) @msg true or false true tai false @msg a number >= {_1} luku >= {_1} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 8f56486157..b62cf5e517 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7392,6 +7392,7 @@ axis Y Axis Axe Y @msg `plates` requires a stop linked to a spot swatch `plates` exige une étape liée à une nuance de ton direct @msg the output la sortie @msg the path has no anchor points le tracé n’a aucun point d’ancrage +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced le tracé transparent {id} a un membre masqué, verrouillé ou repère, donc ses membres ne peuvent pas être remplacés @msg too many anchor points (limit {MAX_ANCHORS}) trop de points d’ancrage (limite {MAX_ANCHORS}) @msg true or false true ou false @msg a number >= {_1} un nombre >= {_1} diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index e9509d9202..1dda08adae 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6580,6 +6580,7 @@ arrowhead Feather पंख @msg `plates` requires a stop linked to a spot swatch `plates` के लिए स्पॉट रंग स्वॉच से जुड़ा स्टॉप आवश्यक है @msg the output आउटपुट @msg the path has no anchor points पाथ में कोई एंकर पॉइंट नहीं है +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced कंपाउंड पाथ {id} का कोई सदस्य छिपा हुआ, बंद या गाइड है, इसलिए इसके सदस्य बदले नहीं जा सकते @msg too many anchor points (limit {MAX_ANCHORS}) बहुत अधिक एंकर पॉइंट (सीमा {MAX_ANCHORS}) @msg true or false true या false @msg a number >= {_1} एक संख्या >= {_1} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 87f050ef0d..c244cdc7bd 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7381,6 +7381,7 @@ axis Y Axis Y tengely @msg `plates` requires a stop linked to a spot swatch a `plates` direktszín-színmintához kapcsolt színátmenet-pontot igényel @msg the output a kimenet @msg the path has no anchor points az útvonalnak nincsenek horgonypontjai +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced a(z) {id} összetett útvonalnak van rejtett, zárolt vagy segédvonal tagja, ezért a tagjai nem cserélhetők le @msg too many anchor points (limit {MAX_ANCHORS}) túl sok horgonypont (korlát: {MAX_ANCHORS}) @msg true or false true vagy false @msg a number >= {_1} szám >= {_1} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 924d3d80b5..b4c886ab91 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -509,6 +509,7 @@ @msg `plates` requires a stop linked to a spot swatch `plates` memerlukan perhentian yang ditautkan ke swatch warna spot @msg the output keluaran @msg the path has no anchor points jalur tidak memiliki titik jangkar +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced jalur majemuk {id} memiliki anggota yang tersembunyi, terkunci, atau garis panduan, sehingga anggotanya tidak dapat diganti @msg too many anchor points (limit {MAX_ANCHORS}) terlalu banyak titik jangkar (batas {MAX_ANCHORS}) @msg true or false true atau false @msg a number >= {_1} angka >= {_1} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 5f47e3f117..23d79f1f9d 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7018,6 +7018,7 @@ axis Y Axis Asse Y @msg `plates` requires a stop linked to a spot swatch `plates` richiede un cursore colore collegato a un campione di colore spot @msg the output l’output @msg the path has no anchor points il tracciato non ha punti di ancoraggio +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced il tracciato composto {id} ha un membro nascosto, bloccato o guida, quindi i suoi membri non possono essere sostituiti @msg too many anchor points (limit {MAX_ANCHORS}) troppi punti di ancoraggio (limite {MAX_ANCHORS}) @msg true or false true o false @msg a number >= {_1} un numero >= {_1} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 9a1b5f6354..49aa86259e 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7093,6 +7093,7 @@ axis Y Axis Y 軸 @msg `plates` requires a stop linked to a spot swatch `plates` には特色スウォッチにリンクされた分岐点が必要です @msg the output 出力 @msg the path has no anchor points パスにアンカーポイントがありません +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 複合パス {id} に非表示、ロック、またはガイドのメンバーがあるため、メンバーを置き換えられません @msg too many anchor points (limit {MAX_ANCHORS}) アンカーポイントが多すぎます (上限 {MAX_ANCHORS}) @msg true or false true または false @msg a number >= {_1} {_1} 以上の数値 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 8eeacee621..6de759cb7d 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9499,6 +9499,7 @@ axis Y Axis Y ღერძი @msg `plates` requires a stop linked to a spot swatch `plates` მოითხოვს გადასვლის წერტილს, რომელიც სპოტ-ფერის ნიმუშთანაა დაკავშირებული @msg the output გამოტანა @msg the path has no anchor points ტრაექტორიას საყრდენი წერტილები არ აქვს +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced შედგენილ ტრაექტორიას {id} აქვს დამალული, ჩაკეტილი ან დამხმარე ხაზის წევრი, ამიტომ მისი წევრების ჩანაცვლება შეუძლებელია @msg too many anchor points (limit {MAX_ANCHORS}) ძალიან ბევრი საყრდენი წერტილი (ლიმიტი {MAX_ANCHORS}) @msg true or false true ან false @msg a number >= {_1} რიცხვი >= {_1} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 57e0b8be10..9bdd856619 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6990,6 +6990,7 @@ axis Y Axis Y축 @msg `plates` requires a stop linked to a spot swatch `plates`에는 별색 견본에 연결된 정지점이 필요합니다 @msg the output 출력 @msg the path has no anchor points 패스에 앵커 포인트가 없습니다 +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 컴파운드 패스 {id}에 숨겨졌거나 잠겼거나 안내선인 멤버가 있어 멤버를 바꿀 수 없습니다 @msg too many anchor points (limit {MAX_ANCHORS}) 앵커 포인트가 너무 많습니다(한도 {MAX_ANCHORS}) @msg true or false true 또는 false @msg a number >= {_1} {_1} 이상인 숫자 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 5ed5cdc3e0..23189ecd79 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -473,6 +473,7 @@ liquify-list-end {0}, {1} {0} en {1} @msg `plates` requires a stop linked to a spot swatch `plates` vereist een verloopstop die aan een steunkleurstaal is gekoppeld @msg the output de uitvoer @msg the path has no anchor points het pad heeft geen ankerpunten +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced het samengestelde pad {id} heeft een verborgen, vergrendeld of hulplijnlid, dus de leden kunnen niet worden vervangen @msg too many anchor points (limit {MAX_ANCHORS}) te veel ankerpunten (limiet {MAX_ANCHORS}) @msg true or false true of false @msg a number >= {_1} een getal >= {_1} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 74029133dc..2feaa45650 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7251,6 +7251,7 @@ axis Y Axis Oś Y @msg `plates` requires a stop linked to a spot swatch `plates` wymaga punktu koloru połączonego z próbką koloru dodatkowego @msg the output wyjście @msg the path has no anchor points ścieżka nie ma punktów kontrolnych +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced ścieżka złożona {id} ma ukryty, zablokowany lub będący linią pomocniczą element, więc jej elementów nie można zastąpić @msg too many anchor points (limit {MAX_ANCHORS}) za dużo punktów kontrolnych (limit {MAX_ANCHORS}) @msg true or false true lub false @msg a number >= {_1} liczbą >= {_1} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index a1747af0b2..84fa97541e 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7295,6 +7295,7 @@ axis Y Axis Eixo Y @msg `plates` requires a stop linked to a spot swatch `plates` requer uma parada vinculada a uma amostra de cor spot @msg the output a saída @msg the path has no anchor points o caminho não tem pontos de ancoragem +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced o caminho composto {id} tem um membro oculto, bloqueado ou guia, por isso seus membros não podem ser substituídos @msg too many anchor points (limit {MAX_ANCHORS}) pontos de ancoragem demais (limite {MAX_ANCHORS}) @msg true or false true ou false @msg a number >= {_1} um número >= {_1} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ca0c8d5145..f8c097ba9d 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7018,6 +7018,7 @@ axis Y Axis Ось Y @msg `plates` requires a stop linked to a spot swatch для `plates` нужна точка перехода, связанная с образцом плашечного цвета @msg the output вывод @msg the path has no anchor points у контура нет опорных точек +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced у составного контура {id} есть скрытый, заблокированный или направляющий элемент, поэтому его элементы нельзя заменить @msg too many anchor points (limit {MAX_ANCHORS}) слишком много опорных точек (предел {MAX_ANCHORS}) @msg true or false true или false @msg a number >= {_1} число >= {_1} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index c26474cf93..d6f6f39897 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7408,6 +7408,7 @@ axis Y Axis Y-axel @msg `plates` requires a stop linked to a spot swatch `plates` kräver ett gradientstopp som är länkat till en dekorfärgruta @msg the output utdata @msg the path has no anchor points banan har inga ankarpunkter +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced den sammansatta banan {id} har en dold, låst eller stödlinjemedlem, så dess medlemmar kan inte ersättas @msg too many anchor points (limit {MAX_ANCHORS}) för många ankarpunkter (gräns {MAX_ANCHORS}) @msg true or false true eller false @msg a number >= {_1} ett tal >= {_1} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 82186ebcdd..f006fb298e 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -7468,6 +7468,7 @@ axis Y Axis Y ekseni @msg `plates` requires a stop linked to a spot swatch `plates`, nokta rengi örneğine bağlı bir degrade durağı gerektirir @msg the output çıktı @msg the path has no anchor points yolun bağlantı noktası yok +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced {id} bileşik yolunun gizli, kilitli veya kılavuz olan bir üyesi var, bu yüzden üyeleri değiştirilemez @msg too many anchor points (limit {MAX_ANCHORS}) çok fazla bağlantı noktası (sınır {MAX_ANCHORS}) @msg true or false true veya false @msg a number >= {_1} bir sayı >= {_1} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index de3329ef10..4829c577ac 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7000,6 +7000,7 @@ axis Y Axis Вісь Y @msg `plates` requires a stop linked to a spot swatch для `plates` потрібна точка переходу, пов’язана зі зразком плашкового кольору @msg the output виведення @msg the path has no anchor points контур не має опорних точок +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced складений контур {id} має прихований, заблокований або напрямний елемент, тому його елементи не можна замінити @msg too many anchor points (limit {MAX_ANCHORS}) забагато опорних точок (межа {MAX_ANCHORS}) @msg true or false true або false @msg a number >= {_1} число >= {_1} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 675143a8d6..ee744d7ff2 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7047,6 +7047,7 @@ axis Y Axis Trục Y @msg `plates` requires a stop linked to a spot swatch `plates` cần một điểm dừng chuyển sắc liên kết với mẫu màu đặc biệt @msg the output đầu ra @msg the path has no anchor points đường dẫn không có điểm neo +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced đường dẫn phức {id} có thành phần bị ẩn, bị khóa hoặc là đường căn, nên không thể thay thế các thành phần của nó @msg too many anchor points (limit {MAX_ANCHORS}) quá nhiều điểm neo (giới hạn {MAX_ANCHORS}) @msg true or false true hoặc false @msg a number >= {_1} một số >= {_1} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 57f6a4403b..3d497ec2b8 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7228,6 +7228,7 @@ axis Y Axis Y 轴 @msg `plates` requires a stop linked to a spot swatch `plates` 需要链接到专色色板的渐变色标 @msg the output 输出 @msg the path has no anchor points 路径没有锚点 +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 复合路径 {id} 有隐藏、锁定或参考线成员,因此无法替换其成员 @msg too many anchor points (limit {MAX_ANCHORS}) 锚点过多(上限 {MAX_ANCHORS}) @msg true or false true 或 false @msg a number >= {_1} 大于或等于 {_1} 的数字 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 9834c17ea6..16c937b529 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7049,6 +7049,7 @@ axis Y Axis Y 軸 @msg `plates` requires a stop linked to a spot swatch `plates` 需要連結到特別色色票的漸層色標 @msg the output 輸出 @msg the path has no anchor points 路徑沒有錨點 +@msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 複合路徑 {id} 有隱藏、鎖定或參考線成員,因此無法取代其成員 @msg too many anchor points (limit {MAX_ANCHORS}) 錨點過多(上限 {MAX_ANCHORS}) @msg true or false true 或 false @msg a number >= {_1} 大於或等於 {_1} 的數字 diff --git a/docs/plugins.md b/docs/plugins.md index ab294db1ff..a7d685b314 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -776,6 +776,14 @@ For an **object filter**, the output is the new state of the input objects: the run locked or made guides are left out of the selection that follows. Hosts from before these keys ignore them. - A `path` returned as it was keeps a live shape live (a rectangle keeps its corner widgets); a changed one makes it a plain path. +- A compound path whose `path` is returned as it was, or left out, keeps its members as they are, hidden and locked + ones included; a changed `path` replaces its members with one plain member per subpath. The host refuses a `path` + with no anchor points, so return a compound path that has none without `path`. While a member is hidden, locked or a + guide, the host refuses a changed `path` and `type: "path"` for it (a guide member is allowed when the output also + sets `guide`). +- The host compares a returned `path` with the input coordinate by coordinate, exactly. A JSON parser that does not + read numbers back exactly as they were written (in Rust, `serde_json` without its `float_roundtrip` feature) can + change the last digit of a coordinate, so leave `path` out when the geometry does not change. The host validates everything before the document changes: coordinates must be finite and within ±4,000,000 pt, at most 100,000 objects and 4,000,000 anchors, 256 fills, strokes or gradient stops; colours, opacities and offsets are From 2fbe099c48ccbe0bab15e633b95c8221289c8438 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 19:15:57 -0800 Subject: [PATCH 2/3] Plug-ins: refuse replacing a compound path's members when one isn't a path A member that is not a path (a compound path inside a compound path) is not in the input's `path`, so a changed `path` or `type: "path"` deleted it, together with any hidden or locked members it held. The host now refuses such an output with an error naming the compound path. A compound handed back as it was still keeps the member. docs/plugins.md also says that new members keep the old ids by position but not their names or live shapes. The test covers a nested compound member and turning a compound with a guide member into a guide path. --- crates/engine/src/tests/plugins.rs | 22 ++++++++++++++++++++-- crates/plugins/src/objects.rs | 10 +++++++--- crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/plugins.md | 9 +++++---- 28 files changed, 57 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 402a24eb68..9625e2ec2f 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -239,7 +239,16 @@ fn a_filter_keeps_or_replaces_a_compound_path_s_members_whole() { }; let hidden_only = compound_of(&mut s, vec![hidden(h, 360.0)]); let locked_only = compound_of(&mut s, vec![Node::path(i, square_at(360.0), Appearance::default()), locked(j, 380.0)]); - for target in [hidden_only, locked_only] { + // A member that is itself a compound path, shown and unlocked but holding a hidden member: its + // geometry isn't in the input, so a new path or a plain path would drop it. + let [k, l, m, _] = new_ids(&mut s); + let inner = Node::new(k, NodeKind::Compound { children: vec![Arc::new(hidden(l, 400.0))], rule: FillRule::NonZero }); + let nested = compound_of(&mut s, vec![Node::path(m, square_at(440.0), Appearance::default()), inner]); + let was_nested = node(&s, nested).clone(); + run(&mut s, "plugin.run", json!({"id": "test.engine.compound.echo", "ids": [nested.0]})); + assert_eq!(node(&s, nested).kind, was_nested.kind, "handed back as it was, a nested compound member stays"); + let flagged = "a hidden, locked or guide member"; + for (target, why) in [(hidden_only, flagged), (locked_only, flagged), (nested, "a member that isn't a path")] { install_wat(&mut s, &reshape("test.engine.compound.reshape", target, json!({}))); let flatten = tpl::returning( &tpl::manifest("test.engine.compound.flatten", "filter", "{}"), @@ -249,7 +258,7 @@ fn a_filter_keeps_or_replaces_a_compound_path_s_members_whole() { let before = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); for id in ["test.engine.compound.reshape", "test.engine.compound.flatten"] { let e = s.execute("plugin.run", &json!({"id": id, "ids": [target.0]})).unwrap_err().to_string(); - assert!(e.contains(&format!("compound path {} has a hidden, locked or guide member", target.0)), "{id}: {e}"); + assert!(e.contains(&format!("compound path {} has {why}", target.0)), "{id}: {e}"); assert_eq!((s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()), before, "{id}"); } } @@ -284,6 +293,15 @@ fn a_filter_keeps_or_replaces_a_compound_path_s_members_whole() { assert_eq!(members(&s, target).iter().map(|m| m.3.clone()).collect::>(), [Some(square_at(200.0)), Some(square_at(240.0))], "{id}"); assert_eq!(guides(&s, target), [on, on], "{id}: every new member takes the output's `guide`"); } + // Turning it into a plain path is allowed the same way when the output sets `guide`. + let target = guide_of(&mut s); + let flatten = tpl::returning( + &tpl::manifest("test.engine.compound.flatten.guide", "filter", "{}"), + &json!({"objects": [{"id": target.0, "type": "path", "guide": true}]}).to_string(), + ); + install_wat(&mut s, &flatten); + run(&mut s, "plugin.run", json!({"id": "test.engine.compound.flatten.guide", "ids": [target.0]})); + assert!(matches!(node(&s, target).kind, NodeKind::Path { guide: true, .. }), "{:?}", node(&s, target).kind); } #[test] diff --git a/crates/plugins/src/objects.rs b/crates/plugins/src/objects.rs index 7445b10863..ad69c25720 100644 --- a/crates/plugins/src/objects.rs +++ b/crates/plugins/src/objects.rs @@ -1037,11 +1037,15 @@ fn same_geometry(returned: &PathData, current: &PathData) -> bool { returned.subpaths.iter().eq(current.subpaths.iter().filter(|sp| !sp.anchors.is_empty())) } -/// Refuses an output that replaces the members of compound path `n` while one of them is hidden, -/// locked or (unless the output sets `guide`) a guide. +/// Refuses an output that replaces the members of compound path `n` while one of them isn't a path +/// (plug-ins aren't given its geometry), or is hidden, locked or (unless the output sets `guide`) a +/// guide. fn check_members_replaceable(n: &Node, children: &[Arc], sets_guide: bool, at: &str) -> Result<()> { + let id = n.id.0; + if children.iter().any(|c| c.path_data().is_none()) { + return Err(out_err(at, format!("compound path {id} has a member that isn't a path, so its members can't be replaced"))); + } if children.iter().any(|c| !c.visible || c.locked || (!sets_guide && is_guide(c))) { - let id = n.id.0; return Err(out_err(at, format!("compound path {id} has a hidden, locked or guide member, so its members can't be replaced"))); } Ok(()) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 1a4dc70fa3..7824182049 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7787,6 +7787,7 @@ variable-list-end {0}, {1} {0} i {1} @msg the output la sortida @msg the path has no anchor points el traçat no té punts d’ancoratge @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced el traçat compost {id} té un membre ocult, bloquejat o guia, per tant no se’n poden substituir els membres +@msg compound path {id} has a member that isn't a path, so its members can't be replaced el traçat compost {id} té un membre que no és un traçat, per tant no se’n poden substituir els membres @msg too many anchor points (limit {MAX_ANCHORS}) massa punts d’ancoratge (límit {MAX_ANCHORS}) @msg true or false true o false @msg a number >= {_1} un nombre >= {_1} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index dc683ca4f8..5b1c5eacca 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7397,6 +7397,7 @@ axis Y Axis osa Y @msg the output výstup @msg the path has no anchor points cesta nemá žádné kotevní body @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced složená cesta {id} má skrytý, zamčený nebo vodítkový člen, takže její členy nelze nahradit +@msg compound path {id} has a member that isn't a path, so its members can't be replaced složená cesta {id} má člen, který není cestou, takže její členy nelze nahradit @msg too many anchor points (limit {MAX_ANCHORS}) příliš mnoho kotevních bodů (limit {MAX_ANCHORS}) @msg true or false true nebo false @msg a number >= {_1} číslo >= {_1} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 6886e7765e..8b9f7fc12b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -628,6 +628,7 @@ liquify-list-end {0}, {1} {0} og {1} @msg the output outputtet @msg the path has no anchor points kurven har ingen ankerpunkter @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced den sammensatte kurve {id} har et skjult, låst eller hjælpelinjemedlem, så dens medlemmer kan ikke erstattes +@msg compound path {id} has a member that isn't a path, so its members can't be replaced den sammensatte kurve {id} har et medlem, der ikke er en kurve, så dens medlemmer kan ikke erstattes @msg too many anchor points (limit {MAX_ANCHORS}) for mange ankerpunkter (grænse {MAX_ANCHORS}) @msg true or false true eller false @msg a number >= {_1} et tal >= {_1} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 5193dd73d2..1629db5e7d 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6980,6 +6980,7 @@ axis Y Axis Y-Achse @msg the output die Ausgabe @msg the path has no anchor points der Pfad hat keine Ankerpunkte @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced der zusammengesetzte Pfad {id} hat ein ausgeblendetes, gesperrtes oder als Hilfslinie dienendes Element, daher lassen sich seine Elemente nicht ersetzen +@msg compound path {id} has a member that isn't a path, so its members can't be replaced der zusammengesetzte Pfad {id} hat ein Element, das kein Pfad ist, daher lassen sich seine Elemente nicht ersetzen @msg too many anchor points (limit {MAX_ANCHORS}) zu viele Ankerpunkte (Grenze {MAX_ANCHORS}) @msg true or false true oder false @msg a number >= {_1} eine Zahl >= {_1} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 9ddf8dfec3..c190ca48cb 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7387,6 +7387,7 @@ axis Y Axis Άξονας Y @msg the output η έξοδος @msg the path has no anchor points η διαδρομή δεν έχει σημεία αγκύρωσης @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced η σύνθετη διαδρομή {id} έχει κρυφό, κλειδωμένο ή οδηγό μέλος, οπότε τα μέλη της δεν μπορούν να αντικατασταθούν +@msg compound path {id} has a member that isn't a path, so its members can't be replaced η σύνθετη διαδρομή {id} έχει μέλος που δεν είναι διαδρομή, οπότε τα μέλη της δεν μπορούν να αντικατασταθούν @msg too many anchor points (limit {MAX_ANCHORS}) πάρα πολλά σημεία αγκύρωσης (όριο {MAX_ANCHORS}) @msg true or false true ή false @msg a number >= {_1} αριθμός >= {_1} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 29a840f0f0..b411ebb22e 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7373,6 +7373,7 @@ axis Y Axis Eje Y @msg the output la salida @msg the path has no anchor points el trazado no tiene puntos de ancla @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced el trazado compuesto {id} tiene un miembro oculto, bloqueado o guía, por lo que sus miembros no se pueden reemplazar +@msg compound path {id} has a member that isn't a path, so its members can't be replaced el trazado compuesto {id} tiene un miembro que no es un trazado, por lo que sus miembros no se pueden reemplazar @msg too many anchor points (limit {MAX_ANCHORS}) demasiados puntos de ancla (límite {MAX_ANCHORS}) @msg true or false true o false @msg a number >= {_1} un número >= {_1} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 6b37414b59..aac92465f5 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7464,6 +7464,7 @@ axis Y Axis Y-akseli @msg the output tuloste @msg the path has no anchor points polulla ei ole ankkuripisteitä @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced yhdistelmäpolulla {id} on piilotettu, lukittu tai apuviivana oleva jäsen, joten sen jäseniä ei voi korvata +@msg compound path {id} has a member that isn't a path, so its members can't be replaced yhdistelmäpolulla {id} on jäsen, joka ei ole polku, joten sen jäseniä ei voi korvata @msg too many anchor points (limit {MAX_ANCHORS}) liian monta ankkuripistettä (raja {MAX_ANCHORS}) @msg true or false true tai false @msg a number >= {_1} luku >= {_1} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index b62cf5e517..3f9db12cd2 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7393,6 +7393,7 @@ axis Y Axis Axe Y @msg the output la sortie @msg the path has no anchor points le tracé n’a aucun point d’ancrage @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced le tracé transparent {id} a un membre masqué, verrouillé ou repère, donc ses membres ne peuvent pas être remplacés +@msg compound path {id} has a member that isn't a path, so its members can't be replaced le tracé transparent {id} a un membre qui n’est pas un tracé, donc ses membres ne peuvent pas être remplacés @msg too many anchor points (limit {MAX_ANCHORS}) trop de points d’ancrage (limite {MAX_ANCHORS}) @msg true or false true ou false @msg a number >= {_1} un nombre >= {_1} diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 1dda08adae..ae468c125b 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6581,6 +6581,7 @@ arrowhead Feather पंख @msg the output आउटपुट @msg the path has no anchor points पाथ में कोई एंकर पॉइंट नहीं है @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced कंपाउंड पाथ {id} का कोई सदस्य छिपा हुआ, बंद या गाइड है, इसलिए इसके सदस्य बदले नहीं जा सकते +@msg compound path {id} has a member that isn't a path, so its members can't be replaced कंपाउंड पाथ {id} का कोई सदस्य पाथ नहीं है, इसलिए इसके सदस्य बदले नहीं जा सकते @msg too many anchor points (limit {MAX_ANCHORS}) बहुत अधिक एंकर पॉइंट (सीमा {MAX_ANCHORS}) @msg true or false true या false @msg a number >= {_1} एक संख्या >= {_1} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c244cdc7bd..ad7e67a4a1 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7382,6 +7382,7 @@ axis Y Axis Y tengely @msg the output a kimenet @msg the path has no anchor points az útvonalnak nincsenek horgonypontjai @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced a(z) {id} összetett útvonalnak van rejtett, zárolt vagy segédvonal tagja, ezért a tagjai nem cserélhetők le +@msg compound path {id} has a member that isn't a path, so its members can't be replaced a(z) {id} összetett útvonalnak van olyan tagja, amely nem útvonal, ezért a tagjai nem cserélhetők le @msg too many anchor points (limit {MAX_ANCHORS}) túl sok horgonypont (korlát: {MAX_ANCHORS}) @msg true or false true vagy false @msg a number >= {_1} szám >= {_1} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index b4c886ab91..8c40fe6503 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -510,6 +510,7 @@ @msg the output keluaran @msg the path has no anchor points jalur tidak memiliki titik jangkar @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced jalur majemuk {id} memiliki anggota yang tersembunyi, terkunci, atau garis panduan, sehingga anggotanya tidak dapat diganti +@msg compound path {id} has a member that isn't a path, so its members can't be replaced jalur majemuk {id} memiliki anggota yang bukan jalur, sehingga anggotanya tidak dapat diganti @msg too many anchor points (limit {MAX_ANCHORS}) terlalu banyak titik jangkar (batas {MAX_ANCHORS}) @msg true or false true atau false @msg a number >= {_1} angka >= {_1} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 23d79f1f9d..cb534ca7a7 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7019,6 +7019,7 @@ axis Y Axis Asse Y @msg the output l’output @msg the path has no anchor points il tracciato non ha punti di ancoraggio @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced il tracciato composto {id} ha un membro nascosto, bloccato o guida, quindi i suoi membri non possono essere sostituiti +@msg compound path {id} has a member that isn't a path, so its members can't be replaced il tracciato composto {id} ha un membro che non è un tracciato, quindi i suoi membri non possono essere sostituiti @msg too many anchor points (limit {MAX_ANCHORS}) troppi punti di ancoraggio (limite {MAX_ANCHORS}) @msg true or false true o false @msg a number >= {_1} un numero >= {_1} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 49aa86259e..fe8cc71f64 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7094,6 +7094,7 @@ axis Y Axis Y 軸 @msg the output 出力 @msg the path has no anchor points パスにアンカーポイントがありません @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 複合パス {id} に非表示、ロック、またはガイドのメンバーがあるため、メンバーを置き換えられません +@msg compound path {id} has a member that isn't a path, so its members can't be replaced 複合パス {id} にパスではないメンバーがあるため、メンバーを置き換えられません @msg too many anchor points (limit {MAX_ANCHORS}) アンカーポイントが多すぎます (上限 {MAX_ANCHORS}) @msg true or false true または false @msg a number >= {_1} {_1} 以上の数値 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 6de759cb7d..27e3aa4b63 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9500,6 +9500,7 @@ axis Y Axis Y ღერძი @msg the output გამოტანა @msg the path has no anchor points ტრაექტორიას საყრდენი წერტილები არ აქვს @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced შედგენილ ტრაექტორიას {id} აქვს დამალული, ჩაკეტილი ან დამხმარე ხაზის წევრი, ამიტომ მისი წევრების ჩანაცვლება შეუძლებელია +@msg compound path {id} has a member that isn't a path, so its members can't be replaced შედგენილ ტრაექტორიას {id} აქვს წევრი, რომელიც ტრაექტორია არ არის, ამიტომ მისი წევრების ჩანაცვლება შეუძლებელია @msg too many anchor points (limit {MAX_ANCHORS}) ძალიან ბევრი საყრდენი წერტილი (ლიმიტი {MAX_ANCHORS}) @msg true or false true ან false @msg a number >= {_1} რიცხვი >= {_1} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 9bdd856619..1e5b9e950c 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6991,6 +6991,7 @@ axis Y Axis Y축 @msg the output 출력 @msg the path has no anchor points 패스에 앵커 포인트가 없습니다 @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 컴파운드 패스 {id}에 숨겨졌거나 잠겼거나 안내선인 멤버가 있어 멤버를 바꿀 수 없습니다 +@msg compound path {id} has a member that isn't a path, so its members can't be replaced 컴파운드 패스 {id}에 패스가 아닌 멤버가 있어 멤버를 바꿀 수 없습니다 @msg too many anchor points (limit {MAX_ANCHORS}) 앵커 포인트가 너무 많습니다(한도 {MAX_ANCHORS}) @msg true or false true 또는 false @msg a number >= {_1} {_1} 이상인 숫자 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 23189ecd79..caeeabed57 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -474,6 +474,7 @@ liquify-list-end {0}, {1} {0} en {1} @msg the output de uitvoer @msg the path has no anchor points het pad heeft geen ankerpunten @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced het samengestelde pad {id} heeft een verborgen, vergrendeld of hulplijnlid, dus de leden kunnen niet worden vervangen +@msg compound path {id} has a member that isn't a path, so its members can't be replaced het samengestelde pad {id} heeft een lid dat geen pad is, dus de leden kunnen niet worden vervangen @msg too many anchor points (limit {MAX_ANCHORS}) te veel ankerpunten (limiet {MAX_ANCHORS}) @msg true or false true of false @msg a number >= {_1} een getal >= {_1} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 2feaa45650..691fb29e77 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7252,6 +7252,7 @@ axis Y Axis Oś Y @msg the output wyjście @msg the path has no anchor points ścieżka nie ma punktów kontrolnych @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced ścieżka złożona {id} ma ukryty, zablokowany lub będący linią pomocniczą element, więc jej elementów nie można zastąpić +@msg compound path {id} has a member that isn't a path, so its members can't be replaced ścieżka złożona {id} ma element, który nie jest ścieżką, więc jej elementów nie można zastąpić @msg too many anchor points (limit {MAX_ANCHORS}) za dużo punktów kontrolnych (limit {MAX_ANCHORS}) @msg true or false true lub false @msg a number >= {_1} liczbą >= {_1} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 84fa97541e..295b54d447 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7296,6 +7296,7 @@ axis Y Axis Eixo Y @msg the output a saída @msg the path has no anchor points o caminho não tem pontos de ancoragem @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced o caminho composto {id} tem um membro oculto, bloqueado ou guia, por isso seus membros não podem ser substituídos +@msg compound path {id} has a member that isn't a path, so its members can't be replaced o caminho composto {id} tem um membro que não é um caminho, por isso seus membros não podem ser substituídos @msg too many anchor points (limit {MAX_ANCHORS}) pontos de ancoragem demais (limite {MAX_ANCHORS}) @msg true or false true ou false @msg a number >= {_1} um número >= {_1} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index f8c097ba9d..9bebde840d 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7019,6 +7019,7 @@ axis Y Axis Ось Y @msg the output вывод @msg the path has no anchor points у контура нет опорных точек @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced у составного контура {id} есть скрытый, заблокированный или направляющий элемент, поэтому его элементы нельзя заменить +@msg compound path {id} has a member that isn't a path, so its members can't be replaced у составного контура {id} есть элемент, который не является контуром, поэтому его элементы нельзя заменить @msg too many anchor points (limit {MAX_ANCHORS}) слишком много опорных точек (предел {MAX_ANCHORS}) @msg true or false true или false @msg a number >= {_1} число >= {_1} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d6f6f39897..62ca329655 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7409,6 +7409,7 @@ axis Y Axis Y-axel @msg the output utdata @msg the path has no anchor points banan har inga ankarpunkter @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced den sammansatta banan {id} har en dold, låst eller stödlinjemedlem, så dess medlemmar kan inte ersättas +@msg compound path {id} has a member that isn't a path, so its members can't be replaced den sammansatta banan {id} har en medlem som inte är en bana, så dess medlemmar kan inte ersättas @msg too many anchor points (limit {MAX_ANCHORS}) för många ankarpunkter (gräns {MAX_ANCHORS}) @msg true or false true eller false @msg a number >= {_1} ett tal >= {_1} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f006fb298e..6a805e1c55 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -7469,6 +7469,7 @@ axis Y Axis Y ekseni @msg the output çıktı @msg the path has no anchor points yolun bağlantı noktası yok @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced {id} bileşik yolunun gizli, kilitli veya kılavuz olan bir üyesi var, bu yüzden üyeleri değiştirilemez +@msg compound path {id} has a member that isn't a path, so its members can't be replaced {id} bileşik yolunun yol olmayan bir üyesi var, bu yüzden üyeleri değiştirilemez @msg too many anchor points (limit {MAX_ANCHORS}) çok fazla bağlantı noktası (sınır {MAX_ANCHORS}) @msg true or false true veya false @msg a number >= {_1} bir sayı >= {_1} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 4829c577ac..ecfc2bc82b 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7001,6 +7001,7 @@ axis Y Axis Вісь Y @msg the output виведення @msg the path has no anchor points контур не має опорних точок @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced складений контур {id} має прихований, заблокований або напрямний елемент, тому його елементи не можна замінити +@msg compound path {id} has a member that isn't a path, so its members can't be replaced складений контур {id} має елемент, який не є контуром, тому його елементи не можна замінити @msg too many anchor points (limit {MAX_ANCHORS}) забагато опорних точок (межа {MAX_ANCHORS}) @msg true or false true або false @msg a number >= {_1} число >= {_1} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index ee744d7ff2..d02e834dcb 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7048,6 +7048,7 @@ axis Y Axis Trục Y @msg the output đầu ra @msg the path has no anchor points đường dẫn không có điểm neo @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced đường dẫn phức {id} có thành phần bị ẩn, bị khóa hoặc là đường căn, nên không thể thay thế các thành phần của nó +@msg compound path {id} has a member that isn't a path, so its members can't be replaced đường dẫn phức {id} có thành phần không phải là đường dẫn, nên không thể thay thế các thành phần của nó @msg too many anchor points (limit {MAX_ANCHORS}) quá nhiều điểm neo (giới hạn {MAX_ANCHORS}) @msg true or false true hoặc false @msg a number >= {_1} một số >= {_1} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 3d497ec2b8..adfaa791f2 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7229,6 +7229,7 @@ axis Y Axis Y 轴 @msg the output 输出 @msg the path has no anchor points 路径没有锚点 @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 复合路径 {id} 有隐藏、锁定或参考线成员,因此无法替换其成员 +@msg compound path {id} has a member that isn't a path, so its members can't be replaced 复合路径 {id} 有不是路径的成员,因此无法替换其成员 @msg too many anchor points (limit {MAX_ANCHORS}) 锚点过多(上限 {MAX_ANCHORS}) @msg true or false true 或 false @msg a number >= {_1} 大于或等于 {_1} 的数字 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 16c937b529..9fc557df5e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7050,6 +7050,7 @@ axis Y Axis Y 軸 @msg the output 輸出 @msg the path has no anchor points 路徑沒有錨點 @msg compound path {id} has a hidden, locked or guide member, so its members can't be replaced 複合路徑 {id} 有隱藏、鎖定或參考線成員,因此無法取代其成員 +@msg compound path {id} has a member that isn't a path, so its members can't be replaced 複合路徑 {id} 有不是路徑的成員,因此無法取代其成員 @msg too many anchor points (limit {MAX_ANCHORS}) 錨點過多(上限 {MAX_ANCHORS}) @msg true or false true 或 false @msg a number >= {_1} 大於或等於 {_1} 的數字 diff --git a/docs/plugins.md b/docs/plugins.md index a7d685b314..7bbf7c4a73 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -777,10 +777,11 @@ For an **object filter**, the output is the new state of the input objects: - A `path` returned as it was keeps a live shape live (a rectangle keeps its corner widgets); a changed one makes it a plain path. - A compound path whose `path` is returned as it was, or left out, keeps its members as they are, hidden and locked - ones included; a changed `path` replaces its members with one plain member per subpath. The host refuses a `path` - with no anchor points, so return a compound path that has none without `path`. While a member is hidden, locked or a - guide, the host refuses a changed `path` and `type: "path"` for it (a guide member is allowed when the output also - sets `guide`). + ones included; a changed `path` replaces its members with one plain member per subpath, which keeps the old members' + ids by position but not their names or live shapes. The host refuses a `path` with no anchor points, so return a + compound path that has none without `path`. While a member is hidden, locked or a guide, or is not a path (its + geometry is not in the input's `path`), the host refuses a changed `path` and `type: "path"` for it (a guide member + is allowed when the output also sets `guide`). - The host compares a returned `path` with the input coordinate by coordinate, exactly. A JSON parser that does not read numbers back exactly as they were written (in Rust, `serde_json` without its `float_roundtrip` feature) can change the last digit of a coordinate, so leave `path` out when the geometry does not change. From edadc8282770d85821445596437380b61c65b84c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 19:59:44 -0800 Subject: [PATCH 3/3] Plug-ins: state what a compound path's reshape resets, and test an unflagged flatten of a guide member docs/plugins.md now says that each new member keeps only the id of the old member in its place, with its name, live shape, opacity, blending mode, appearance, opacity mask and other settings of its own reset, and that `guide: false` on a compound path makes each guide member an ordinary path. The compound path test also checks that `type: "path"` without `guide` is refused for a compound path with a guide member and leaves the member a guide, and its doc comment names members that are not paths. --- crates/engine/src/tests/plugins.rs | 12 ++++++++++-- docs/plugins.md | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 9625e2ec2f..d17fa2d730 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -183,8 +183,8 @@ fn filters_make_guides_and_locked_objects_left_unselected() { } /// A compound path handed back with its path as it was keeps its members, hidden and locked ones -/// included. A changed path replaces its members, and is refused while a member is hidden, locked -/// or a guide, as is turning it into a plain path. +/// included. A changed path replaces its members, and is refused while a member is hidden, locked, +/// a guide or not a path, as is turning it into a plain path. #[test] fn a_filter_keeps_or_replaces_a_compound_path_s_members_whole() { use std::sync::Arc; @@ -286,6 +286,14 @@ fn a_filter_keeps_or_replaces_a_compound_path_s_members_whole() { install_wat(&mut s, &reshape("test.engine.compound.reshape", guide, json!({}))); let err = s.execute("plugin.run", &json!({"id": "test.engine.compound.reshape", "ids": [guide.0]})).unwrap_err().to_string(); assert!(err.contains("guide member"), "{err}"); + let flatten = tpl::returning( + &tpl::manifest("test.engine.compound.flatten.unflagged", "filter", "{}"), + &json!({"objects": [{"id": guide.0, "type": "path"}]}).to_string(), + ); + install_wat(&mut s, &flatten); + let err = s.execute("plugin.run", &json!({"id": "test.engine.compound.flatten.unflagged", "ids": [guide.0]})).unwrap_err().to_string(); + assert!(err.contains(&format!("compound path {} has {flagged}", guide.0)), "{err}"); + assert_eq!(guides(&s, guide), [true, false], "a refused flatten leaves the guide member as it was"); for (id, on) in [("test.engine.compound.unguide", false), ("test.engine.compound.reguide", true)] { let target = guide_of(&mut s); install_wat(&mut s, &reshape(id, target, json!({ "guide": on }))); diff --git a/docs/plugins.md b/docs/plugins.md index 7bbf7c4a73..8c1b577e10 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -777,11 +777,13 @@ For an **object filter**, the output is the new state of the input objects: - A `path` returned as it was keeps a live shape live (a rectangle keeps its corner widgets); a changed one makes it a plain path. - A compound path whose `path` is returned as it was, or left out, keeps its members as they are, hidden and locked - ones included; a changed `path` replaces its members with one plain member per subpath, which keeps the old members' - ids by position but not their names or live shapes. The host refuses a `path` with no anchor points, so return a + ones included; a changed `path` replaces its members with one plain member per subpath. Each new member keeps only + the id of the old member in its place: its name, live shape, opacity, blending mode, appearance, opacity mask and + other settings of its own are reset to a new path's defaults. The host refuses a `path` with no anchor points, so return a compound path that has none without `path`. While a member is hidden, locked or a guide, or is not a path (its geometry is not in the input's `path`), the host refuses a changed `path` and `type: "path"` for it (a guide member - is allowed when the output also sets `guide`). + is allowed when the output also sets `guide`). `guide` applies to every member, so `guide: false` on a compound path + makes each of its guide members an ordinary path. - The host compares a returned `path` with the input coordinate by coordinate, exactly. A JSON parser that does not read numbers back exactly as they were written (in Rust, `serde_json` without its `float_roundtrip` feature) can change the last digit of a coordinate, so leave `path` out when the geometry does not change.