diff options
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index cba807a436f..25b2180dbb1 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1978,7 +1978,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) bNodeLink *link; int num_nodes; float center[2]; - int is_clipboard_valid; + int is_clipboard_valid, all_nodes_valid; /* validate pointers in the clipboard */ is_clipboard_valid = BKE_node_clipboard_validate(); @@ -2000,6 +2000,17 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Some nodes references could not be restored, will be left empty"); } + /* make sure all clipboard nodes would be valid in the target tree */ + all_nodes_valid = TRUE; + for (node = clipboard_nodes_lb->first; node; node = node->next) { + if (!node->typeinfo->poll_instance(node, ntree)) { + all_nodes_valid = FALSE; + BKE_reportf(op->reports, RPT_ERROR, "Cannot add node %s into node tree %s", node->name, ntree->id.name + 2); + } + } + if (!all_nodes_valid) + return OPERATOR_CANCELLED; + ED_preview_kill_jobs(C); /* deselect old nodes */ |