Fix T45275: F-Curve normalization might corrupt animation

This commit is contained in:
Sergey Sharybin 2015-08-26 15:06:21 +02:00
parent 76df0ec93a
commit 3e4a7f4366
Notes: blender-bot 2023-02-14 08:56:46 +01:00
Referenced by issue #45275, Rig Crash
1 changed files with 11 additions and 1 deletions

View File

@ -289,12 +289,22 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
if (flag & ANIM_UNITCONV_NORMALIZE_FREEZE) {
if (r_offset)
*r_offset = fcu->prev_offset;
if (fcu->prev_norm_factor == 0.0f) {
/* Happens when Auto Normalize was disabled before
* any curves were displayed.
*/
return 1.0f;
}
return fcu->prev_norm_factor;
}
if (G.moving & G_TRANSFORM_FCURVES) {
if (r_offset)
*r_offset = fcu->prev_offset;
if (fcu->prev_norm_factor == 0.0f) {
/* Same as above. */
return 1.0f;
}
return fcu->prev_norm_factor;
}
@ -342,7 +352,7 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
}
offset = -min_coord - range / 2.0f;
}
BLI_assert(factor != 0.0f);
if (r_offset) {
*r_offset = offset;
}