diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-05-29 10:07:50 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-05-29 10:08:45 +0300 |
commit | df76d60267a5b3e2ecf68d9d60838180f41e537a (patch) | |
tree | 4ce72a3ba68afd3164dbf4fec47d251e48d4569f /source/blender | |
parent | cd4d80fac6d38beab5a4620a46849fd2531810bd (diff) |
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...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 6a19cf679be..172f2b9069e 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; + } } /* ******************************************* */ |