[Bf-blender-cvs] [d4223da817c] temp-geometry-nodes-expandable-geometry-socket-prototype: support list input in Point Separate node
Jacques Lucke
noreply at git.blender.org
Mon Aug 9 11:50:44 CEST 2021
Commit: d4223da817c6f7db14ccf37546a263aa04304756
Author: Jacques Lucke
Date: Mon Aug 9 11:50:30 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rBd4223da817c6f7db14ccf37546a263aa04304756
support list input in Point Separate node
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc b/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
index fc04d1e275f..94fdbe431af 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
@@ -25,7 +25,7 @@
static bNodeSocketTemplate geo_node_point_instance_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
- {SOCK_STRING, N_("Mask")},
+ {SOCK_BOOLEAN, N_("Mask"), 1, 0, 0, 0, 0, 1, PROP_NONE, SOCK_HIDE_VALUE},
{-1, ""},
};
@@ -99,17 +99,16 @@ static void create_component_points(GeometryComponent &component, const int tota
static void separate_points_from_component(const GeometryComponent &in_component,
GeometryComponent &out_component,
- const StringRef mask_name,
+ const Span<bool> mask,
const bool invert)
{
if (!in_component.attribute_domain_supported(ATTR_DOMAIN_POINT) ||
in_component.attribute_domain_size(ATTR_DOMAIN_POINT) == 0) {
return;
}
-
- const GVArray_Typed<bool> mask_attribute = in_component.attribute_get_for_read<bool>(
- mask_name, ATTR_DOMAIN_POINT, false);
- VArray_Span<bool> masks{mask_attribute};
+ const int tot_in_point = in_component.attribute_domain_size(ATTR_DOMAIN_POINT);
+ fn::GVArray_For_RepeatedGSpan mask_repeated{tot_in_point, mask};
+ GVArray_Span<bool> masks{mask_repeated};
const int total = masks.count(!invert);
if (total == 0) {
@@ -122,7 +121,7 @@ static void separate_points_from_component(const GeometryComponent &in_component
}
static GeometrySet separate_geometry_set(const GeometrySet &set_in,
- const StringRef mask_name,
+ const Span<bool> mask,
const bool invert)
{
GeometrySet set_out;
@@ -132,7 +131,7 @@ static GeometrySet separate_geometry_set(const GeometrySet &set_in,
continue;
}
GeometryComponent &out_component = set_out.get_component_for_write(component->type());
- separate_points_from_component(*component, out_component, mask_name, invert);
+ separate_points_from_component(*component, out_component, mask, invert);
}
return set_out;
}
@@ -145,7 +144,7 @@ static void geo_node_point_separate_exec(GeoNodeExecParams params)
if (wait_for_inputs) {
return;
}
- const std::string mask_attribute_name = params.get_input<std::string>("Mask");
+ const Array<bool> mask = params.get_input<Array<bool>>("Mask");
GeometrySet geometry_set = params.get_input<GeometrySet>("Geometry");
/* TODO: This is not necessary-- the input geometry set can be read only,
@@ -153,12 +152,10 @@ static void geo_node_point_separate_exec(GeoNodeExecParams params)
geometry_set = geometry_set_realize_instances(geometry_set);
if (params.lazy_output_is_required("Geometry 1")) {
- params.set_output("Geometry 1",
- separate_geometry_set(geometry_set, mask_attribute_name, true));
+ params.set_output("Geometry 1", separate_geometry_set(geometry_set, mask, true));
}
if (params.lazy_output_is_required("Geometry 2")) {
- params.set_output("Geometry 2",
- separate_geometry_set(geometry_set, mask_attribute_name, false));
+ params.set_output("Geometry 2", separate_geometry_set(geometry_set, mask, false));
}
}
More information about the Bf-blender-cvs
mailing list