diff options
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_group.c | 8 |
2 files changed, 11 insertions, 19 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); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index e29d6e054d7..24036a9bf1b 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -404,7 +404,7 @@ static int node_group_separate_selected( for (node = ntree->nodes.first; node; node = node->next) nodeSetSelected(node, false); - /* clear new pointers, set in nodeCopyNode */ + /* clear new pointers, set in BKE_node_copy_ex(). */ for (node = ngroup->nodes.first; node; node = node->next) node->new_node = NULL; @@ -422,7 +422,7 @@ static int node_group_separate_selected( if (make_copy) { /* make a copy */ - newnode = nodeCopyNode(ngroup, node); + newnode = BKE_node_copy_ex(ngroup, node, LIB_ID_COPY_DEFAULT); } else { /* use the existing node */ @@ -541,13 +541,13 @@ static int node_group_separate_exec(bContext *C, wmOperator *op) switch (type) { case NODE_GS_COPY: - if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 1)) { + if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, true)) { BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes"); return OPERATOR_CANCELLED; } break; case NODE_GS_MOVE: - if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 0)) { + if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, false)) { BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes"); return OPERATOR_CANCELLED; } |