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:
authorJoshua Leung <aligorith@gmail.com>2009-09-11 16:44:09 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-11 16:44:09 +0400
commitbaf12d3d1712235f94bf7db27aed21421d74efea (patch)
treea8b32f934c0ad05cdc278515433b41046105ad63 /source/blender/editors/transform
parentd5009eb1423c3c0359cbc85c7346412c597b8663 (diff)
2.5 - Rotation work (axis angle bugfixes + cleanups)
* Made transform work better with axis-angle * Corrected the rotation-type handling code in a few places
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c27
-rw-r--r--source/blender/editors/transform/transform_conversions.c3
2 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index ac5d688cd1c..6405e87c4c0 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2673,14 +2673,25 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* this function works on end result */
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
- /* if axis-angle, we now convert the quat representation to axis-angle again
- * - this means that the math above is not totally correct, but it works well enough so far...
- */
- if (td->rotOrder == PCHAN_ROT_AXISANGLE) {
- /* make temp copy (since stored in same place) */
- QuatCopy(quat, td->ext->quat);
- QuatToAxisAngle(quat, &td->ext->quat[1], &td->ext->quat[0]);
- }
+ }
+ else if (td->rotOrder == PCHAN_ROT_AXISANGLE) {
+ /* calculate effect based on quats */
+ float iquat[4];
+
+ /* td->ext->(i)quat is in axis-angle form, not quats! */
+ AxisAngleToQuat(iquat, &td->ext->iquat[1], td->ext->iquat[0]);
+
+ Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ Mat3ToQuat(fmat, quat); // Actual transform
+
+ QuatMul(td->ext->quat, quat, iquat);
+
+ /* this function works on end result */
+ protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
+
+ /* make temp copy (since stored in same place) */
+ QuatCopy(quat, td->ext->quat);
+ QuatToAxisAngle(quat, &td->ext->quat[1], &td->ext->quat[0]);
}
else {
float eulmat[3][3];
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 7a37ffdeeca..e0d058f160f 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -552,9 +552,8 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ob = ob;
td->flag = TD_SELECTED;
- if ((pchan->rotmode == PCHAN_ROT_QUAT) || (pchan->rotmode == PCHAN_ROT_AXISANGLE))
+ if (pchan->rotmode == PCHAN_ROT_QUAT)
{
- // XXX: for now, axis-angle will be treated like for quats (the only difference is the normalisation)
td->flag |= TD_USEQUAT;
}
if (bone->flag & BONE_HINGE_CHILD_TRANSFORM)