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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-04-02 01:16:24 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-04-02 01:16:24 +0400
commitc68588ea988bb2c454ae01936b86a7a84b0420a4 (patch)
treeda8304b319a9138ae685c22b62bd952df61e8109 /source
parentcf12557c5b43ba7bccc22519193902073a0c4bf9 (diff)
Fix for bug #7368: flipping issue with dual quaternions and scaled bones.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/arithb.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index 3514e695f59..d4a1b3a8bfc 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -1727,9 +1727,13 @@ void DQuatToMat4(DualQuat *dq, float mat[][4])
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 @@ void DQuatAddWeighted(DualQuat *dqsum, DualQuat *dq, float weight)
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);