[Bf-blender-cvs] [50c7eb14f45] master: Fix T103321: NodeSocket.node is None in Node.copy callback

Hans Goudey noreply at git.blender.org
Sun Dec 18 21:18:12 CET 2022


Commit: 50c7eb14f455de9f932028861899d5d6b6f20527
Author: Hans Goudey
Date:   Sun Dec 18 14:06:43 2022 -0600
Branches: master
https://developer.blender.org/rB50c7eb14f455de9f932028861899d5d6b6f20527

Fix T103321: NodeSocket.node is None in Node.copy callback

Tag the topology cache dirty before Python can do arbitrary things
in the RNA copy callback.

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

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

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

diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 9bc42879d78..84bf186367b 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -2326,6 +2326,10 @@ bNode *node_copy_with_mapping(bNodeTree *dst_tree,
     node_src.typeinfo->copyfunc(dst_tree, node_dst, &node_src);
   }
 
+  if (dst_tree) {
+    BKE_ntree_update_tag_node_new(dst_tree, node_dst);
+  }
+
   /* Only call copy function when a copy is made for the main database, not
    * for cases like the dependency graph and localization. */
   if (node_dst->typeinfo->copyfunc_api && !(flag & LIB_ID_CREATE_NO_MAIN)) {
@@ -2335,10 +2339,6 @@ bNode *node_copy_with_mapping(bNodeTree *dst_tree,
     node_dst->typeinfo->copyfunc_api(&ptr, &node_src);
   }
 
-  if (dst_tree) {
-    BKE_ntree_update_tag_node_new(dst_tree, node_dst);
-  }
-
   /* Reset the declaration of the new node. */
   nodeDeclarationEnsure(dst_tree, node_dst);



More information about the Bf-blender-cvs mailing list