Fix: Changing actions in the Action Editor using the Browse dropdown should happen in tweakmode

When a NLA strip is being tweaked, it should not be possible to use the Action Editor to change
the action that it uses. Instead of changing the action in tweakmode, it now exits tweakmode
first before doing so.
This commit is contained in:
Joshua Leung 2015-04-20 12:28:50 +12:00
parent 5f6b958e96
commit e4fbc8fc8d
1 changed files with 26 additions and 8 deletions

View File

@ -237,6 +237,7 @@ static EnumPropertyItem buttons_texture_context_items[] = {
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_nla.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@ -1223,17 +1224,34 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s
}
/* set action */
// FIXME: this overlaps a lot with the BKE_animdata_set_action() API method
if (adt) {
/* fix id-count of action we're replacing */
if (adt->action) {
id_us_min(&adt->action->id);
/* Don't do anything if old and new actions are the same... */
if (adt->action != saction->action) {
/* NLA Tweak Mode needs special handling... */
if (adt->flag & ADT_NLA_EDIT_ON) {
/* Exit editmode first - we cannot change actions while in tweakmode
* NOTE: This will clear the action ref properly
*/
BKE_nla_tweakmode_exit(adt);
/* Assign new action, and adjust the usercounts accordingly */
adt->action = saction->action;
id_us_plus(&adt->action->id);
}
else {
/* fix id-count of action we're replacing */
if (adt->action) {
id_us_min(&adt->action->id);
}
/* Assign new action, and adjust the usercounts accordingly */
adt->action = saction->action;
id_us_plus(&adt->action->id);
}
}
/* assign new action, and adjust the usercounts accordingly */
adt->action = saction->action;
id_us_plus(&adt->action->id);
/* force update of animdata */
/* Force update of animdata */
adt->recalc |= ADT_RECALC_ANIM;
}