diff options
author | Victor-Louis De Gusseme <victorlouis> | 2021-02-05 17:28:31 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-05 17:28:31 +0300 |
commit | 4d39a0f8eb1103aa58611fff7219f4bf3d70f70f (patch) | |
tree | cd36763c81288f8c35e25deb05bf6da4de57b20b /source/blender/makesrna | |
parent | 7054d03701250b245df9cf60b80c3c5e9aca308f (diff) |
Geometry Nodes: Add Attribute Proximity Node
This node calculates a distance from each point to the closest position
on a target geometry, similar to the vertex weight proximity modifier.
Mapping the output distance to a different range can be done with an
attribute math node after this node.
A drop-down changes whether to calculate distances from points,
edges, or faces. In points mode, the node also calculates distances
from point cloud points.
Design task and use cases: T84842
Differential Revision: https://developer.blender.org/D10154
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index ab6d4fa985c..7f66d5ff70f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -8938,6 +8938,39 @@ static void def_geo_collection_info(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_geo_attribute_proximity(StructRNA *srna) +{ + static const EnumPropertyItem target_geometry_element[] = { + {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_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, + "EDGES", + ICON_NONE, + "Edges", + "Calculate proximity to the target's edges"}, + {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES, + "FACES", + ICON_NONE, + "Faces", + "Calculate proximity to the target's faces"}, + {0, NULL, 0, NULL, NULL}, + }; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeProximity", "storage"); + + 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_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"); +} + /* -------------------------------------------------------------------------- */ static void rna_def_shader_node(BlenderRNA *brna) |