From 98dabd7ff522e7fd52e22acc33fc52bcd6f5cc21 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sat, 22 Aug 2026 14:36:42 +0000 Subject: [PATCH] Materialize the boolean operation's content level --- node-graph/nodes/path-bool/src/lib.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/node-graph/nodes/path-bool/src/lib.rs b/node-graph/nodes/path-bool/src/lib.rs index 103d588dd4..bd9f012c14 100644 --- a/node-graph/nodes/path-bool/src/lib.rs +++ b/node-graph/nodes/path-bool/src/lib.rs @@ -8,7 +8,7 @@ use graphic_types::vector_types::{ATTR_GRADIENT_TYPE, ATTR_SPREAD_METHOD}; use graphic_types::vector_types::subpath::{ManipulatorGroup, Subpath}; use graphic_types::vector_types::vector::PointId; use graphic_types::vector_types::vector::algorithms::merge_by_distance::MergeByDistanceExt; -use graphic_types::{ATTR_EDITOR_MERGED_LAYERS, ATTR_FILL, Graphic, Vector}; +use graphic_types::{ATTR_EDITOR_MERGED_LAYERS, ATTR_FILL, Graphic, IntoGraphicList, Vector}; use linesweeper::topology::Topology; use linesweeper::{BinaryOp, FillRule, binary_op}; use smallvec::SmallVec; @@ -21,11 +21,11 @@ pub use vector_types::vector::misc::BooleanOperation; /// Combines the geometric forms of one or more closed paths into a new vector path that results from cutting or joining the paths by the chosen method. #[node_macro::node(category("Vector: Modifier"), memoize)] -fn boolean_operation( - _: impl Ctx, +fn boolean_operation( + _: impl Ctx + core_types::ExtractIndex + core_types::InjectIndex + Copy, /// The `List` of vector paths to perform the boolean operation on. Nested `List`s are automatically flattened. - #[implementations(List, List)] - content: I, + #[implementations(Graphic, Vector)] + content: IList, /// Which boolean operation to perform on the paths. /// /// Union combines all paths while cutting out overlapping areas (even the interiors of a single path). @@ -33,8 +33,15 @@ fn boolean_operation( /// Intersection cuts away all but the overlapping areas shared by every path. /// Difference cuts away the overlapping areas shared by every path, leaving only the non-overlapping areas. operation: BooleanOperation, -) -> List { - let content = content.into_graphic_list(); +) -> List +where + List: graphic_types::IntoGraphicList, +{ + // SAFETY: a materialized input's frames are arena-resident. + let item = unsafe { core_types::record::GroupItem::from_resident(content.batch()) }; + let content = graphic_types::graphic::run_to_render_list::(&item) + .expect("the run holds the row's element type") + .into_graphic_list(); // The first index is the bottom of the stack let flattened = flatten_vector(&content);