From fd29a161cc892730859f6b28a026460f9dd4a1c5 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 22 Apr 2021 15:50:29 +0200 Subject: Fix Action Editor unlink button when in tweak mode When in NLA tweak mode, the action unlink button in the Dopesheet / Action Editor should be a mere shortcut to exiting tweak mode [nothing else]. Instead, it was also clearing the action fully, not returning to the previous edited action before going into tweak mode. Now dont "flush" by clearing the action, instead exit tweakmode, clear the scenes SCE_NLA_EDIT_ON flag (if this isnt done some NLA operators like pushdown were not immediately available because their poll checked this flag) and send appropriate notifier to have everything update nicely. Part of T87681 (Bug 4/5/6). Maniphest Tasks: T87681 Differential Revision: https://developer.blender.org/D11052 --- source/blender/editors/space_action/action_data.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_action') diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index d69c7ab8d48..717d87c4972 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -599,16 +599,13 @@ void ED_animedit_unlink_action( id_fake_user_clear(&act->id); } - /* If in Tweak Mode, don't unlink. Instead, this - * becomes a shortcut to exit Tweak Mode instead - */ + /* If in Tweak Mode, don't unlink. Instead, this becomes a shortcut to exit Tweak Mode. */ if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { - /* Exit Tweak Mode */ BKE_nla_tweakmode_exit(adt); - /* Flush this to the Action Editor (if that's where this change was initiated) */ - if (area->spacetype == SPACE_ACTION) { - actedit_change_action(C, NULL); + Scene *scene = CTX_data_scene(C); + if (scene != NULL) { + scene->flag &= ~SCE_NLA_EDIT_ON; } } else { @@ -660,6 +657,9 @@ static int action_unlink_exec(bContext *C, wmOperator *op) ED_animedit_unlink_action(C, NULL, adt, adt->action, op->reports, force_delete); } + /* Unlink is also abused to exit NLA tweak mode. */ + WM_main_add_notifier(NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); + return OPERATOR_FINISHED; } -- cgit v1.2.3