From 3e75f70acd7d7bb57efd6d07ea05f615d4b12c94 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sun, 24 Oct 2021 13:24:02 -0500 Subject: 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 --- source/blender/nodes/intern/geometry_nodes_eval_log.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 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}); } }); -- cgit v1.2.3