[Bf-blender-cvs] [c79d853e4d4] blender-v3.4-release: Fix T103321: NodeSocket.node is None in Node.copy callback

Hans Goudey noreply at git.blender.org
Mon Dec 19 10:30:08 CET 2022


Commit: c79d853e4d475e0ceb07b43f76b5420663155840
Author: Hans Goudey
Date:   Sun Dec 18 14:06:43 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBc79d853e4d475e0ceb07b43f76b5420663155840

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 59c2769869d..bffc5fc2e39 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -2323,6 +2323,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)) {
@@ -2332,10 +2336,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