Cleanup: Use shorter enum item names

This commit is contained in:
Hans Goudey 2021-08-24 23:40:13 -05:00
parent 891e3e98eb
commit f80c39b74e
3 changed files with 12 additions and 14 deletions

View File

@ -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 {

View File

@ -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");

View File

@ -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);
}