diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-04-20 03:28:50 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-04-20 08:27:56 +0300 |
commit | e4fbc8fc8ddf5c212146fa90c38437389ef25db5 (patch) | |
tree | e81873887b24fc7147b3f03cb01df43319633a21 /source/blender/makesrna | |
parent | 5f6b958e969d3300502933ea6276abf46e75c675 (diff) |
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.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8e3c4e5e877..300752d8cf5 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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; } |