Revision: 17285
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17285
Author:   aligorith
Date:     2008-11-02 12:01:45 +0100 (Sun, 02 Nov 2008)

Log Message:
-----------
AnimSys2: Eulers for Bones Bugfixes

* AutoIK did not work with euler rotations yet. The conversions were still only 
being done for quats.

* Fixed spelling errors in tooltips

Modified Paths:
--------------
    branches/animsys2/source/blender/src/drawview.c
    branches/animsys2/source/blender/src/transform_conversions.c

Modified: branches/animsys2/source/blender/src/drawview.c
===================================================================
--- branches/animsys2/source/blender/src/drawview.c     2008-11-02 10:04:57 UTC 
(rev 17284)
+++ branches/animsys2/source/blender/src/drawview.c     2008-11-02 11:01:45 UTC 
(rev 17285)
@@ -2061,8 +2061,8 @@
        
        /* rotation mode */
        uiBlockBeginAlign(block);
-       uiDefButS(block, ROW, B_ARMATUREPANEL3, "Quaternion",160,110,70,19, 
&pchan->rotmode, 70, PCHAN_ROT_QUAT, 0, 0, "Rotations calculated using 
Quaternions (4 components, no Gimble Lock, hard to edit)");
-       uiDefButS(block, ROW, B_ARMATUREPANEL3, "Euler",230,110,70,19, 
&pchan->rotmode, 70, PCHAN_ROT_EUL, 0, 0, "Rotations calculated using Eulers (3 
components, suffers from Gimble Lock, 'easy' to edit)");
+       uiDefButS(block, ROW, B_ARMATUREPANEL3, "Quaternion",160,110,70,19, 
&pchan->rotmode, 70, PCHAN_ROT_QUAT, 0, 0, "Rotations calculated using 
Quaternions (4 components, no Gimbal Lock, hard to edit)");
+       uiDefButS(block, ROW, B_ARMATUREPANEL3, "Euler",230,110,70,19, 
&pchan->rotmode, 70, PCHAN_ROT_EUL, 0, 0, "Rotations calculated using Eulers (3 
components, suffers from Gimbal Lock, 'easy' to edit)");
        uiBlockEndAlign(block);
        
        if (pchan->rotmode) {

Modified: branches/animsys2/source/blender/src/transform_conversions.c
===================================================================
--- branches/animsys2/source/blender/src/transform_conversions.c        
2008-11-02 10:04:57 UTC (rev 17284)
+++ branches/animsys2/source/blender/src/transform_conversions.c        
2008-11-02 11:01:45 UTC (rev 17285)
@@ -488,7 +488,7 @@
                                }
                                else {
                                        Mat4CpyMat3(tmat, bone->bone_mat);
-
+                                       
                                        VECCOPY(tmat[3], bone->head);
                                        Mat4Invert(imat, tmat);
                                }
@@ -497,18 +497,25 @@
                                
                                /* apply and decompose, doesn't work for 
constraints or non-uniform scale well */
                                {
-                                       float rmat3[3][3], qmat[3][3], 
imat[3][3], smat[3][3];
+                                       float rmat3[3][3], qrmat[3][3], 
imat[3][3], smat[3][3];
                                        
                                        Mat3CpyMat4(rmat3, rmat);
                                        
-                                       /* quaternion */
-                                       Mat3ToQuat(rmat3, parchan->quat);
+                                       /* rotation */
+                                       if (parchan->rotmode) 
+                                               Mat3ToEul(rmat3, parchan->eul);
+                                       else
+                                               Mat3ToQuat(rmat3, 
parchan->quat);
                                        
                                        /* for size, remove rotation */
                                        /* causes problems with some 
constraints (so apply only if needed) */
                                        if (data->flag & CONSTRAINT_IK_STRETCH) 
{
-                                               QuatToMat3(parchan->quat, qmat);
-                                               Mat3Inv(imat, qmat);
+                                               if (parchan->rotmode)
+                                                       EulToMat3(parchan->eul, 
qrmat);
+                                               else
+                                                       
QuatToMat3(parchan->quat, qrmat);
+                                               
+                                               Mat3Inv(imat, qrmat);
                                                Mat3MulMat3(smat, rmat3, imat);
                                                Mat3ToSize(smat, parchan->size);
                                        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to