[Bf-blender-cvs] [79ba4fde159] master: Cleanup: Rename function, switch order of arguments

Hans Goudey noreply at git.blender.org
Wed Apr 7 22:49:12 CEST 2021


Commit: 79ba4fde1591ce20c23608276975c691cd3c9302
Author: Hans Goudey
Date:   Wed Apr 7 15:49:02 2021 -0500
Branches: master
https://developer.blender.org/rB79ba4fde1591ce20c23608276975c691cd3c9302

Cleanup: Rename function, switch order of arguments

The function name was not very specific, this makes it clearer that it
works on instances rather than only real geometry. Also use `r_`
prefix for the return argument.

===================================================================

M	source/blender/blenkernel/BKE_geometry_set_instances.hh
M	source/blender/blenkernel/intern/geometry_set_instances.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_geometry_set_instances.hh b/source/blender/blenkernel/BKE_geometry_set_instances.hh
index c372fdff049..c0d9c3f74ec 100644
--- a/source/blender/blenkernel/BKE_geometry_set_instances.hh
+++ b/source/blender/blenkernel/BKE_geometry_set_instances.hh
@@ -55,9 +55,9 @@ struct AttributeKind {
  * will contain the highest complexity data type and the highest priority domain among every
  * attribute with the given name on all of the input components.
  */
-void gather_attribute_info(Map<std::string, AttributeKind> &attributes,
-                           Span<GeometryComponentType> component_types,
-                           Span<bke::GeometryInstanceGroup> set_groups,
-                           const Set<std::string> &ignored_attributes);
+void geometry_set_gather_instances_attribute_info(Span<GeometryInstanceGroup> set_groups,
+                                                  Span<GeometryComponentType> component_types,
+                                                  const Set<std::string> &ignored_attributes,
+                                                  Map<std::string, AttributeKind> &r_attributes);
 
 }  // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc
index 10c88a47416..1a45eac8cab 100644
--- a/source/blender/blenkernel/intern/geometry_set_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_set_instances.cc
@@ -162,10 +162,10 @@ void geometry_set_gather_instances(const GeometrySet &geometry_set,
   geometry_set_collect_recursive(geometry_set, unit_transform, r_instance_groups);
 }
 
-void gather_attribute_info(Map<std::string, AttributeKind> &attributes,
-                           Span<GeometryComponentType> component_types,
-                           Span<GeometryInstanceGroup> set_groups,
-                           const Set<std::string> &ignored_attributes)
+void geometry_set_gather_instances_attribute_info(Span<GeometryInstanceGroup> set_groups,
+                                                  Span<GeometryComponentType> component_types,
+                                                  const Set<std::string> &ignored_attributes,
+                                                  Map<std::string, AttributeKind> &r_attributes)
 {
   for (const GeometryInstanceGroup &set_group : set_groups) {
     const GeometrySet &set = set_group.geometry_set;
@@ -189,7 +189,7 @@ void gather_attribute_info(Map<std::string, AttributeKind> &attributes,
               {attribute_kind->data_type, meta_data.data_type});
         };
 
-        attributes.add_or_modify(name, add_info, modify_info);
+        r_attributes.add_or_modify(name, add_info, modify_info);
         return true;
       });
     }
@@ -383,10 +383,11 @@ static void join_instance_groups_mesh(Span<GeometryInstanceGroup> set_groups,
 
   /* Don't copy attributes that are stored directly in the mesh data structs. */
   Map<std::string, AttributeKind> attributes;
-  gather_attribute_info(attributes,
-                        component_types,
-                        set_groups,
-                        {"position", "material_index", "normal", "shade_smooth", "crease"});
+  geometry_set_gather_instances_attribute_info(
+      set_groups,
+      component_types,
+      {"position", "material_index", "normal", "shade_smooth", "crease"},
+      attributes);
   join_attributes(
       set_groups, component_types, attributes, static_cast<GeometryComponent &>(dst_component));
 }
@@ -410,7 +411,8 @@ static void join_instance_groups_pointcloud(Span<GeometryInstanceGroup> set_grou
   PointCloud *pointcloud = BKE_pointcloud_new_nomain(totpoint);
   dst_component.replace(pointcloud);
   Map<std::string, AttributeKind> attributes;
-  gather_attribute_info(attributes, {GEO_COMPONENT_TYPE_POINT_CLOUD}, set_groups, {});
+  geometry_set_gather_instances_attribute_info(
+      set_groups, {GEO_COMPONENT_TYPE_POINT_CLOUD}, {}, attributes);
   join_attributes(set_groups,
                   {GEO_COMPONENT_TYPE_POINT_CLOUD},
                   attributes,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 8f0708c9263..2d7c174d5a4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -716,8 +716,8 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
       geometry_set_out.get_component_for_write<PointCloudComponent>();
 
   Map<std::string, AttributeKind> attributes;
-  bke::gather_attribute_info(
-      attributes, {GEO_COMPONENT_TYPE_MESH}, set_groups, {"position", "normal", "id"});
+  bke::geometry_set_gather_instances_attribute_info(
+      set_groups, {GEO_COMPONENT_TYPE_MESH}, {"position", "normal", "id"}, attributes);
   add_remaining_point_attributes(set_groups,
                                  instance_start_offsets,
                                  attributes,



More information about the Bf-blender-cvs mailing list