Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-04-11 15:40:07 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-04-11 15:56:08 +0400
commita3f5e6c76f08cfb60556c18e1605ed9b8cfa0d5d (patch)
tree924f351d7912760e4bfb4b4a85d3043e09a9f05b /source/blender/blenkernel/intern/anim.c
parent15169c71a6cdd819ba1bbdf9f0713082d64d8cdc (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/anim.c')
-rw-r--r--source/blender/blenkernel/intern/anim.c27
1 files changed, 18 insertions, 9 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;