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>2009-06-21 06:03:50 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-21 06:03:50 +0400
commit6bca54aac17212f9c40b0a54a50a6c39e0817815 (patch)
tree41f9494ad36341d152f85db22cdfb709a61d8ccb /source/blender/editors/space_nla/nla_select.c
parent19c246ce5db212de788ae4b6f0396b9191971d7a (diff)
NLA SoC: Click-Select Operator and TweakMode
To make TweakMode seem less modal/blocking, selection now works in TweakMode. The caveat though, is that TweakMode must be immediately exited as a result of this, or else the internal state could become rather inconsistent and confused. All other operators will still continue to operate as per normal though, since in TweakMode, some operations are still very dangerous.
Diffstat (limited to 'source/blender/editors/space_nla/nla_select.c')
-rw-r--r--source/blender/editors/space_nla/nla_select.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index ee4ed01ab81..28027d0d9cd 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -365,7 +365,7 @@ static EnumPropertyItem prop_nlaedit_leftright_select_types[] = {
{NLAEDIT_LRSEL_NONE, "OFF", 0, "Don't select", ""},
{NLAEDIT_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{NLAEDIT_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, NULL, NULL}
+ {0, NULL, 0, NULL, NULL}
};
/* sensitivity factor for frame-selections */
@@ -375,13 +375,14 @@ static EnumPropertyItem prop_nlaedit_leftright_select_types[] = {
/* ------------------- */
/* option 1) select strip directly under mouse */
-static void mouse_nla_strips (bAnimContext *ac, int mval[2], short select_mode)
+static void mouse_nla_strips (bContext *C, bAnimContext *ac, int mval[2], short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale = NULL;
int filter;
View2D *v2d= &ac->ar->v2d;
+ Scene *scene= ac->scene;
NlaStrip *strip = NULL;
int channel_index;
float xmin, xmax, dummy;
@@ -429,6 +430,12 @@ static void mouse_nla_strips (bAnimContext *ac, int mval[2], short select_mode)
BLI_freelistN(&anim_data);
}
+ /* if currently in tweakmode, exit tweakmode before changing selection states
+ * now that we've found our target...
+ */
+ if (scene->flag & SCE_NLA_EDIT_ON)
+ WM_operator_name_call(C, "NLAEDIT_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL);
+
/* for replacing selection, firstly need to clear existing selection */
if (select_mode == SELECT_REPLACE) {
/* reset selection mode for next steps */
@@ -470,7 +477,7 @@ static void mouse_nla_strips (bAnimContext *ac, int mval[2], short select_mode)
}
/* Option 2) Selects all the strips on either side of the current frame (depends on which side the mouse is on) */
-static void nlaedit_mselect_leftright (bAnimContext *ac, short leftright, short select_mode)
+static void nlaedit_mselect_leftright (bContext *C, bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -479,6 +486,10 @@ static void nlaedit_mselect_leftright (bAnimContext *ac, short leftright, short
Scene *scene= ac->scene;
float xmin, xmax;
+ /* if currently in tweakmode, exit tweakmode first */
+ if (scene->flag & SCE_NLA_EDIT_ON)
+ WM_operator_name_call(C, "NLAEDIT_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL);
+
/* if select mode is replace, deselect all keyframes (and channels) first */
if (select_mode==SELECT_REPLACE) {
select_mode= SELECT_ADD;
@@ -564,11 +575,11 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
else
RNA_int_set(op->ptr, "left_right", NLAEDIT_LRSEL_RIGHT);
- nlaedit_mselect_leftright(&ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
+ nlaedit_mselect_leftright(C, &ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
}
else {
/* select strips based upon mouse position */
- mouse_nla_strips(&ac, mval, selectmode);
+ mouse_nla_strips(C, &ac, mval, selectmode);
}
/* set notifier that things have changed */
@@ -586,7 +597,7 @@ void NLAEDIT_OT_click_select (wmOperatorType *ot)
/* api callbacks - absolutely no exec() this yet... */
ot->invoke= nlaedit_clickselect_invoke;
- ot->poll= nlaop_poll_tweakmode_off;
+ ot->poll= ED_operator_nla_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;