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
parent 8666791b2e
commit 50c7eb14f4
Notes: blender-bot 2023-05-29 18:25:13 +02:00
Referenced by issue #103405, Regression: Some modifiers not working
Referenced by issue #103327, Cycles GPU crash when switching to Rendered 3DViewport --MacOS 13.1--
Referenced by issue #103336, Blender animation render crashed
Referenced by issue #103321, Regression: NodeSocket.node is None on Node.copy
Referenced by issue #102967, 3.4: Potential candidates for corrective releases
Referenced by issue #108141, Regression: Group Insert operator creates invalid links
1 changed files with 4 additions and 4 deletions

View File

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