Quick added feature: the "do not get scaling from parent bone" option.
authorTon Roosendaal <ton@blender.org>
Fri, 9 Nov 2007 14:58:55 +0000 (14:58 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 9 Nov 2007 14:58:55 +0000 (14:58 +0000)
It's next to the 'hinge' button, a small 'S'. No more space here... will
make it nicer inferface later. :)
Let's first see if this works as expected.

source/blender/blenkernel/intern/armature.c
source/blender/makesdna/DNA_armature_types.h
source/blender/src/buttons_editing.c

index 437854b98a66b57d600c694879761dcfde89053a..f688c573bc863ac71bd9501ca95b9785f073de60 100644 (file)
@@ -1999,6 +1999,21 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan, float ctime)
                        
                        Mat4MulSerie(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
                }
+               else if(bone->flag & BONE_NO_SCALE) {
+                       float orthmat[4][4], vec[3];
+                       
+                       /* get the official transform, but we only use the vector from it (optimize...) */
+                       Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+                       VECCOPY(vec, pchan->pose_mat[3]);
+                       
+                       /* do this again, but with an ortho-parent matrix */
+                       Mat4CpyMat4(orthmat, parchan->pose_mat);
+                       Mat4Ortho(orthmat);
+                       Mat4MulSerie(pchan->pose_mat, orthmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+                       
+                       /* copy correct transform */
+                       VECCOPY(pchan->pose_mat[3], vec);
+               }
                else 
                        Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
        }
index 9f64a31c90ca6ba3f5374b80a905f8e8a7e852d7..f178820ac02d0bda1a674dde5b72581d362d50c7 100644 (file)
@@ -150,5 +150,7 @@ typedef struct bArmature {
 #define        BONE_UNKEYED            8192
                        /* set to prevent hinge child bones from influencing the transform center */
 #define        BONE_HINGE_CHILD_TRANSFORM 16384
+                       /* No parent scale */
+#define                BONE_NO_SCALE           (1<<15)
 
 #endif
index fccfe2e98a65d9359b2a6ace879d04c4639c15b3..ba836e84511c3a3df6b6508bf78916f3df1e2d8b 100644 (file)
@@ -3839,10 +3839,11 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm)
                        uiDefButF(block, NUM,B_ARM_RECALCDATA, "Weight:", 225, by-19,105, 18, &curBone->weight, 0.0F, 1000.0F, 10.0F, 0.0F, "Bone deformation weight");
 
                        /* bone types */
-                       uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge",         -10,by-38,85,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
-                       uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform",   75, by-38, 85, 18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
-                       uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 160,by-38,85,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
-                       uiDefButBitI(block, TOG, BONE_HIDDEN_A, REDRAWVIEW3D, "Hide",   245,by-38,85,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in Edit Mode");
+                       uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge",         -10,by-38,80,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
+                       uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S",          70,by-38,20,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
+                       uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform",   90, by-38, 80, 18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
+                       uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 170,by-38,80,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
+                       uiDefButBitI(block, TOG, BONE_HIDDEN_A, REDRAWVIEW3D, "Hide",   250,by-38,80,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in Edit Mode");
                        
                        /* layers */
                        uiBlockBeginAlign(block);
@@ -3934,11 +3935,12 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
                        uiDefButF(block, NUM,B_ARM_RECALCDATA, "Out:",          220, by-19, 110, 19, &curBone->ease2, 0.0, 2.0, 10.0, 0.0, "Second length of Bezier handle");
                        
                        /* bone types */
-                       uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
-                       uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform",   70, by-38, 80, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
-                       uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 150,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
+                       uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge",                 -10,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
+                       uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S",                  70,by-38,20,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit scale from parent Bone");
+                       uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform",   90, by-38, 80, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
+                       uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult",    170,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
                        ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
-                       uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:",      230,by-38,100,19, &pchan->custom, "Object that defines custom draw type for this Bone");
+                       uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:",              250,by-38,80,19, &pchan->custom, "Object that defines custom draw type for this Bone");
                        ob_arm_bone_pchan_lock(ob, arm, curBone, NULL);
                        
                        /* layers */