Revision: 21045
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21045
Author: aligorith
Date: 2009-06-21 04:03:50 +0200 (Sun, 21 Jun 2009)
Log Message:
-----------
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.
Modified Paths:
--------------
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
Modified:
branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
2009-06-21 00:17:45 UTC (rev 21044)
+++ branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
2009-06-21 02:03:50 UTC (rev 21045)
@@ -365,7 +365,7 @@
{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 @@
/* ------------------- */
/* 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 @@
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 @@
}
/* 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 @@
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 @@
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 @@
/* 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;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs