diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 27 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 13 |
3 files changed, 32 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 167baec3d9f..875e19e61e7 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -535,6 +535,9 @@ void calc_curvepath(Object *ob, ListBase *nurbs) bevp = bevpfirst; bevpn = bevp + 1; bevplast = bevpfirst + (bl->nr - 1); + if (UNLIKELY(bevpn > bevplast)) { + bevpn = cycl ? bevpfirst : bevplast; + } fp = dist + 1; maxdist = dist + tot; fac = 1.0f / ((float)path->len - 1.0f); @@ -545,17 +548,23 @@ void calc_curvepath(Object *ob, ListBase *nurbs) d = ((float)a) * fac; /* we're looking for location (distance) 'd' in the array */ - while ((fp < maxdist) && (d >= *fp)) { - fp++; - if (bevp < bevplast) bevp++; - bevpn = bevp + 1; - if (UNLIKELY(bevpn > bevplast)) { - bevpn = cycl ? bevpfirst : bevplast; + if (LIKELY(tot > 0)) { + while ((fp < maxdist) && (d >= *fp)) { + fp++; + if (bevp < bevplast) bevp++; + bevpn = bevp + 1; + if (UNLIKELY(bevpn > bevplast)) { + bevpn = cycl ? bevpfirst : bevplast; + } } + + fac1 = (*(fp) - d) / (*(fp) - *(fp - 1)); + fac2 = 1.0f - fac1; + } + else { + fac1 = 1.0f; + fac1 = 0.0f; } - - fac1 = (*(fp) - d) / (*(fp) - *(fp - 1)); - fac2 = 1.0f - fac1; interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2); pp->vec[3] = fac1 * bevp->alfa + fac2 * bevpn->alfa; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2c945256e92..96da03dde3d 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2872,7 +2872,8 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) /* 2D Curves */ for (bl = bev->first; bl; bl = bl->next) { if (bl->nr < 2) { - /* do nothing */ + BevPoint *bevp = (BevPoint *)(bl + 1); + unit_qt(bevp->quat); } else if (bl->nr == 2) { /* 2 pnt, treat separate */ make_bevel_list_segment_2D(bl); @@ -2886,7 +2887,8 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) /* 3D Curves */ for (bl = bev->first; bl; bl = bl->next) { if (bl->nr < 2) { - /* do nothing */ + BevPoint *bevp = (BevPoint *)(bl + 1); + unit_qt(bevp->quat); } else if (bl->nr == 2) { /* 2 pnt, treat separate */ make_bevel_list_segment_3D(bl); 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 */ |