[Bf-blender-cvs] [3ca4387] master: UI: remove unnecessary confirmation popups
Emanuel Claesson
noreply at git.blender.org
Mon Nov 25 12:49:18 CET 2013
Commit: 3ca4387bc80b17d945d3ced2f55fd2ae6d962b1b
Author: Emanuel Claesson
Date: Mon Nov 25 04:55:26 2013 +0100
http://developer.blender.org/rB3ca4387bc80b17d945d3ced2f55fd2ae6d962b1b
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
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/BKE_mask.h
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/mask.c
M source/blender/editors/animation/keyframes_general.c
M source/blender/editors/animation/keyframing.c
M source/blender/editors/armature/armature_edit.c
M source/blender/editors/armature/armature_relations.c
M source/blender/editors/gpencil/editaction_gpencil.c
M source/blender/editors/include/ED_gpencil.h
M source/blender/editors/include/ED_keyframes_edit.h
M source/blender/editors/include/ED_mask.h
M source/blender/editors/mask/mask_editaction.c
M source/blender/editors/mask/mask_ops.c
M source/blender/editors/object/object_add.c
M source/blender/editors/screen/screen_ops.c
M source/blender/editors/space_action/action_edit.c
M source/blender/editors/space_clip/clip_graph_ops.c
M source/blender/editors/space_clip/tracking_ops.c
M source/blender/editors/space_graph/graph_edit.c
M source/blender/editors/space_sequencer/sequencer_edit.c
M source/blender/editors/space_view3d/view3d_ops.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 3cb20ea..86c1116 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 d732490..9e7fcb4 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 42e1463..689d0a2 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 b20b429..214c49b 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 cfa5f9f..15abdb4 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 1028fb3..70a3985 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 1bc5bf0..55764a8 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 cd24e94..087e9a8 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
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list