diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-25 11:55:36 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-25 12:09:03 +0300 |
commit | c1f8b9753acd6e61317dd7076eac5408fc48d7e6 (patch) | |
tree | c7b8b4885db9ab2fd3334f4b6bb2863ad13cf1d8 /source/blender/editors/space_view3d/view3d_ops.c | |
parent | 6d8a945f06e3dfd720de4839d9df67989ce32388 (diff) |
Copy/Paste: refactor to be able to paste any kind of IDs, by type.
This commit does not add anything new from user perspective, but make it
possible to paste any kind of IDs, not only objects/collections.
Will be used by new copy/paste in the outliner in next commit.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_ops.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 31c9be02311..1ec75e06cc9 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -107,17 +107,18 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op) flag |= FILE_ACTIVE_COLLECTION; BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend"); - if (BKE_copybuffer_paste(C, str, flag, op->reports)) { - WM_event_add_notifier(C, NC_WINDOW, NULL); - BKE_report(op->reports, RPT_INFO, "Objects pasted from buffer"); - - return OPERATOR_FINISHED; + const int num_pasted = BKE_copybuffer_paste(C, str, flag, op->reports, FILTER_ID_OB); + if (num_pasted == 0) { + BKE_report(op->reports, RPT_INFO, "No buffer to paste from"); + return OPERATOR_CANCELLED; } - BKE_report(op->reports, RPT_INFO, "No buffer to paste from"); + WM_event_add_notifier(C, NC_WINDOW, NULL); + + BKE_reportf(op->reports, RPT_INFO, "%d objects pasted from buffer", num_pasted); - return OPERATOR_CANCELLED; + return OPERATOR_FINISHED; } static void VIEW3D_OT_pastebuffer(wmOperatorType *ot) |