diff options
author | Emanuel Claesson <emanuel.claesson@gmail.com> | 2013-11-25 07:55:26 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-11-25 15:21:45 +0400 |
commit | 3ca4387bc80b17d945d3ced2f55fd2ae6d962b1b (patch) | |
tree | 18e50d21863c51a95067176513d225fc0ee802a7 /source/blender/editors/mask/mask_ops.c | |
parent | 20769605593e6f850d30169175a01757f3e0fbb6 (diff) |
UI: remove unnecessary confirmation popups
This makes a number of operators no longer ask for confirmation, rather it will
show an info message after performing the operation. Ref T37422 for decision. In
particular, these were changed:
* Delete objects, bones, keyframes, masks, mask curves, motion tracks, markers.
* Clear and delete keyframes in the 3D view.
* Align bone to parents.
* Separate bones from armature.
* Group/ungroup metastrips in sequencer.
* Copy/paste objects to/from buffer.
Reviewed By: brecht, dingto
Differential Revision: http://developer.blender.org/D35
Diffstat (limited to 'source/blender/editors/mask/mask_ops.c')
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 5ca0d133b0e..aea346b63a6 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -38,6 +38,7 @@ #include "BKE_depsgraph.h" #include "BKE_main.h" #include "BKE_mask.h" +#include "BKE_report.h" #include "DNA_scene_types.h" #include "DNA_mask_types.h" @@ -942,11 +943,12 @@ static void delete_feather_points(MaskSplinePoint *point) } } -static int delete_exec(bContext *C, wmOperator *UNUSED(op)) +static int delete_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; + int num_deleted = 0; for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { MaskSpline *spline; @@ -972,7 +974,6 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) } if (count == 0) { - /* delete the whole spline */ BLI_remlink(&masklay->splines, spline); BKE_mask_spline_free(spline); @@ -983,6 +984,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) } BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs, tot_point_orig); + + num_deleted++; } else { MaskSplinePoint *new_points; @@ -1010,6 +1013,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) spline->tot_point--; BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs + j, 1); + + num_deleted++; } } @@ -1031,12 +1036,19 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) } } - /* TODO: only update edited splines */ - BKE_mask_update_display(mask, CFRA); + if (num_deleted == 0) { + return OPERATOR_CANCELLED; + } + else { + /* TODO: only update edited splines */ + BKE_mask_update_display(mask, CFRA); - WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); + WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - return OPERATOR_FINISHED; + BKE_reportf(op->reports, RPT_INFO, "Deleted selected control points from mask '%s'", mask->id.name); + + return OPERATOR_FINISHED; + } } void MASK_OT_delete(wmOperatorType *ot) @@ -1047,7 +1059,6 @@ void MASK_OT_delete(wmOperatorType *ot) ot->idname = "MASK_OT_delete"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = delete_exec; ot->poll = ED_maskedit_mask_poll; |