[Bf-blender-cvs] [f80c39b74e3] master: Cleanup: Use shorter enum item names

Hans Goudey noreply at git.blender.org
Wed Aug 25 06:40:22 CEST 2021


Commit: f80c39b74e3ab9c81572e639201e2a3b79c4b5ec
Author: Hans Goudey
Date:   Tue Aug 24 23:40:13 2021 -0500
Branches: master
https://developer.blender.org/rBf80c39b74e3ab9c81572e639201e2a3b79c4b5ec

Cleanup: Use shorter enum item names

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

M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc

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

diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index fd794ed1b21..361fefa59d2 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1836,9 +1836,9 @@ typedef enum NodeShaderOutputTarget {
 /* Geometry Nodes */
 
 typedef enum GeometryNodeAttributeProximityTargetType {
-  GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS = 0,
-  GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES = 1,
-  GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES = 2,
+  GEO_NODE_PROXIMITY_TARGET_POINTS = 0,
+  GEO_NODE_PROXIMITY_TARGET_EDGES = 1,
+  GEO_NODE_PROXIMITY_TARGET_FACES = 2,
 } GeometryNodeAttributeProximityTargetType;
 
 typedef enum GeometryNodeBooleanOperation {
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d8ab7c7a61b..8d672e9b570 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9853,17 +9853,17 @@ static void def_geo_collection_info(StructRNA *srna)
 static void def_geo_attribute_proximity(StructRNA *srna)
 {
   static const EnumPropertyItem target_geometry_element[] = {
-      {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS,
+      {GEO_NODE_PROXIMITY_TARGET_POINTS,
        "POINTS",
        ICON_NONE,
        "Points",
        "Calculate proximity to the target's points (usually faster than the other two modes)"},
-      {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES,
+      {GEO_NODE_PROXIMITY_TARGET_EDGES,
        "EDGES",
        ICON_NONE,
        "Edges",
        "Calculate proximity to the target's edges"},
-      {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES,
+      {GEO_NODE_PROXIMITY_TARGET_FACES,
        "FACES",
        ICON_NONE,
        "Faces",
@@ -9877,7 +9877,7 @@ static void def_geo_attribute_proximity(StructRNA *srna)
 
   prop = RNA_def_property(srna, "target_geometry_element", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, target_geometry_element);
-  RNA_def_property_enum_default(prop, GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES);
+  RNA_def_property_enum_default(prop, GEO_NODE_PROXIMITY_TARGET_FACES);
   RNA_def_property_ui_text(
       prop, "Target Geometry", "Element of the target geometry to calculate the distance from");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc
index ad017ce7cf3..e94267cc936 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc
@@ -53,8 +53,7 @@ static void geo_attribute_proximity_init(bNodeTree *UNUSED(ntree), bNode *node)
   NodeGeometryAttributeProximity *node_storage = (NodeGeometryAttributeProximity *)MEM_callocN(
       sizeof(NodeGeometryAttributeProximity), __func__);
 
-  node_storage->target_geometry_element =
-      GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES;
+  node_storage->target_geometry_element = GEO_NODE_PROXIMITY_TARGET_FACES;
   node->storage = node_storage;
 }
 
@@ -127,13 +126,13 @@ static bool bvh_from_mesh(const Mesh *target_mesh,
 {
   BVHCacheType bvh_type = BVHTREE_FROM_LOOPTRI;
   switch (target_geometry_element) {
-    case GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS:
+    case GEO_NODE_PROXIMITY_TARGET_POINTS:
       bvh_type = BVHTREE_FROM_VERTS;
       break;
-    case GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES:
+    case GEO_NODE_PROXIMITY_TARGET_EDGES:
       bvh_type = BVHTREE_FROM_EDGES;
       break;
-    case GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES:
+    case GEO_NODE_PROXIMITY_TARGET_FACES:
       bvh_type = BVHTREE_FROM_LOOPTRI;
       break;
   }
@@ -189,8 +188,7 @@ static void attribute_calc_proximity(GeometryComponent &component,
   bool bvh_pointcloud_success = false;
   BVHTreeFromPointCloud tree_data_pointcloud;
   if (geometry_set_target.has_pointcloud() &&
-      storage.target_geometry_element ==
-          GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS) {
+      storage.target_geometry_element == GEO_NODE_PROXIMITY_TARGET_POINTS) {
     bvh_pointcloud_success = bvh_from_pointcloud(geometry_set_target.get_pointcloud_for_read(),
                                                  tree_data_pointcloud);
   }



More information about the Bf-blender-cvs mailing list