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...
This commit is contained in:
Joshua Leung 2016-05-29 19:07:50 +12:00
parent cd4d80fac6
commit df76d60267
1 changed files with 16 additions and 8 deletions

View File

@ -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;
}
}
/* ******************************************* */