diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-05-29 10:07:50 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2016-06-08 22:45:40 +0300 |
commit | d9b926a13ff9a981f599cea29847c90463c754fa (patch) | |
tree | a2e543d49fc65c0ba3d1ad03d3ea1edbb3f4fb94 | |
parent | f640094386900bf2d8b8c90dd0dc1393909807c2 (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...
-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; + } } /* ******************************************* */ |