From 64ca2865404ed95b1be0eb875f153673cdf5a212 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 25 Mar 2021 14:54:27 -0400 Subject: Cleanup: Pass instance group result vector as an argument This will allow retrieving the instance groups from multiple geometry sets and avoiding needing vectors of vectors to store the results. This is useful when retrieving instances from a multi-input socket of geometries. --- .../blender/blenkernel/intern/geometry_set_instances.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source/blender/blenkernel/intern/geometry_set_instances.cc') diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index 24a402ac545..10c88a47416 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -153,16 +153,13 @@ static void geometry_set_collect_recursive(const GeometrySet &geometry_set, * * \note This doesn't extract instances from the "dupli" system for non-geometry-nodes instances. */ -Vector geometry_set_gather_instances(const GeometrySet &geometry_set) +void geometry_set_gather_instances(const GeometrySet &geometry_set, + Vector &r_instance_groups) { - Vector result_vector; - float4x4 unit_transform; unit_m4(unit_transform.values); - geometry_set_collect_recursive(geometry_set, unit_transform, result_vector); - - return result_vector; + geometry_set_collect_recursive(geometry_set, unit_transform, r_instance_groups); } void gather_attribute_info(Map &attributes, @@ -436,7 +433,8 @@ GeometrySet geometry_set_realize_mesh_for_modifier(const GeometrySet &geometry_s } GeometrySet new_geometry_set = geometry_set; - Vector set_groups = geometry_set_gather_instances(geometry_set); + Vector set_groups; + geometry_set_gather_instances(geometry_set, set_groups); join_instance_groups_mesh(set_groups, true, new_geometry_set); /* Remove all instances, even though some might contain other non-mesh data. We can't really * keep only non-mesh instances in general. */ @@ -454,7 +452,8 @@ GeometrySet geometry_set_realize_instances(const GeometrySet &geometry_set) GeometrySet new_geometry_set; - Vector set_groups = geometry_set_gather_instances(geometry_set); + Vector set_groups; + geometry_set_gather_instances(geometry_set, set_groups); join_instance_groups_mesh(set_groups, false, new_geometry_set); join_instance_groups_pointcloud(set_groups, new_geometry_set); join_instance_groups_volume(set_groups, new_geometry_set); -- cgit v1.2.3