[Bf-blender-cvs] [d9b926a] compositor-2016: Fix: Flip logic order for autokeying checking to cope with files where the flags have been set incorrectly

Joshua Leung noreply at git.blender.org
Wed Jun 8 21:51:00 CEST 2016


Commit: d9b926a13ff9a981f599cea29847c90463c754fa
Author: Joshua Leung
Date:   Sun May 29 19:07:50 2016 +1200
Branches: compositor-2016
https://developer.blender.org/rBd9b926a13ff9a981f599cea29847c90463c754fa

Fix: Flip logic order for autokeying checking to cope with files where the flags have been set incorrectly

Sometimes the autokeying flags don't get set correctly (i.e. the "mode" flags
used for 'Add + Replace' vs 'Replace Only' aren't set), meaning that the old logic
would always fall through to the "replace only" case. When this happens, the resulting
behaviour can be quite strange and hard to debug. This fix prevents problems like
this from continuing to be an issue...

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

M	source/blender/editors/animation/keyframing.c

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

diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 6a19cf6..172f2b9 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -2024,17 +2024,25 @@ bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
 	/* only filter if auto-key mode requires this */
 	if (IS_AUTOKEY_ON(scene) == 0)
 		return false;
-		
-	if (IS_AUTOKEY_MODE(scene, NORMAL)) {
-		/* can insert anytime we like... */
-		return true;
-	}
-	else { /* REPLACE */
-		/* for whole block - only key if there's a keyframe on that frame already
-		 *	this is a valid assumption when we're blocking + tweaking
+	
+	if (IS_AUTOKEY_MODE(scene, EDITKEYS)) {
+		/* Replace Mode:
+		 * For whole block, only key if there's a keyframe on that frame already
+		 * This is a valid assumption when we're blocking + tweaking
 		 */
 		return id_frame_has_keyframe(id, cfra, ANIMFILTER_KEYS_LOCAL);
 	}
+	else {
+		/* Normal Mode (or treat as being normal mode):
+		 *
+		 * Just in case the flags are't set properly (i.e. only on/off is set, without a mode)
+		 * let's set the "normal" flag too, so that it will all be sane everywhere...
+		 */
+		scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;
+		
+		/* Can insert anytime we like... */
+		return true;
+	}
 }
 
 /* ******************************************* */




More information about the Bf-blender-cvs mailing list