From b2fdc591c36cf5125eaa528b7f735c3c4393d390 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 20 Dec 2013 01:38:07 +0100 Subject: UI: restore confirmation popups for delete operators. It turned out this was leading to accidental deleting in some cases when the info message was missed by users. Fixes T37801. --- source/blender/editors/mask/mask_ops.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/mask') diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 7d7960d2e86..5bc39282eb5 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -38,7 +38,6 @@ #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" @@ -943,12 +942,12 @@ static void delete_feather_points(MaskSplinePoint *point) } } -static int delete_exec(bContext *C, wmOperator *op) +static int delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; - int num_deleted = 0; + bool changed = false; for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { MaskSpline *spline; @@ -984,8 +983,6 @@ static int delete_exec(bContext *C, wmOperator *op) } BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs, tot_point_orig); - - num_deleted++; } else { MaskSplinePoint *new_points; @@ -1013,8 +1010,6 @@ static int delete_exec(bContext *C, wmOperator *op) spline->tot_point--; BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs + j, 1); - - num_deleted++; } } @@ -1026,6 +1021,7 @@ static int delete_exec(bContext *C, wmOperator *op) ED_mask_select_flush_all(mask); } + changed = true; spline = next_spline; } @@ -1036,16 +1032,15 @@ static int delete_exec(bContext *C, wmOperator *op) } } - if (num_deleted == 0) + if (!changed) { return OPERATOR_CANCELLED; + } /* TODO: only update edited splines */ BKE_mask_update_display(mask, CFRA); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - BKE_reportf(op->reports, RPT_INFO, "Deleted %d control points from mask '%s'", num_deleted, mask->id.name); - return OPERATOR_FINISHED; } @@ -1057,6 +1052,7 @@ 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; -- cgit v1.2.3