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.
This commit is contained in:
Hans Goudey 2022-12-18 14:06:43 -06:00 committed by Thomas Dinges
parent b64a80edd5
commit c79d853e4d
Notes: blender-bot 2023-02-14 03:31:57 +01:00
Referenced by issue #103321, Regression: NodeSocket.node is None on Node.copy
Referenced by issue #102967, 3.4: Potential candidates for corrective releases
1 changed files with 4 additions and 4 deletions

View File

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