diff options
author | Hans Goudey <h.goudey@me.com> | 2021-10-24 21:24:02 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-10-24 21:24:02 +0300 |
commit | 3e75f70acd7d7bb57efd6d07ea05f615d4b12c94 (patch) | |
tree | a40a071bd2c2975aab43bf88d1cd308b76ca5d1f /source/blender/nodes/intern/geometry_nodes_eval_log.cc | |
parent | 6f0dd4f0f045916c9a4b4fc786a69fd7b7d2d530 (diff) |
Geometry Nodes: Remove repeated instance attribute names in search
This commit makes sure that each attribute name is only added once
when logging geometry values for attribute search.
The `attribute_foreach` function for a single geometry component
deduplicated names, but a much more common situation is to have
more than one component in the instances of a geometry set.
Differential Revision: https://developer.blender.org/D12959
Diffstat (limited to 'source/blender/nodes/intern/geometry_nodes_eval_log.cc')
-rw-r--r-- | source/blender/nodes/intern/geometry_nodes_eval_log.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/nodes/intern/geometry_nodes_eval_log.cc b/source/blender/nodes/intern/geometry_nodes_eval_log.cc index 852f52f38cd..92f20656609 100644 --- a/source/blender/nodes/intern/geometry_nodes_eval_log.cc +++ b/source/blender/nodes/intern/geometry_nodes_eval_log.cc @@ -175,13 +175,19 @@ GeometryValueLog::GeometryValueLog(const GeometrySet &geometry_set, bool log_ful GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_VOLUME}; + + /* Keep track handled attribute names to make sure that we do not return the same name twice. + * Currently #GeometrySet::attribute_foreach does not do that. Note that this will merge + * attributes with the same name but different domains or data types on separate components. */ + Set<StringRef> names; + geometry_set.attribute_foreach( all_component_types, true, [&](const bke::AttributeIDRef &attribute_id, const AttributeMetaData &meta_data, const GeometryComponent &UNUSED(component)) { - if (attribute_id.is_named()) { + if (attribute_id.is_named() && names.add(attribute_id.name())) { this->attributes_.append({attribute_id.name(), meta_data.domain, meta_data.data_type}); } }); |