Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_space.c34
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;
}