diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-22 11:04:51 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-22 11:04:51 +0300 |
commit | c77da24116991e1c6c5911e5bc99aa66178e0e7c (patch) | |
tree | a4a5f63fe9b0c243ed94b90d35e5d78478b97c74 /source/blender/editors/animation | |
parent | ca1c7a0cf7a27d513e7f44b8f0e9a967a9dba2d2 (diff) |
Fix non-finite normalization factor in certain cases
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index dbc9c8b4f23..f8b98ebb8b7 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -343,12 +343,13 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo } } - range = max_coord - min_coord; - - if (range > FLT_EPSILON) { - factor = 2.0f / range; + if (max_coord > min_coord) { + range = max_coord - min_coord; + if (range > FLT_EPSILON) { + factor = 2.0f / range; + } + offset = -min_coord - range / 2.0f; } - offset = -min_coord - range / 2.0f; } BLI_assert(factor != 0.0f); if (r_offset) { |