Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-04-05 07:37:28 +0400
committerJoshua Leung <aligorith@gmail.com>2010-04-05 07:37:28 +0400
commit76e483edef060de768a55dc3ded93458deb23240 (patch)
tree3c3f3362a4b5bc3b12912cd3f44e926f82e09705 /source/blender/editors/space_graph/graph_select.c
parentd3293882456abb77ca6af198c6a1ed0ae8812c23 (diff)
Durian Feature Request for Graph Editor: Border Select (optionally) considers handles
Early when implementing the Graph Editor in 2.5, a key complaint that was levelled at the old 'IPO Editor' was that it was a constant annoyance that adjacent handles were getting selected in addition to the keyframes, when only the keyframes were intended. I solved this by making this default to only selecting keyframes and ignoring the handles, but this means that it isn't possible to batch move several handles at once. I've now improved this situation by adding an option to the border select operator (involved using Ctrl-B instead of B) which makes the handles get treated separately (as if they were separate verts, as in 2.4x). The default is still to only select keyframes, to have consistency with the DopeSheet... Also performed some more renaming work in the code...
Diffstat (limited to 'source/blender/editors/space_graph/graph_select.c')
-rw-r--r--source/blender/editors/space_graph/graph_select.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index e15dc797186..c8b31f38f59 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -196,10 +196,11 @@ void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
*/
/* Borderselect only selects keyframes now, as overshooting handles often get caught too,
- * which means that they may be inadvertantly moved as well.
- * Also, for convenience, handles should get same status as keyframe (if it was within bounds)
+ * which means that they may be inadvertantly moved as well. However, incl_handles overrides
+ * this, and allow handles to be considered independently too.
+ * Also, for convenience, handles should get same status as keyframe (if it was within bounds).
*/
-static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, short selectmode)
+static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, short selectmode, short incl_handles)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -227,6 +228,10 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
memset(&ked, 0, sizeof(KeyframeEditData));
ked.data= &rectf;
+ /* treat handles separately? */
+ if (incl_handles)
+ ked.iterflags |= KEYFRAME_ITER_INCL_HANDLES;
+
/* loop over data, doing border select */
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(ac, ale);
@@ -286,16 +291,23 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
short mode=0, selectmode=0;
+ short incl_handles;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
+ /* get select mode
+ * - 'gesture_mode' from the operator specifies how to select
+ * - 'include_handles' from the operator specifies whether to include handles in the selection
+ */
if (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
selectmode= SELECT_ADD;
else
selectmode= SELECT_SUBTRACT;
-
+
+ incl_handles = RNA_boolean_get(op->ptr, "include_handles");
+
/* get settings from operator */
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
@@ -318,7 +330,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
mode= BEZT_OK_REGION;
/* apply borderselect action */
- borderselect_graphkeys(&ac, rect, mode, selectmode);
+ borderselect_graphkeys(&ac, rect, mode, selectmode, incl_handles);
/* send notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_SELECT, NULL);
@@ -347,6 +359,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
WM_operator_properties_gesture_border(ot, FALSE);
ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+ RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria");
}
/* ******************** Column Select Operator **************************** */