diff options
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index c3d08b65b57..6f29221196c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1588,14 +1588,14 @@ static void node_unlink_attached(bNodeTree *ntree, bNode *parent) } /** \note caller needs to manage node->id user */ -void nodeFreeNode(bNodeTree *ntree, bNode *node) +static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool use_api_free_cb) { bNodeSocket *sock, *nextsock; char propname_esc[MAX_IDPROP_NAME * 2]; char prefix[MAX_IDPROP_NAME * 2]; /* extra free callback */ - if (node->typeinfo && node->typeinfo->freefunc_api) { + if (use_api_free_cb && node->typeinfo->freefunc_api) { PointerRNA ptr; RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr); @@ -1617,7 +1617,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node) BKE_animdata_fix_paths_remove((ID *)ntree, prefix); - if (ntree->typeinfo && ntree->typeinfo->free_node_cache) + if (ntree->typeinfo->free_node_cache) ntree->typeinfo->free_node_cache(ntree, node); /* texture node has bad habit of keeping exec data around */ @@ -1626,7 +1626,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node) ntree->execdata = NULL; } - if (node->typeinfo && node->typeinfo->freefunc) + if (node->typeinfo->freefunc) node->typeinfo->freefunc(node); } @@ -1654,6 +1654,11 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node) ntree->update |= NTREE_UPDATE_NODES; } +void nodeFreeNode(bNodeTree *ntree, bNode *node) +{ + node_free_node_ex(ntree, node, true); +} + static void node_socket_interface_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock) { if (sock->prop) { @@ -1736,7 +1741,7 @@ void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user) (void)do_id_user; #endif - nodeFreeNode(ntree, node); + node_free_node_ex(ntree, node, false); } /* free interface sockets */ @@ -2507,7 +2512,7 @@ void BKE_node_clipboard_clear(void) for (node = node_clipboard.nodes.first; node; node = node_next) { node_next = node->next; - nodeFreeNode(NULL, node); + node_free_node_ex(NULL, node, false); } node_clipboard.nodes.first = node_clipboard.nodes.last = NULL; |