diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-04-11 15:40:07 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-04-11 15:56:08 +0400 |
commit | a3f5e6c76f08cfb60556c18e1605ed9b8cfa0d5d (patch) | |
tree | 924f351d7912760e4bfb4b4a85d3043e09a9f05b /source/blender/blenkernel/intern/lattice.c | |
parent | 15169c71a6cdd819ba1bbdf9f0713082d64d8cdc (diff) |
Fix T39266: Weird Skin modifier shutdown
Fix wrong quat being calculated for curve's path.
Also avoid some divisions by zero.
Happened in cases when all the curve points have the same coord.
Diffstat (limited to 'source/blender/blenkernel/intern/lattice.c')
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index c2760b811d5..06a0327149e 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -647,10 +647,17 @@ static bool calc_curve_deform(Scene *scene, Object *par, float co[3], } else { index = axis; - if (cu->flag & CU_STRETCH) + if (cu->flag & CU_STRETCH) { fac = (co[index] - cd->dmin[index]) / (cd->dmax[index] - cd->dmin[index]); - else - fac = +(co[index] - cd->dmin[index]) / (par->curve_cache->path->totdist); + } + else { + if (LIKELY(par->curve_cache->path->totdist > FLT_EPSILON)) { + fac = +(co[index] - cd->dmin[index]) / (par->curve_cache->path->totdist); + } + else { + fac = 0.0f; + } + } } if (where_on_path_deform(par, fac, loc, dir, new_quat, &radius)) { /* returns OK */ |