[Bf-blender-cvs] [d8750aa1daf] master: Fix T103734: reroutes don't propagate attribute references correctly

Jacques Lucke noreply at git.blender.org
Sun Jan 8 15:17:18 CET 2023


Commit: d8750aa1daf327bd3f369c2f4b467a72513bd92f
Author: Jacques Lucke
Date:   Sun Jan 8 15:17:09 2023 +0100
Branches: master
https://developer.blender.org/rBd8750aa1daf327bd3f369c2f4b467a72513bd92f

Fix T103734: reroutes don't propagate attribute references correctly

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

M	source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc

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

diff --git a/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc b/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc
index 9ade129afb5..d355f6a768c 100644
--- a/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc
+++ b/source/blender/blenkernel/intern/node_tree_anonymous_attributes.cc
@@ -14,6 +14,11 @@ namespace blender::bke::anonymous_attribute_inferencing {
 namespace aal = nodes::aal;
 using nodes::NodeDeclaration;
 
+static bool socket_is_field(const bNodeSocket &socket)
+{
+  return socket.display_shape == SOCK_DISPLAY_SHAPE_DIAMOND;
+}
+
 static const aal::RelationsInNode &get_relations_in_node(const bNode &node, ResourceScope &scope)
 {
   if (node.is_group()) {
@@ -22,6 +27,25 @@ static const aal::RelationsInNode &get_relations_in_node(const bNode &node, Reso
       return *group->runtime->anonymous_attribute_relations;
     }
   }
+  if (node.is_reroute()) {
+    const bNodeSocket &socket = node.input_socket(0);
+    if (socket_is_field(socket)) {
+      static const aal::RelationsInNode field_relations = []() {
+        aal::RelationsInNode relations;
+        relations.reference_relations.append({0, 0});
+        return relations;
+      }();
+      return field_relations;
+    }
+    if (socket.type == SOCK_GEOMETRY) {
+      static const aal::RelationsInNode geometry_relations = []() {
+        aal::RelationsInNode relations;
+        relations.propagate_relations.append({0, 0});
+        return relations;
+      }();
+      return geometry_relations;
+    }
+  }
   if (const NodeDeclaration *node_decl = node.declaration()) {
     if (const aal::RelationsInNode *relations = node_decl->anonymous_attribute_relations()) {
       return *relations;
@@ -41,11 +65,6 @@ Array<const aal::RelationsInNode *> get_relations_by_node(const bNodeTree &tree,
   return relations_by_node;
 }
 
-static bool socket_is_field(const bNodeSocket &socket)
-{
-  return socket.display_shape == SOCK_DISPLAY_SHAPE_DIAMOND;
-}
-
 /**
  * Start at a group output socket and find all linked group inputs.
  */



More information about the Bf-blender-cvs mailing list