From 3ca4387bc80b17d945d3ced2f55fd2ae6d962b1b Mon Sep 17 00:00:00 2001 From: Emanuel Claesson Date: Mon, 25 Nov 2013 04:55:26 +0100 Subject: 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 --- source/blender/blenkernel/BKE_gpencil.h | 4 ++-- source/blender/blenkernel/BKE_mask.h | 2 +- source/blender/blenkernel/intern/gpencil.c | 18 +++++++++++----- source/blender/blenkernel/intern/mask.c | 6 +++++- .../blender/editors/animation/keyframes_general.c | 8 +++++-- source/blender/editors/animation/keyframing.c | 14 +++++++----- source/blender/editors/armature/armature_edit.c | 13 +++++++---- .../blender/editors/armature/armature_relations.c | 5 +++-- .../blender/editors/gpencil/editaction_gpencil.c | 9 +++++--- source/blender/editors/include/ED_gpencil.h | 2 +- source/blender/editors/include/ED_keyframes_edit.h | 2 +- source/blender/editors/include/ED_mask.h | 2 +- source/blender/editors/mask/mask_editaction.c | 11 +++++++--- source/blender/editors/mask/mask_ops.c | 25 ++++++++++++++++------ source/blender/editors/object/object_add.c | 6 +++++- source/blender/editors/screen/screen_ops.c | 1 - source/blender/editors/space_action/action_edit.c | 20 +++++++++++------ source/blender/editors/space_clip/clip_graph_ops.c | 9 +++++--- source/blender/editors/space_clip/tracking_ops.c | 9 ++++---- source/blender/editors/space_graph/graph_edit.c | 16 +++++++++----- .../editors/space_sequencer/sequencer_edit.c | 8 ++++--- source/blender/editors/space_view3d/view3d_ops.c | 7 ++++-- 22 files changed, 133 insertions(+), 64 deletions(-) diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 3cb20ead39e..86c111653d1 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -38,7 +38,7 @@ struct bGPDframe; /* ------------ Grease-Pencil API ------------------ */ -void free_gpencil_strokes(struct bGPDframe *gpf); +bool free_gpencil_strokes(struct bGPDframe *gpf); void free_gpencil_frames(struct bGPDlayer *gpl); void free_gpencil_layers(struct ListBase *list); void BKE_gpencil_free(struct bGPdata *gpd); @@ -59,7 +59,7 @@ void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gp struct bGPDframe *BKE_gpencil_layer_find_frame(struct bGPDlayer *gpl, int cframe); struct bGPDframe *gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, short addnew); -void gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf); +bool gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf); struct bGPDlayer *gpencil_layer_getactive(struct bGPdata *gpd); void gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active); void gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl); diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index d73249041e8..9e7fcb4b2a7 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -158,7 +158,7 @@ struct MaskLayerShape *BKE_mask_layer_shape_alloc(struct MaskLayer *masklay, con void BKE_mask_layer_shape_free(struct MaskLayerShape *masklay_shape); struct MaskLayerShape *BKE_mask_layer_shape_verify_frame(struct MaskLayer *masklay, const int frame); struct MaskLayerShape *BKE_mask_layer_shape_duplicate(struct MaskLayerShape *masklay_shape); -void BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape); +bool BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape); void BKE_mask_layer_shape_sort(struct MaskLayer *masklay); bool BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index, diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 42e146301a2..689d0a2cd47 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -58,12 +58,14 @@ /* --------- Memory Management ------------ */ /* Free strokes belonging to a gp-frame */ -void free_gpencil_strokes(bGPDframe *gpf) +bool free_gpencil_strokes(bGPDframe *gpf) { bGPDstroke *gps, *gpsn; + bool modified = gpf->strokes.first != NULL; /* error checking */ - if (gpf == NULL) return; + if (gpf == NULL) + return false; /* free strokes */ for (gps = gpf->strokes.first; gps; gps = gpsn) { @@ -73,6 +75,8 @@ void free_gpencil_strokes(bGPDframe *gpf) if (gps->points) MEM_freeN(gps->points); BLI_freelinkN(&gpf->strokes, gps); } + + return modified; } /* Free all of a gp-layer's frames */ @@ -467,16 +471,20 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, short addnew) } /* delete the given frame from a layer */ -void gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) +bool gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) { + bool modified = false; + /* error checking */ if (ELEM(NULL, gpl, gpf)) - return; + return false; /* free the frame and its data */ - free_gpencil_strokes(gpf); + modified = free_gpencil_strokes(gpf); BLI_freelinkN(&gpl->frames, gpf); gpl->actframe = NULL; + + return modified; } /* get the active gp-layer for editing */ diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index b20b4294f84..214c49bcc83 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1813,11 +1813,15 @@ MaskLayerShape *BKE_mask_layer_shape_duplicate(MaskLayerShape *masklay_shape) return masklay_shape_copy; } -void BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape) +bool BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape) { + bool modified = masklay_shape != NULL; + BLI_remlink(&masklay->splines_shapes, masklay_shape); BKE_mask_layer_shape_free(masklay_shape); + + return modified; } static int mask_layer_shape_sort_cb(void *masklay_shape_a_ptr, void *masklay_shape_b_ptr) diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index cfa5f9f032c..15abdb452ce 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -104,12 +104,13 @@ void delete_fcurve_key(FCurve *fcu, int index, short do_recalc) } /* Delete selected keyframes in given F-Curve */ -void delete_fcurve_keys(FCurve *fcu) +bool delete_fcurve_keys(FCurve *fcu) { int i; + bool modified = false; if (fcu->bezt == NULL) /* ignore baked curves */ - return; + return false; /* Delete selected BezTriples */ for (i = 0; i < fcu->totvert; i++) { @@ -117,12 +118,15 @@ void delete_fcurve_keys(FCurve *fcu) memmove(&fcu->bezt[i], &fcu->bezt[i + 1], sizeof(BezTriple) * (fcu->totvert - i - 1)); fcu->totvert--; i--; + modified = true; } } /* Free the array of BezTriples if there are not keyframes */ if (fcu->totvert == 0) clear_fcurve_keys(fcu); + + return modified; } diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 1028fb30ba4..70a3985c266 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1474,8 +1474,10 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot) * it is more useful for animators working in the 3D view. */ -static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op)) +static int clear_anim_v3d_exec(bContext *C, wmOperator *op) { + int num_removed = 0; + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { /* just those in active action... */ @@ -1515,15 +1517,19 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op)) /* delete F-Curve completely */ if (can_delete) { ANIM_fcurve_delete_from_animdata(NULL, adt, fcu); + num_removed++; } } } - + /* update... */ DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; - + + if (num_removed > 0) + BKE_reportf(op->reports, RPT_INFO, "Deleted %d animation f-curves from selected objects", num_removed); + /* send updates */ WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL); @@ -1538,7 +1544,6 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot) ot->idname = "ANIM_OT_keyframe_clear_v3d"; /* callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = clear_anim_v3d_exec; ot->poll = ED_operator_areaactive; @@ -1602,7 +1607,6 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot) ot->idname = "ANIM_OT_keyframe_delete_v3d"; /* callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = delete_key_v3d_exec; ot->poll = ED_operator_areaactive; diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 1bc5bf0fd74..55764a8919f 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1020,6 +1020,8 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op) if ((arm->flag & ARM_MIRROR_EDIT) && (actmirb->parent)) bone_align_to_bone(arm->edbo, actmirb, actmirb->parent); + + BKE_reportf(op->reports, RPT_INFO, "Aligned bone '%s' to parent", actbone->name); } } else { @@ -1042,8 +1044,10 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; + + BKE_reportf(op->reports, RPT_INFO, "%d bones aligned to bone '%s'", CTX_DATA_COUNT(C, selected_editable_bones), actbone->name); } - + /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob); @@ -1058,7 +1062,6 @@ void ARMATURE_OT_align(wmOperatorType *ot) ot->description = "Align selected bones to the active bone (or to their parent)"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = armature_align_bones_exec; ot->poll = ED_operator_editarmature; @@ -1108,12 +1111,13 @@ void ARMATURE_OT_split(wmOperatorType *ot) /* previously delete_armature */ /* only editmode! */ -static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) +static int armature_delete_selected_exec(bContext *C, wmOperator *op) { bArmature *arm; EditBone *curBone, *ebone_next; bConstraint *con; Object *obedit = CTX_data_edit_object(C); // XXX get from context + int removed_num = 0; arm = obedit->data; /* cancel if nothing selected */ @@ -1170,10 +1174,12 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) if (curBone->flag & BONE_SELECTED) { if (curBone == arm->act_edbone) arm->act_edbone = NULL; ED_armature_edit_bone_remove(arm, curBone); + removed_num++; } } } + BKE_reportf(op->reports, RPT_INFO, "Deleted %d bones", removed_num); ED_armature_sync_selection(arm->edbo); @@ -1190,7 +1196,6 @@ void ARMATURE_OT_delete(wmOperatorType *ot) ot->description = "Remove selected bones from the armature"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = armature_delete_selected_exec; ot->poll = ED_operator_editarmature; diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index cd24e94f9e9..087e9a86241 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -454,7 +454,7 @@ static void separate_armature_bones(Object *ob, short sel) } /* separate selected bones into their armature */ -static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op)) +static int separate_armature_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -520,6 +520,8 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op)) ED_armature_to_edit(obedit); + BKE_report(op->reports, RPT_INFO, "Separated bones"); + /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, obedit); @@ -537,7 +539,6 @@ void ARMATURE_OT_separate(wmOperatorType *ot) ot->description = "Isolate selected bones into a separate armature"; /* callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = separate_armature_exec; ot->poll = ED_operator_editarmature; diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index aee97f40c31..bd35bb1f868 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -209,21 +209,24 @@ void ED_gplayer_frames_select_border(bGPDlayer *gpl, float min, float max, short /* Frame Editing Tools */ /* Delete selected frames */ -void ED_gplayer_frames_delete(bGPDlayer *gpl) +bool ED_gplayer_frames_delete(bGPDlayer *gpl) { bGPDframe *gpf, *gpfn; + bool modified = false; /* error checking */ if (gpl == NULL) - return; + return false; /* check for frames to delete */ for (gpf = gpl->frames.first; gpf; gpf = gpfn) { gpfn = gpf->next; if (gpf->flag & GP_FRAME_SELECT) - gpencil_layer_delframe(gpl, gpf); + modified |= gpencil_layer_delframe(gpl, gpf); } + + return modified; } /* Duplicate selected frames from given gp-layer */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index cb4a81be8b8..4e05c6c9fb6 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -95,7 +95,7 @@ void ED_gplayer_frames_select_border(struct bGPDlayer *gpl, float min, float ma void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode); void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode); -void ED_gplayer_frames_delete(struct bGPDlayer *gpl); +bool ED_gplayer_frames_delete(struct bGPDlayer *gpl); void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl); void ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 3020fe6985a..5718a70208e 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -237,7 +237,7 @@ void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt); /* Destructive Editing API (keyframes_general.c) */ void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc); -void delete_fcurve_keys(struct FCurve *fcu); +bool delete_fcurve_keys(struct FCurve *fcu); void clear_fcurve_keys(struct FCurve *fcu); void duplicate_fcurve_keys(struct FCurve *fcu); diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 8da36f015dc..d128d5389ef 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -82,7 +82,7 @@ void ED_masklayer_frames_select_border(struct MaskLayer *masklay, float min, fl void ED_mask_select_frames(struct MaskLayer *masklay, short select_mode); void ED_mask_select_frame(struct MaskLayer *masklay, int selx, short select_mode); -void ED_masklayer_frames_delete(struct MaskLayer *masklay); +bool ED_masklayer_frames_delete(struct MaskLayer *masklay); void ED_masklayer_frames_duplicate(struct MaskLayer *masklay); void ED_masklayer_snap_frames(struct MaskLayer *masklay, struct Scene *scene, short mode); diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 707622fa841..5c76d464502 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -207,21 +207,26 @@ void ED_masklayer_frames_select_border(MaskLayer *masklay, float min, float max, /* Frame Editing Tools */ /* Delete selected frames */ -void ED_masklayer_frames_delete(MaskLayer *masklay) +bool ED_masklayer_frames_delete(MaskLayer *masklay) { MaskLayerShape *masklay_shape, *masklay_shape_next; + bool modified = false; /* error checking */ if (masklay == NULL) - return; + return false; /* check for frames to delete */ for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape_next) { masklay_shape_next = masklay_shape->next; - if (masklay_shape->flag & MASK_SHAPE_SELECT) + if (masklay_shape->flag & MASK_SHAPE_SELECT) { BKE_mask_layer_shape_unlink(masklay, masklay_shape); + modified = true; + } } + + return modified; } /* Duplicate selected frames from given mask-layer */ 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; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9dd686326bb..8496aaaab4c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1057,6 +1057,7 @@ static int object_delete_exec(bContext *C, wmOperator *op) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; const short use_global = RNA_boolean_get(op->ptr, "use_global"); + int deleted_num = 0; if (CTX_data_edit_object(C)) return OPERATOR_CANCELLED; @@ -1068,6 +1069,7 @@ static int object_delete_exec(bContext *C, wmOperator *op) /* remove from current scene only */ ED_base_object_free_and_unlink(bmain, scene, base); + deleted_num++; if (use_global) { Scene *scene_iter; @@ -1102,6 +1104,9 @@ static int object_delete_exec(bContext *C, wmOperator *op) } } + if (deleted_num > 0) + BKE_reportf(op->reports, RPT_INFO, "Deleted %d objects", deleted_num); + return OPERATOR_FINISHED; } @@ -1113,7 +1118,6 @@ void OBJECT_OT_delete(wmOperatorType *ot) ot->idname = "OBJECT_OT_delete"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = object_delete_exec; ot->poll = ED_operator_objectmode; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 93923c24c84..cd215804f75 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2878,7 +2878,6 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) ot->idname = "SCREEN_OT_region_quadview"; /* api callbacks */ - // ot->invoke = WM_operator_confirm; ot->exec = region_quadview_exec; ot->poll = ED_operator_region_view3d_active; ot->flag = 0; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 7c9d867aad6..d7eb617e56e 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -780,11 +780,12 @@ void ACTION_OT_duplicate(wmOperatorType *ot) /* ******************** Delete Keyframes Operator ************************* */ -static void delete_action_keys(bAnimContext *ac) +static bool delete_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; + bool modified = false; /* filter data */ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) @@ -796,17 +797,17 @@ static void delete_action_keys(bAnimContext *ac) /* loop through filtered data and delete selected keys */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_delete((bGPDlayer *)ale->data); + modified |= ED_gplayer_frames_delete((bGPDlayer *)ale->data); } else if (ale->type == ANIMTYPE_MASKLAYER) { - ED_masklayer_frames_delete((MaskLayer *)ale->data); + modified |= ED_masklayer_frames_delete((MaskLayer *)ale->data); } else { FCurve *fcu = (FCurve *)ale->key_data; AnimData *adt = ale->adt; /* delete selected keyframes only */ - delete_fcurve_keys(fcu); + modified |= delete_fcurve_keys(fcu); /* Only delete curve too if it won't be doing anything anymore */ if ((fcu->totvert == 0) && (list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE) == 0)) @@ -816,20 +817,23 @@ static void delete_action_keys(bAnimContext *ac) /* free filtered list */ BLI_freelistN(&anim_data); + + return modified; } /* ------------------- */ -static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) +static int actkeys_delete_exec(bContext *C, wmOperator *op) { bAnimContext ac; + bool modified; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* delete keyframes */ - delete_action_keys(&ac); + modified = delete_action_keys(&ac); /* validate keyframes after editing */ if (!ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) @@ -838,6 +842,9 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + if (modified) + BKE_report(op->reports, RPT_INFO, "Deleted selected keyframes"); + return OPERATOR_FINISHED; } @@ -849,7 +856,6 @@ void ACTION_OT_delete(wmOperatorType *ot) ot->description = "Remove all selected keyframes"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = actkeys_delete_exec; ot->poll = ED_operator_action_active; diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index d1c44693995..d25c827986b 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -43,6 +43,7 @@ #include "BKE_movieclip.h" #include "BKE_tracking.h" #include "BKE_depsgraph.h" +#include "BKE_report.h" #include "WM_api.h" #include "WM_types.h" @@ -471,16 +472,19 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot) /******************** delete curve operator ********************/ -static int delete_curve_exec(bContext *C, wmOperator *UNUSED(op)) +static int delete_curve_exec(bContext *C, wmOperator *op) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking); - if (act_track) + if (act_track) { clip_delete_track(C, clip, act_track); + BKE_report(op->reports, RPT_INFO, "Deleted all selected curves"); + } + return OPERATOR_FINISHED; } @@ -492,7 +496,6 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot) ot->idname = "CLIP_OT_graph_delete_curve"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = delete_curve_exec; ot->poll = ED_space_clip_tracking_poll; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 5607d7dc635..a5f9960480e 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -234,7 +234,7 @@ void CLIP_OT_add_marker_at_click(wmOperatorType *ot) /********************** delete track operator *********************/ -static int delete_track_exec(bContext *C, wmOperator *UNUSED(op)) +static int delete_track_exec(bContext *C, wmOperator *op) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); @@ -273,6 +273,7 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op)) sc->flag &= ~SC_LOCK_SELECTION; if (modified) { + BKE_report(op->reports, RPT_INFO, "Deleted all selected tracks"); WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); } @@ -287,7 +288,6 @@ void CLIP_OT_delete_track(wmOperatorType *ot) ot->description = "Delete selected tracks"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = delete_track_exec; ot->poll = ED_space_clip_tracking_poll; @@ -297,7 +297,7 @@ void CLIP_OT_delete_track(wmOperatorType *ot) /********************** delete marker operator *********************/ -static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op)) +static int delete_marker_exec(bContext *C, wmOperator *op) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); @@ -350,6 +350,8 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op)) sc->flag &= ~SC_LOCK_SELECTION; } + BKE_report(op->reports, RPT_INFO, "Deleted all selected markers"); + return OPERATOR_FINISHED; } @@ -361,7 +363,6 @@ void CLIP_OT_delete_marker(wmOperatorType *ot) ot->description = "Delete marker for current frame from selected tracks"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = delete_marker_exec; ot->poll = ED_space_clip_tracking_poll; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index db13e2a4024..fd92247ecd8 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -872,11 +872,12 @@ void GRAPH_OT_duplicate(wmOperatorType *ot) /* ******************** Delete Keyframes Operator ************************* */ -static void delete_graph_keys(bAnimContext *ac) +static bool delete_graph_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; + bool modified = false; /* filter data */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); @@ -888,7 +889,7 @@ static void delete_graph_keys(bAnimContext *ac) AnimData *adt = ale->adt; /* delete selected keyframes only */ - delete_fcurve_keys(fcu); + modified |= delete_fcurve_keys(fcu); /* Only delete curve too if it won't be doing anything anymore */ if ((fcu->totvert == 0) && @@ -901,20 +902,23 @@ static void delete_graph_keys(bAnimContext *ac) /* free filtered list */ BLI_freelistN(&anim_data); + + return modified; } /* ------------------- */ -static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) +static int graphkeys_delete_exec(bContext *C, wmOperator *op) { bAnimContext ac; + bool modified; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* delete keyframes */ - delete_graph_keys(&ac); + modified = delete_graph_keys(&ac); /* validate keyframes after editing */ ANIM_editkeyframes_refresh(&ac); @@ -922,6 +926,9 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + if (modified) + BKE_report(op->reports, RPT_INFO, "Deleted selected keyframes"); + return OPERATOR_FINISHED; } @@ -933,7 +940,6 @@ void GRAPH_OT_delete(wmOperatorType *ot) ot->description = "Remove all selected keyframes"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = graphkeys_delete_exec; ot->poll = graphop_editable_keyframes_poll; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 63aa92517a7..42244a0d99e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2064,6 +2064,8 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + BKE_report(op->reports, RPT_INFO, "Grouped selected strips into a metastrip"); + return OPERATOR_FINISHED; } @@ -2075,7 +2077,6 @@ void SEQUENCER_OT_meta_make(wmOperatorType *ot) ot->description = "Group selected strips into a metastrip"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = sequencer_meta_make_exec; ot->poll = sequencer_edit_poll; @@ -2094,7 +2095,7 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) } /* separate_meta_make operator */ -static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) +static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, FALSE); @@ -2135,6 +2136,8 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + BKE_report(op->reports, RPT_INFO, "Metastrip content put back into the sequencer"); + return OPERATOR_FINISHED; } @@ -2146,7 +2149,6 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot) ot->description = "Put the contents of a metastrip back in the sequencer"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = sequencer_meta_separate_exec; ot->poll = sequencer_edit_poll; diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index dec9085baeb..111b2ea3143 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -46,6 +46,7 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_main.h" +#include "BKE_report.h" #include "RNA_access.h" @@ -76,6 +77,8 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op) BLI_make_file_string("/", str, BLI_temporary_dir(), "copybuffer.blend"); BKE_copybuffer_save(str, op->reports); + BKE_report(op->reports, RPT_INFO, "Copied selected objects to buffer"); + return OPERATOR_FINISHED; } @@ -88,7 +91,6 @@ static void VIEW3D_OT_copybuffer(wmOperatorType *ot) ot->description = "Selected objects are saved in a temp file"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = view3d_copybuffer_exec; ot->poll = ED_operator_view3d_active; } @@ -102,6 +104,8 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_WINDOW, NULL); + BKE_report(op->reports, RPT_INFO, "Objects pasted from buffer"); + return OPERATOR_FINISHED; } @@ -114,7 +118,6 @@ static void VIEW3D_OT_pastebuffer(wmOperatorType *ot) ot->description = "Contents of copy buffer gets pasted"; /* api callbacks */ - ot->invoke = WM_operator_confirm; ot->exec = view3d_pastebuffer_exec; ot->poll = ED_operator_view3d_active; -- cgit v1.2.3