Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-08-09 12:50:30 +0300
committerJacques Lucke <jacques@blender.org>2021-08-09 12:50:30 +0300
commitd4223da817c6f7db14ccf37546a263aa04304756 (patch)
tree06942821468fa69c4a759325e3a992065e871c73
parent1ee857b4e755c664eb20254ad0981490f41d6502 (diff)
support list input in Point Separate node
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_point_separate.cc23
1 files changed, 10 insertions, 13 deletions
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));
}
}