diff options
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 46 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_ops.c | 11 |
4 files changed, 56 insertions, 7 deletions
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 4ed4a3f9514..32a8e660f66 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -291,10 +291,12 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe * 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! + * - we disable "solo" flags too, to make it easier to work with stashed actions + * with less trouble */ if (nlaedit_is_tweakmode_on(ac)) { /* exit tweakmode immediately */ - nlaedit_disable_tweakmode(ac); + nlaedit_disable_tweakmode(ac, true); /* changes to NLA-Action occurred */ notifierFlags |= ND_NLA_ACTCHANGE; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 9ae96292f52..19e6f5a8100 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -111,6 +111,8 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; + + const bool do_solo = RNA_boolean_get(op->ptr, "isolate_action"); bool ok = false; /* get editor data */ @@ -133,6 +135,15 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) /* try entering tweakmode if valid */ ok |= BKE_nla_tweakmode_enter(adt); + + /* mark the active track as being "solo"? */ + if (do_solo && adt->actstrip) { + NlaTrack *nlt = BKE_nlatrack_find_tweaked(adt); + + if (nlt && !(nlt->flag & NLATRACK_SOLO)) { + BKE_nlatrack_solo_toggle(adt, nlt); + } + } } /* free temp data */ @@ -159,6 +170,8 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op) void NLA_OT_tweakmode_enter(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Enter Tweak Mode"; ot->idname = "NLA_OT_tweakmode_enter"; @@ -170,16 +183,22 @@ void NLA_OT_tweakmode_enter(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + prop = RNA_def_boolean(ot->srna, "isolate_action", 0, "Isolate Action", + "Enable 'solo' on the NLA Track containing the active strip, " + "to edit it without seeing the effects of the NLA stack"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* ------------- */ /* NLA Editor internal API function for exiting tweakmode */ -bool nlaedit_disable_tweakmode(bAnimContext *ac) +bool nlaedit_disable_tweakmode(bAnimContext *ac, bool do_solo) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter; + int filter; /* get a list of the AnimData blocks being shown in the NLA */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA); @@ -195,7 +214,14 @@ bool nlaedit_disable_tweakmode(bAnimContext *ac) for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ale->data; - /* to be sure, just exit tweakmode... */ + /* clear solo flags */ + if ((do_solo) & (adt->flag & ADT_NLA_SOLO_TRACK) && + (adt->flag & ADT_NLA_EDIT_ON)) + { + BKE_nlatrack_solo_toggle(adt, NULL); + } + + /* to be sure that we're doing everything right, just exit tweakmode... */ BKE_nla_tweakmode_exit(adt); } @@ -218,9 +244,11 @@ bool nlaedit_disable_tweakmode(bAnimContext *ac) } /* exit tweakmode operator callback */ -static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *UNUSED(op)) +static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op) { bAnimContext ac; + + const bool do_solo = RNA_boolean_get(op->ptr, "isolate_action"); bool ok = false; /* get editor data */ @@ -228,7 +256,7 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* perform operation */ - ok = nlaedit_disable_tweakmode(&ac); + ok = nlaedit_disable_tweakmode(&ac, do_solo); /* success? */ if (ok) @@ -239,6 +267,8 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *UNUSED(op)) void NLA_OT_tweakmode_exit(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Exit Tweak Mode"; ot->idname = "NLA_OT_tweakmode_exit"; @@ -250,6 +280,12 @@ void NLA_OT_tweakmode_exit(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + prop = RNA_def_boolean(ot->srna, "isolate_action", 0, "Isolate Action", + "Disable 'solo' on any of the NLA Tracks after exiting tweak mode " + "to get things back to normal"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* *********************************************** */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 70fdb2d478d..344580c0d15 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -83,7 +83,7 @@ enum eNlaEdit_Snap_Mode { /* --- */ -bool nlaedit_disable_tweakmode(bAnimContext *ac); +bool nlaedit_disable_tweakmode(bAnimContext *ac, bool do_solo); void NLA_OT_tweakmode_enter(wmOperatorType *ot); void NLA_OT_tweakmode_exit(wmOperatorType *ot); diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 43bc4b9df0f..98da10470f8 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -306,6 +306,7 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) void nla_keymap(wmKeyConfig *keyconf) { wmKeyMap *keymap; + wmKeyMapItem *kmi; /* keymap for all regions ------------------------------------------- */ keymap = WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0); @@ -320,6 +321,16 @@ void nla_keymap(wmKeyConfig *keyconf) 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); + /* tweakmode for stashed actions + * - similar to normal tweakmode, except we mark the tracks as being "solo" + * too so that the action can be edited in isolation + */ + kmi = WM_keymap_add_item(keymap, "NLA_OT_tweakmode_enter", TABKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "isolate_action", true); + + kmi = WM_keymap_add_item(keymap, "NLA_OT_tweakmode_exit", TABKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "isolate_action", true); + /* find (i.e. a shortcut for setting the name filter) */ WM_keymap_add_item(keymap, "ANIM_OT_channels_find", FKEY, KM_PRESS, KM_CTRL, 0); |