[Bf-blender-cvs] [e4fbc8f] master: Fix: Changing actions in the Action Editor using the Browse dropdown should happen in tweakmode

Joshua Leung noreply at git.blender.org
Mon Apr 20 07:29:31 CEST 2015


Commit: e4fbc8fc8ddf5c212146fa90c38437389ef25db5
Author: Joshua Leung
Date:   Mon Apr 20 12:28:50 2015 +1200
Branches: master
https://developer.blender.org/rBe4fbc8fc8ddf5c212146fa90c38437389ef25db5

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.

===================================================================

M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8e3c4e5..300752d 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;
 		}




More information about the Bf-blender-cvs mailing list