[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14311] trunk/blender/source/blender/ blenlib/intern/arithb.c:
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Apr 1 23:16:24 CEST 2008
Revision: 14311
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14311
Author: blendix
Date: 2008-04-01 23:16:24 +0200 (Tue, 01 Apr 2008)
Log Message:
-----------
Fix for bug #7368: flipping issue with dual quaternions and scaled bones.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/arithb.c
Modified: trunk/blender/source/blender/blenlib/intern/arithb.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/arithb.c 2008-04-01 21:09:50 UTC (rev 14310)
+++ trunk/blender/source/blender/blenlib/intern/arithb.c 2008-04-01 21:16:24 UTC (rev 14311)
@@ -1727,9 +1727,13 @@
void DQuatAddWeighted(DualQuat *dqsum, DualQuat *dq, float weight)
{
+ int flipped= 0;
+
/* make sure we interpolate quats in the right direction */
- if (QuatDot(dq->quat, dqsum->quat) < 0)
- weight = -weight;
+ if (QuatDot(dq->quat, dqsum->quat) < 0) {
+ flipped= 1;
+ weight= -weight;
+ }
/* interpolate rotation and translation */
dqsum->quat[0] += weight*dq->quat[0];
@@ -1746,6 +1750,9 @@
if (dq->scale_weight) {
float wmat[4][4];
+ if(flipped) /* we don't want negative weights for scaling */
+ weight= -weight;
+
Mat4CpyMat4(wmat, dq->scale);
Mat4MulFloat((float*)wmat, weight);
Mat4AddMat4(dqsum->scale, dqsum->scale, wmat);
More information about the Bf-blender-cvs
mailing list