[Bf-blender-cvs] [3e75f70acd7] master: Geometry Nodes: Remove repeated instance attribute names in search

Hans Goudey noreply at git.blender.org
Sun Oct 24 20:24:24 CEST 2021


Commit: 3e75f70acd7d7bb57efd6d07ea05f615d4b12c94
Author: Hans Goudey
Date:   Sun Oct 24 13:24:02 2021 -0500
Branches: master
https://developer.blender.org/rB3e75f70acd7d7bb57efd6d07ea05f615d4b12c94

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

===================================================================

M	source/blender/nodes/intern/geometry_nodes_eval_log.cc

===================================================================

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



More information about the Bf-blender-cvs mailing list