[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57907] trunk/blender/source/blender/ editors/space_nla: NLA Bugfix: When clicking on a channel name in the channel list while still in
Joshua Leung
aligorith at gmail.com
Mon Jul 1 16:59:00 CEST 2013
Revision: 57907
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57907
Author: aligorith
Date: 2013-07-01 14:58:59 +0000 (Mon, 01 Jul 2013)
Log Message:
-----------
NLA Bugfix: When clicking on a channel name in the channel list while still in
tweakmode, this will now result in tweakmode being exited instead of going into
a weird limbo-land where channel selection has changed (but tweakmode is still
active but not drawn)
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_nla/nla_channels.c
trunk/blender/source/blender/editors/space_nla/nla_edit.c
trunk/blender/source/blender/editors/space_nla/nla_intern.h
trunk/blender/source/blender/editors/space_nla/nla_ops.c
Modified: trunk/blender/source/blender/editors/space_nla/nla_channels.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_channels.c 2013-07-01 14:49:08 UTC (rev 57906)
+++ trunk/blender/source/blender/editors/space_nla/nla_channels.c 2013-07-01 14:58:59 UTC (rev 57907)
@@ -287,24 +287,34 @@
/* NOTE: rest of NLA-Action name doubles for operating on the AnimData block
* - this is useful when there's no clear divider, and makes more sense in
* the case of users trying to use this to change actions
+ * - in tweakmode, clicking here gets us out of tweakmode, as changing selection
+ * while in tweakmode is really evil!
*/
-
- /* select/deselect */
- if (selectmode == SELECT_INVERT) {
- /* inverse selection status of this AnimData block only */
- adt->flag ^= ADT_UI_SELECTED;
+ if (nlaedit_is_tweakmode_on(ac)) {
+ /* exit tweakmode immediately */
+ nlaedit_disable_tweakmode(ac);
+
+ /* changes to NLA-Action occurred */
+ notifierFlags |= ND_NLA_ACTCHANGE;
}
else {
- /* select AnimData block by itself */
- ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
- adt->flag |= ADT_UI_SELECTED;
+ /* select/deselect */
+ if (selectmode == SELECT_INVERT) {
+ /* inverse selection status of this AnimData block only */
+ adt->flag ^= ADT_UI_SELECTED;
+ }
+ else {
+ /* select AnimData block by itself */
+ ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ adt->flag |= ADT_UI_SELECTED;
+ }
+
+ /* set active? */
+ if (adt->flag & ADT_UI_SELECTED)
+ adt->flag |= ADT_UI_ACTIVE;
+
+ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
-
- /* set active? */
- if (adt->flag & ADT_UI_SELECTED)
- adt->flag |= ADT_UI_ACTIVE;
-
- notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
}
break;
Modified: trunk/blender/source/blender/editors/space_nla/nla_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_edit.c 2013-07-01 14:49:08 UTC (rev 57906)
+++ trunk/blender/source/blender/editors/space_nla/nla_edit.c 2013-07-01 14:58:59 UTC (rev 57907)
@@ -173,26 +173,21 @@
/* ------------- */
-static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op)
+/* NLA Editor internal API function for exiting tweakmode */
+bool nlaedit_disable_tweakmode(bAnimContext *ac)
{
- bAnimContext ac;
-
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- /* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
- return OPERATOR_CANCELLED;
-
/* get a list of the AnimData blocks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* if no blocks, popup error? */
if (anim_data.first == NULL) {
- BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweak mode for");
- return OPERATOR_CANCELLED;
+ BKE_report(ac->reports, RPT_ERROR, "No AnimData blocks in tweak mode to exit from");
+ return false;
}
/* for each AnimData block with NLA-data, try exitting tweak-mode */
@@ -209,17 +204,37 @@
/* if we managed to enter tweakmode on at least one AnimData block,
* set the flag for this in the active scene and send notifiers
*/
- if (ac.scene) {
+ if (ac->scene) {
/* clear editing flag */
- ac.scene->flag &= ~SCE_NLA_EDIT_ON;
+ ac->scene->flag &= ~SCE_NLA_EDIT_ON;
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
+ WM_main_add_notifier(NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
}
/* done */
- return OPERATOR_FINISHED;
+ return true;
}
+
+/* exit tweakmode operator callback */
+static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ bAnimContext ac;
+ bool ok = false;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return OPERATOR_CANCELLED;
+
+ /* perform operation */
+ ok = nlaedit_disable_tweakmode(&ac);
+
+ /* success? */
+ if (ok)
+ return OPERATOR_FINISHED;
+ else
+ return OPERATOR_CANCELLED;
+}
void NLA_OT_tweakmode_exit(wmOperatorType *ot)
{
Modified: trunk/blender/source/blender/editors/space_nla/nla_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_intern.h 2013-07-01 14:49:08 UTC (rev 57906)
+++ trunk/blender/source/blender/editors/space_nla/nla_intern.h 2013-07-01 14:58:59 UTC (rev 57907)
@@ -81,6 +81,8 @@
/* --- */
+bool nlaedit_disable_tweakmode(bAnimContext *ac);
+
void NLA_OT_tweakmode_enter(wmOperatorType *ot);
void NLA_OT_tweakmode_exit(wmOperatorType *ot);
Modified: trunk/blender/source/blender/editors/space_nla/nla_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_ops.c 2013-07-01 14:49:08 UTC (rev 57906)
+++ trunk/blender/source/blender/editors/space_nla/nla_ops.c 2013-07-01 14:58:59 UTC (rev 57907)
@@ -172,8 +172,9 @@
{
wmKeyMapItem *kmi;
- /* NLA-specific (different to standard channels keymap) -------------------------- */
- /* selection */
+ /* keymappings here are NLA-specific (different to standard channels keymap) */
+
+ /* selection --------------------------------------------------------------------- */
/* click-select */
// XXX for now, only leftmouse....
kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0);
@@ -181,7 +182,7 @@
kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
- /* channel operations */
+ /* channel operations ------------------------------------------------------------ */
/* add tracks */
kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "above_selected", FALSE);
@@ -197,7 +198,7 @@
{
wmKeyMapItem *kmi;
- /* selection */
+ /* selection ------------------------------------------------ */
/* click select */
kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
@@ -233,20 +234,14 @@
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "axis_range", TRUE);
- /* view*/
+ /* view ---------------------------------------------------- */
/* auto-set range */
//WM_keymap_add_item(keymap, "NLA_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
WM_keymap_add_item(keymap, "NLA_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NLA_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
- /* editing */
- /* tweakmode
- * - enter and exit are separate operators with the same hotkey...
- * This works as they use different poll()'s
- */
- WM_keymap_add_item(keymap, "NLA_OT_tweakmode_enter", TABKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "NLA_OT_tweakmode_exit", TABKEY, KM_PRESS, 0, 0);
-
+ /* editing ------------------------------------------------ */
+
/* add strips */
WM_keymap_add_item(keymap, "NLA_OT_actionclip_add", AKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "NLA_OT_transition_add", TKEY, KM_PRESS, KM_SHIFT, 0);
@@ -301,11 +296,20 @@
{
wmKeyMap *keymap;
- /* keymap for all regions */
+ /* keymap for all regions ------------------------------------------- */
keymap = WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
+
+ /* region management */
WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0);
- /* channels */
+ /* tweakmode
+ * - enter and exit are separate operators with the same hotkey...
+ * This works as they use different poll()'s
+ */
+ WM_keymap_add_item(keymap, "NLA_OT_tweakmode_enter", TABKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "NLA_OT_tweakmode_exit", TABKEY, KM_PRESS, 0, 0);
+
+ /* channels ---------------------------------------------------------- */
/* Channels are not directly handled by the NLA Editor module, but are inherited from the Animation module.
* Most of the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as there
* are many similarities with the other Animation Editors.
@@ -315,7 +319,7 @@
keymap = WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
nla_keymap_channels(keymap);
- /* data */
+ /* data ------------------------------------------------------------- */
keymap = WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
nla_keymap_main(keyconf, keymap);
}
More information about the Bf-blender-cvs
mailing list