[Bf-blender-cvs] [1d253b66525] master: Fix T103945: incorrect anonymous attribute references

Jacques Lucke noreply at git.blender.org
Tue Jan 17 18:41:22 CET 2023


Commit: 1d253b6652518a68731a5d8a5909c8b29174b894
Author: Jacques Lucke
Date:   Tue Jan 17 18:40:28 2023 +0100
Branches: master
https://developer.blender.org/rB1d253b6652518a68731a5d8a5909c8b29174b894

Fix T103945: incorrect anonymous attribute references

The case where the same field group input is evaluated on
more than one geometry inputs was not handled correctly.

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

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

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

diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 4aec8d405ea..54f8c3c912d 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -2250,15 +2250,18 @@ struct GeometryNodesLazyFunctionGraphBuilder {
       AttributeReferenceKey key;
       key.type = AttributeReferenceKeyType::InputField;
       key.index = relation.field_input;
-      r_attribute_reference_keys.add_new(key);
-      AttributeReferenceInfo info;
-      lf::OutputSocket &lf_field_socket = *const_cast<lf::OutputSocket *>(
-          mapping_->group_input_sockets[relation.field_input]);
-      info.lf_attribute_set_socket = &add_get_attributes_node(lf_field_socket);
+      const int key_index = r_attribute_reference_keys.index_of_or_add(key);
+      if (key_index >= r_attribute_reference_infos.size()) {
+        AttributeReferenceInfo info;
+        lf::OutputSocket &lf_field_socket = *const_cast<lf::OutputSocket *>(
+            mapping_->group_input_sockets[relation.field_input]);
+        info.lf_attribute_set_socket = &add_get_attributes_node(lf_field_socket);
+        r_attribute_reference_infos.append(info);
+      }
+      AttributeReferenceInfo &info = r_attribute_reference_infos[key_index];
       for (const bNode *bnode : btree_.group_input_nodes()) {
         info.initial_geometry_sockets.append(&bnode->output_socket(relation.geometry_input));
       }
-      r_attribute_reference_infos.append(std::move(info));
     }
     /* Find group outputs that attributes need to be propagated to. */
     for (const aal::PropagateRelation &relation : tree_relations.propagate_relations) {



More information about the Bf-blender-cvs mailing list