diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-01 03:31:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-01 03:31:10 +0400 |
commit | bf3374426abe1382718120830572cd5775c4bf82 (patch) | |
tree | 97dc429524a1648322f19d7517fbf5315ca46be5 /source/blender/blenkernel/intern/anim.c | |
parent | bff893a42047cfc92671f878109c1ff17ce5f8a2 (diff) |
Use curve twist for the CurveDeform modifier and bones (anything that uses curve_deform_verts() and curve_deform_vector()).
So means minimum twist and twist smoothing are now used.
the Z up quaternion from the path is rotated to match the up axis given.
There was no logical rule for the up vector, some cases flipped the normals when used with the CurveDeform modifier.
Use the default X-Up behavior and match other settings with this. (comments explain this in detail).
- Interpolating quaternions didn't work in some cases, disabled for now.
- 'no_rot_axis' is different from in 2.4x since it now removes rotation from the tilt whereas before it edited the axis before calculating the tilt.
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index e943d92a0b5..bd779935d55 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -280,17 +280,27 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat, if (quat) { float totfac, q1[4], q2[4]; + /* checks for totfac are needed when 'fac' is 1.0 key_curve_position_weights can assign zero + * to more then one index in data which can give divide by zero error */ +/* totfac= data[0]+data[1]; - QuatInterpol(q1, p0->quat, p1->quat, data[0] / totfac); + if(totfac>0.000001) QuatInterpol(q1, p0->quat, p1->quat, data[0] / totfac); + else QUATCOPY(q1, p1->quat); + NormalQuat(q1); totfac= data[2]+data[3]; - QuatInterpol(q2, p2->quat, p3->quat, data[2] / totfac); + if(totfac>0.000001) QuatInterpol(q2, p2->quat, p3->quat, data[2] / totfac); + else QUATCOPY(q1, p3->quat); NormalQuat(q2); totfac = data[0]+data[1]+data[2]+data[3]; - QuatInterpol(quat, q1, q2, (data[0]+data[1]) / totfac); + if(totfac>0.000001) QuatInterpol(quat, q1, q2, (data[0]+data[1]) / totfac); + else QUATCOPY(quat, q2); NormalQuat(quat); + */ + // XXX - find some way to make quat interpolation work correctly, above code fails in rare but nasty cases. + QUATCOPY(quat, p1->quat); } if(radius) |