Skip to content

Commit 44ad6c9

Browse files
committed
Add support for the 'Boolean Operation' node to accept vector tables, not just groups
1 parent 3ac5c1a commit 44ad6c9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

node-graph/gstd/src/vector.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,23 @@ use std::ops::Mul;
1313
// TODO: since before we used a Vec of single-row tables and now we use a single table
1414
// TODO: with multiple rows while still assuming a single row for the boolean operations.
1515

16+
/// 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.
1617
#[node_macro::node(category(""))]
17-
async fn boolean_operation(_: impl Ctx, group_of_paths: GraphicGroupTable, operation: BooleanOperation) -> VectorDataTable {
18+
async fn boolean_operation<I: Into<GraphicGroupTable> + 'n + Send + Clone>(
19+
_: impl Ctx,
20+
/// The group of paths to perform the boolean operation on. Nested groups are automatically flattened.
21+
#[implementations(GraphicGroupTable, VectorDataTable)]
22+
group_of_paths: I,
23+
/// Which boolean operation to perform on the paths.
24+
///
25+
/// Union combines all paths while cutting out overlapping areas (even the interiors of a single path).
26+
/// Subtraction cuts overlapping areas out from the last (Subtract Front) or first (Subtract Back) path.
27+
/// Intersection cuts away all but the overlapping areas shared by every path.
28+
/// Difference cuts away the overlapping areas shared by every path, leaving only the non-overlapping areas.
29+
operation: BooleanOperation,
30+
) -> VectorDataTable {
31+
let group_of_paths = group_of_paths.into();
32+
1833
// The first index is the bottom of the stack
1934
let mut result_vector_data_table = boolean_operation_on_vector_data_table(flatten_vector_data(&group_of_paths).instance_ref_iter(), operation);
2035

0 commit comments

Comments
 (0)