[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32406] trunk/blender/source/blender/ blenkernel/intern/armature.c: bugfix [#20761] Bones/Armature: " Inherit Scale" doesn't work if "Inherit Rotation" is disabled

Campbell Barton ideasman42 at gmail.com
Mon Oct 11 06:00:34 CEST 2010


Revision: 32406
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32406
Author:   campbellbarton
Date:     2010-10-11 06:00:33 +0200 (Mon, 11 Oct 2010)

Log Message:
-----------
bugfix [#20761] Bones/Armature: "Inherit Scale" doesn't work if "Inherit Rotation" is disabled

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/armature.c

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c	2010-10-11 02:05:44 UTC (rev 32405)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c	2010-10-11 04:00:33 UTC (rev 32406)
@@ -2239,13 +2239,28 @@
 		offs_bone[3][1]+= parbone->length;
 		
 		/* Compose the matrix for this bone  */
-		if(bone->flag & BONE_HINGE) {	// uses restposition rotation, but actual position
+		if((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) {	// uses restposition rotation, but actual position
 			float tmat[4][4];
-			
 			/* the rotation of the parent restposition */
 			copy_m4_m4(tmat, parbone->arm_mat);
 			mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
 		}
+		else if(bone->flag & BONE_HINGE) {	// same as above but apply parent scale
+			float tmat[4][4];
+
+			/* apply the parent matrix scale */
+			float tsmat[4][4], tscale[3];
+
+			/* the rotation of the parent restposition */
+			copy_m4_m4(tmat, parbone->arm_mat);
+
+			/* extract the scale of the parent matrix */
+			mat4_to_size(tscale, parchan->pose_mat);
+			size_to_mat4(tsmat, tscale);
+			mul_m4_m4m4(tmat, tmat, tsmat);
+
+			mul_serie_m4(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];
 			





More information about the Bf-blender-cvs mailing list