diff options
author | Jacques Lucke <jacques@blender.org> | 2022-04-14 17:31:09 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-04-14 17:31:09 +0300 |
commit | c71013082d096968d33ba977a0fdbcfbfb0690d1 (patch) | |
tree | df09bab6e0405ab79779fe74a21991381ed137e6 /source/blender/nodes/geometry | |
parent | a9b94e5f81ced89381033fd8d13ef6e3489e2665 (diff) |
Geometry Nodes: show used named attributes in nodes
This adds a new node editor overlay that helps users to see where
named attributes are used. This is important, because named
attributes can have name collisions between independent node
groups which can lead to hard to find issues.
Differential Revision: https://developer.blender.org/D14618
Diffstat (limited to 'source/blender/nodes/geometry')
3 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc index f6e2be9119c..6cb9ca642ef 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc @@ -81,11 +81,13 @@ static void node_geo_exec(GeoNodeExecParams params) const std::string name = params.extract_input<std::string>("Name"); - if (!U.experimental.use_named_attribute_nodes) { + if (!U.experimental.use_named_attribute_nodes || name.empty()) { params.set_default_remaining_outputs(); return; } + params.used_named_attribute(name, NamedAttributeUsage::Read); + switch (data_type) { case CD_PROP_FLOAT: params.set_output("Attribute_Float", AttributeFieldInput::Create<float>(std::move(name))); diff --git a/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc index 202241affeb..f46b70c91a9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc @@ -32,6 +32,8 @@ static void node_geo_exec(GeoNodeExecParams params) return; } + params.used_named_attribute(name, NamedAttributeUsage::Remove); + std::atomic<bool> attribute_exists = false; std::atomic<bool> cannot_delete = false; diff --git a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc index 1d1446ce1bd..92614d1a31d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc @@ -127,11 +127,13 @@ static void node_geo_exec(GeoNodeExecParams params) GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); std::string name = params.extract_input<std::string>("Name"); - if (!U.experimental.use_named_attribute_nodes) { + if (!U.experimental.use_named_attribute_nodes || name.empty()) { params.set_output("Geometry", std::move(geometry_set)); return; } + params.used_named_attribute(name, NamedAttributeUsage::Write); + const NodeGeometryStoreNamedAttribute &storage = node_storage(params.node()); const CustomDataType data_type = static_cast<CustomDataType>(storage.data_type); const AttributeDomain domain = static_cast<AttributeDomain>(storage.domain); |