From 2cfc4d76448f66ea09181a1d3343a925e8a155cc Mon Sep 17 00:00:00 2001 From: Iliya Katueshenock Date: Thu, 9 Feb 2023 19:20:39 +0100 Subject: [PATCH] Fix #104383: don't update declaration for clipboard copy When nodes are copied to the clipboard, they don't need their declaration. For nodes with dynamic declaration that might depend on the node tree itself, the declaration could not be build anyway, because the node-clipboard does not have a node tree. Pull Request #104432 --- source/blender/blenkernel/intern/node.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 74351022fd3..cb64ed07e1d 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -2342,8 +2342,10 @@ bNode *node_copy_with_mapping(bNodeTree *dst_tree, node_dst->typeinfo->copyfunc_api(&ptr, &node_src); } - /* Reset the declaration of the new node. */ - nodeDeclarationEnsure(dst_tree, node_dst); + /* Reset the declaration of the new node in real tree. */ + if (dst_tree != nullptr) { + nodeDeclarationEnsure(dst_tree, node_dst); + } return node_dst; } @@ -3617,6 +3619,8 @@ bool nodeDeclarationEnsureOnOutdatedNode(bNodeTree *ntree, bNode *node) return false; } if (node->typeinfo->declare_dynamic) { + BLI_assert(ntree != nullptr); + BLI_assert(node != nullptr); node->runtime->declaration = new blender::nodes::NodeDeclaration(); blender::nodes::build_node_declaration_dynamic(*ntree, *node, *node->runtime->declaration); return true;