[Bf-blender-cvs] [28cf851a5c3] master: Geometry Nodes: rename attribute domains

Jacques Lucke noreply at git.blender.org
Thu Mar 25 12:03:04 CET 2021


Commit: 28cf851a5c3128b075cb052fef0525351128dce1
Author: Jacques Lucke
Date:   Thu Mar 25 12:01:42 2021 +0100
Branches: master
https://developer.blender.org/rB28cf851a5c3128b075cb052fef0525351128dce1

Geometry Nodes: rename attribute domains

This patch renames two domains:
* `Polygon` -> `Face`
* `Corner` -> `Face Corner`

For the change from `polygon` to `face` I did a "deep rename" where I updated
all (most?) cases where we refere to the attribute domain in code as well.
The change from `corner` to `face corner` is only a ui change. I did not see
a real need to update all code the code for that. It does not seem to improve
the code, more on the contrary.

Ref T86818.

Differential Revision: https://developer.blender.org/D10803

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

M	intern/cycles/blender/blender_mesh.cpp
M	source/blender/blenkernel/BKE_attribute.h
M	source/blender/blenkernel/intern/attribute.c
M	source/blender/blenkernel/intern/attribute_access.cc
M	source/blender/blenkernel/intern/geometry_component_mesh.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc
M	source/blender/makesrna/intern/rna_attribute.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc

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

diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index c7b49354d53..11158532738 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -375,7 +375,7 @@ static void attr_create_generic(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool
       case BL::Attribute::domain_POINT:
         element = ATTR_ELEMENT_VERTEX;
         break;
-      case BL::Attribute::domain_POLYGON:
+      case BL::Attribute::domain_FACE:
         element = ATTR_ELEMENT_FACE;
         break;
       default:
diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h
index a98bfd1e3df..30a595dba8e 100644
--- a/source/blender/blenkernel/BKE_attribute.h
+++ b/source/blender/blenkernel/BKE_attribute.h
@@ -39,12 +39,12 @@ struct ReportList;
 
 /* Attribute.domain */
 typedef enum AttributeDomain {
-  ATTR_DOMAIN_AUTO = -1,   /* Use for nodes to choose automatically based on other data. */
-  ATTR_DOMAIN_POINT = 0,   /* Mesh, Hair or PointCloud Point */
-  ATTR_DOMAIN_EDGE = 1,    /* Mesh Edge */
-  ATTR_DOMAIN_CORNER = 2,  /* Mesh Corner */
-  ATTR_DOMAIN_POLYGON = 3, /* Mesh Polygon */
-  ATTR_DOMAIN_CURVE = 4,   /* Hair Curve */
+  ATTR_DOMAIN_AUTO = -1,  /* Use for nodes to choose automatically based on other data. */
+  ATTR_DOMAIN_POINT = 0,  /* Mesh, Hair or PointCloud Point */
+  ATTR_DOMAIN_EDGE = 1,   /* Mesh Edge */
+  ATTR_DOMAIN_CORNER = 2, /* Mesh Corner */
+  ATTR_DOMAIN_FACE = 3,   /* Mesh Face */
+  ATTR_DOMAIN_CURVE = 4,  /* Hair Curve */
 
   ATTR_DOMAIN_NUM
 } AttributeDomain;
diff --git a/source/blender/blenkernel/intern/attribute.c b/source/blender/blenkernel/intern/attribute.c
index d8fd3a19303..5db45471f0a 100644
--- a/source/blender/blenkernel/intern/attribute.c
+++ b/source/blender/blenkernel/intern/attribute.c
@@ -69,8 +69,8 @@ static void get_domains(ID *id, DomainInfo info[ATTR_DOMAIN_NUM])
       info[ATTR_DOMAIN_EDGE].length = mesh->totedge;
       info[ATTR_DOMAIN_CORNER].customdata = &mesh->ldata;
       info[ATTR_DOMAIN_CORNER].length = mesh->totloop;
-      info[ATTR_DOMAIN_POLYGON].customdata = &mesh->pdata;
-      info[ATTR_DOMAIN_POLYGON].length = mesh->totpoly;
+      info[ATTR_DOMAIN_FACE].customdata = &mesh->pdata;
+      info[ATTR_DOMAIN_FACE].length = mesh->totpoly;
       break;
     }
     case ID_HA: {
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 6a8ceb467e7..05da47aed8e 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -331,7 +331,7 @@ static int attribute_domain_priority(const AttributeDomain domain)
     case ATTR_DOMAIN_CURVE:
       return 0;
 #endif
-    case ATTR_DOMAIN_POLYGON:
+    case ATTR_DOMAIN_FACE:
       return 1;
     case ATTR_DOMAIN_EDGE:
       return 2;
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index 4e51f42876c..4fb7bd6a9bd 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -175,7 +175,7 @@ int MeshComponent::attribute_domain_size(const AttributeDomain domain) const
       return mesh_->totvert;
     case ATTR_DOMAIN_EDGE:
       return mesh_->totedge;
-    case ATTR_DOMAIN_POLYGON:
+    case ATTR_DOMAIN_FACE:
       return mesh_->totpoly;
     default:
       break;
@@ -259,9 +259,9 @@ static ReadAttributePtr adapt_mesh_domain_point_to_corner(const Mesh &mesh,
  * only some values are required.
  */
 template<typename T>
-static void adapt_mesh_domain_corner_to_polygon_impl(const Mesh &mesh,
-                                                     Span<T> old_values,
-                                                     MutableSpan<T> r_values)
+static void adapt_mesh_domain_corner_to_face_impl(const Mesh &mesh,
+                                                  Span<T> old_values,
+                                                  MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totpoly);
   attribute_math::DefaultMixer<T> mixer(r_values);
@@ -277,8 +277,8 @@ static void adapt_mesh_domain_corner_to_polygon_impl(const Mesh &mesh,
   mixer.finalize();
 }
 
-static ReadAttributePtr adapt_mesh_domain_corner_to_polygon(const Mesh &mesh,
-                                                            ReadAttributePtr attribute)
+static ReadAttributePtr adapt_mesh_domain_corner_to_face(const Mesh &mesh,
+                                                         ReadAttributePtr attribute)
 {
   ReadAttributePtr new_attribute;
   const CustomDataType data_type = attribute->custom_data_type();
@@ -286,7 +286,7 @@ static ReadAttributePtr adapt_mesh_domain_corner_to_polygon(const Mesh &mesh,
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totpoly);
-      adapt_mesh_domain_corner_to_polygon_impl<T>(mesh, attribute->get_span<T>(), values);
+      adapt_mesh_domain_corner_to_face_impl<T>(mesh, attribute->get_span<T>(), values);
       new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
                                                                    std::move(values));
     }
@@ -336,9 +336,9 @@ static ReadAttributePtr adapt_mesh_domain_corner_to_edge(const Mesh &mesh,
 }
 
 template<typename T>
-void adapt_mesh_domain_polygon_to_point_impl(const Mesh &mesh,
-                                             Span<T> old_values,
-                                             MutableSpan<T> r_values)
+void adapt_mesh_domain_face_to_point_impl(const Mesh &mesh,
+                                          Span<T> old_values,
+                                          MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totvert);
   attribute_math::DefaultMixer<T> mixer(r_values);
@@ -356,8 +356,8 @@ void adapt_mesh_domain_polygon_to_point_impl(const Mesh &mesh,
   mixer.finalize();
 }
 
-static ReadAttributePtr adapt_mesh_domain_polygon_to_point(const Mesh &mesh,
-                                                           ReadAttributePtr attribute)
+static ReadAttributePtr adapt_mesh_domain_face_to_point(const Mesh &mesh,
+                                                        ReadAttributePtr attribute)
 {
   ReadAttributePtr new_attribute;
   const CustomDataType data_type = attribute->custom_data_type();
@@ -365,7 +365,7 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_point(const Mesh &mesh,
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totvert);
-      adapt_mesh_domain_polygon_to_point_impl<T>(mesh, attribute->get_span<T>(), values);
+      adapt_mesh_domain_face_to_point_impl<T>(mesh, attribute->get_span<T>(), values);
       new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
                                                                    std::move(values));
     }
@@ -374,9 +374,9 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_point(const Mesh &mesh,
 }
 
 template<typename T>
-void adapt_mesh_domain_polygon_to_corner_impl(const Mesh &mesh,
-                                              const Span<T> old_values,
-                                              MutableSpan<T> r_values)
+void adapt_mesh_domain_face_to_corner_impl(const Mesh &mesh,
+                                           const Span<T> old_values,
+                                           MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totloop);
 
@@ -387,8 +387,8 @@ void adapt_mesh_domain_polygon_to_corner_impl(const Mesh &mesh,
   }
 }
 
-static ReadAttributePtr adapt_mesh_domain_polygon_to_corner(const Mesh &mesh,
-                                                            ReadAttributePtr attribute)
+static ReadAttributePtr adapt_mesh_domain_face_to_corner(const Mesh &mesh,
+                                                         ReadAttributePtr attribute)
 {
   ReadAttributePtr new_attribute;
   const CustomDataType data_type = attribute->custom_data_type();
@@ -396,7 +396,7 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_corner(const Mesh &mesh,
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totloop);
-      adapt_mesh_domain_polygon_to_corner_impl<T>(mesh, attribute->get_span<T>(), values);
+      adapt_mesh_domain_face_to_corner_impl<T>(mesh, attribute->get_span<T>(), values);
       new_attribute = std::make_unique<OwnedArrayReadAttribute<T>>(ATTR_DOMAIN_POINT,
                                                                    std::move(values));
     }
@@ -405,9 +405,9 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_corner(const Mesh &mesh,
 }
 
 template<typename T>
-void adapt_mesh_domain_polygon_to_edge_impl(const Mesh &mesh,
-                                            const Span<T> old_values,
-                                            MutableSpan<T> r_values)
+void adapt_mesh_domain_face_to_edge_impl(const Mesh &mesh,
+                                         const Span<T> old_values,
+                                         MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totedge);
   attribute_math::DefaultMixer<T> mixer(r_values);
@@ -423,8 +423,8 @@ void adapt_mesh_domain_polygon_to_edge_impl(const Mesh &mesh,
   mixer.finalize();
 }
 
-static ReadAttributePtr adapt_mesh_domain_polygon_to_edge(const Mesh &mesh,
-                                                          ReadAttributePtr attribute)
+static ReadAttributePtr adapt_mesh_domain_face_to_edge(const Mesh &mesh,
+                                                       ReadAttributePtr attribute)
 {
   ReadAttributePtr new_attribute;
   const CustomDataType data_type = attribute->custom_data_type();
@@ -432,7 +432,7 @@ static ReadAttributePtr adapt_mesh_domain_polygon_to_edge(const Mesh &mesh,
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> value

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list