diff options
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 8321278e058..c14d378e9b7 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1112,15 +1112,10 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) lastnode = ntree->nodes.last; for (node = ntree->nodes.first; node; node = node->next) { if (node->flag & SELECT) { - newnode = nodeCopyNode(ntree, node); - - if (newnode->id) { - /* simple id user adjustment, node internal functions don't touch this - * but operators and readfile.c do. */ - id_us_plus(newnode->id); - /* to ensure redraws or rerenders happen */ - ED_node_tag_update_id(snode->id); - } + newnode = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT); + + /* to ensure redraws or rerenders happen */ + ED_node_tag_update_id(snode->id); } /* make sure we don't copy new nodes again! */ @@ -1926,8 +1921,8 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) for (node = ntree->nodes.first; node; node = node->next) { if (node->flag & SELECT) { - bNode *new_node; - new_node = nodeCopyNode(NULL, node); + /* No ID refcounting, this node is virtual, detached from any actual Blender data currently. */ + bNode *new_node = BKE_node_copy_ex(ntree, node, LIB_ID_CREATE_NO_USER_REFCOUNT); BKE_node_clipboard_add_node(new_node); } } @@ -2047,10 +2042,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) /* copy nodes from clipboard */ for (node = clipboard_nodes_lb->first; node; node = node->next) { - bNode *new_node = nodeCopyNode(ntree, node); - - /* needed since nodeCopyNode() doesn't increase ID's */ - id_us_plus(node->id); + bNode *new_node = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT); /* pasted nodes are selected */ nodeSetSelected(new_node, true); |