[Bf-blender-cvs] [e1fe1fcc793] master: Cleanup: rename AttributeInfo to AttributeKind

Jacques Lucke noreply at git.blender.org
Thu Feb 18 12:33:03 CET 2021


Commit: e1fe1fcc79377645cca1286c80f3aeee5b736388
Author: Jacques Lucke
Date:   Thu Feb 18 12:32:34 2021 +0100
Branches: master
https://developer.blender.org/rBe1fe1fcc79377645cca1286c80f3aeee5b736388

Cleanup: rename AttributeInfo to AttributeKind

"Kind" is a bit less generic than "Info" for me. Especially, it implies
that the struct does not contain the name of a specific attribute
(for me anyway).

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

M	source/blender/blenkernel/BKE_geometry_set_instances.hh
M	source/blender/blenkernel/intern/geometry_set_instances.cc

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

diff --git a/source/blender/blenkernel/BKE_geometry_set_instances.hh b/source/blender/blenkernel/BKE_geometry_set_instances.hh
index f918adaff7c..16c28e32e3c 100644
--- a/source/blender/blenkernel/BKE_geometry_set_instances.hh
+++ b/source/blender/blenkernel/BKE_geometry_set_instances.hh
@@ -44,7 +44,7 @@ Vector<GeometryInstanceGroup> geometry_set_gather_instances(const GeometrySet &g
 GeometrySet geometry_set_realize_mesh_for_modifier(const GeometrySet &geometry_set);
 GeometrySet geometry_set_realize_instances(const GeometrySet &geometry_set);
 
-struct AttributeInfo {
+struct AttributeKind {
   CustomDataType data_type;
   AttributeDomain domain;
 };
@@ -54,7 +54,7 @@ struct AttributeInfo {
  * 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, AttributeInfo> &attributes,
+void gather_attribute_info(Map<std::string, AttributeKind> &attributes,
                            Span<GeometryComponentType> component_types,
                            Span<bke::GeometryInstanceGroup> set_groups,
                            const Set<std::string> &ignored_attributes);
diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc
index 66c7f53cdf5..b315ff8a509 100644
--- a/source/blender/blenkernel/intern/geometry_set_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_set_instances.cc
@@ -165,7 +165,7 @@ Vector<GeometryInstanceGroup> geometry_set_gather_instances(const GeometrySet &g
   return result_vector;
 }
 
-void gather_attribute_info(Map<std::string, AttributeInfo> &attributes,
+void gather_attribute_info(Map<std::string, AttributeKind> &attributes,
                            Span<GeometryComponentType> component_types,
                            Span<GeometryInstanceGroup> set_groups,
                            const Set<std::string> &ignored_attributes)
@@ -189,14 +189,14 @@ void gather_attribute_info(Map<std::string, AttributeInfo> &attributes,
         const AttributeDomain domain = read_attribute->domain();
         const CustomDataType data_type = read_attribute->custom_data_type();
 
-        auto add_info = [&, data_type, domain](AttributeInfo *info) {
-          info->domain = domain;
-          info->data_type = data_type;
+        auto add_info = [&, data_type, domain](AttributeKind *attribute_kind) {
+          attribute_kind->domain = domain;
+          attribute_kind->data_type = data_type;
         };
-        auto modify_info = [&, data_type, domain](AttributeInfo *info) {
-          info->domain = domain; /* TODO: Use highest priority domain. */
-          info->data_type = bke::attribute_data_type_highest_complexity(
-              {info->data_type, data_type});
+        auto modify_info = [&, data_type, domain](AttributeKind *attribute_kind) {
+          attribute_kind->domain = domain; /* TODO: Use highest priority domain. */
+          attribute_kind->data_type = bke::attribute_data_type_highest_complexity(
+              {attribute_kind->data_type, data_type});
         };
 
         attributes.add_or_modify(name, add_info, modify_info);
@@ -315,10 +315,10 @@ static Mesh *join_mesh_topology_and_builtin_attributes(Span<GeometryInstanceGrou
 
 static void join_attributes(Span<GeometryInstanceGroup> set_groups,
                             Span<GeometryComponentType> component_types,
-                            const Map<std::string, AttributeInfo> &attribute_info,
+                            const Map<std::string, AttributeKind> &attribute_info,
                             GeometryComponent &result)
 {
-  for (Map<std::string, AttributeInfo>::Item entry : attribute_info.items()) {
+  for (Map<std::string, AttributeKind>::Item entry : attribute_info.items()) {
     StringRef name = entry.key;
     const AttributeDomain domain_output = entry.value.domain;
     const CustomDataType data_type_output = entry.value.data_type;
@@ -383,7 +383,7 @@ 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, AttributeInfo> attributes;
+  Map<std::string, AttributeKind> attributes;
   gather_attribute_info(attributes, component_types, set_groups, {"position", "material_index"});
   join_attributes(
       set_groups, component_types, attributes, static_cast<GeometryComponent &>(dst_component));
@@ -404,7 +404,7 @@ static void join_instance_groups_pointcloud(Span<GeometryInstanceGroup> set_grou
   PointCloudComponent &dst_component = result.get_component_for_write<PointCloudComponent>();
   PointCloud *pointcloud = BKE_pointcloud_new_nomain(totpoint);
   dst_component.replace(pointcloud);
-  Map<std::string, AttributeInfo> attributes;
+  Map<std::string, AttributeKind> attributes;
   gather_attribute_info(attributes, {GeometryComponentType::PointCloud}, set_groups, {});
   join_attributes(set_groups,
                   {GeometryComponentType::PointCloud},



More information about the Bf-blender-cvs mailing list