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:
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc41
1 files changed, 22 insertions, 19 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
index cf9f04f3fe8..490535224c8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
@@ -163,28 +163,31 @@ static void add_instances_from_component(InstancesComponent &dst_component,
static void geo_node_instance_on_points_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Points");
- GeometrySet geometry_set_out;
- InstancesComponent &instances = geometry_set_out.get_component_for_write<InstancesComponent>();
+ geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
+ InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>();
- if (geometry_set.has<MeshComponent>()) {
- add_instances_from_component(
- instances, *geometry_set.get_component_for_read<MeshComponent>(), params);
- }
- if (geometry_set.has<PointCloudComponent>()) {
- add_instances_from_component(
- instances, *geometry_set.get_component_for_read<PointCloudComponent>(), params);
- }
- if (geometry_set.has<CurveComponent>()) {
- add_instances_from_component(
- instances, *geometry_set.get_component_for_read<CurveComponent>(), params);
- }
-
- /* Unused references may have been added above. Remove those now so that other nodes don't
- * process them needlessly. */
- instances.remove_unused_references();
+ if (geometry_set.has<MeshComponent>()) {
+ add_instances_from_component(
+ instances, *geometry_set.get_component_for_read<MeshComponent>(), params);
+ geometry_set.remove(GEO_COMPONENT_TYPE_MESH);
+ }
+ if (geometry_set.has<PointCloudComponent>()) {
+ add_instances_from_component(
+ instances, *geometry_set.get_component_for_read<PointCloudComponent>(), params);
+ geometry_set.remove(GEO_COMPONENT_TYPE_POINT_CLOUD);
+ }
+ if (geometry_set.has<CurveComponent>()) {
+ add_instances_from_component(
+ instances, *geometry_set.get_component_for_read<CurveComponent>(), params);
+ geometry_set.remove(GEO_COMPONENT_TYPE_CURVE);
+ }
+ /* Unused references may have been added above. Remove those now so that other nodes don't
+ * process them needlessly. */
+ instances.remove_unused_references();
+ });
- params.set_output("Instances", std::move(geometry_set_out));
+ params.set_output("Instances", std::move(geometry_set));
}
} // namespace blender::nodes