[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34683] trunk/blender/source/blender/ editors/armature/editarmature.c: Bugfix [#25934] " Apply Visual Transform as Pose" not working?

Joshua Leung aligorith at gmail.com
Mon Feb 7 11:50:36 CET 2011


Revision: 34683
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34683
Author:   aligorith
Date:     2011-02-07 10:50:35 +0000 (Mon, 07 Feb 2011)
Log Message:
-----------
Bugfix [#25934] "Apply Visual Transform as Pose" not working?

Simplified the code for Apply Visual Transform as Pose.

This makes it work for IK chains now, since there aren't any
recalculations of the pose involved now, which were contributing to
the pose getting incorrect as the applying process went on, since the
IK chain was getting calculated differently with each successive
change to the chain.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2011-02-07 09:33:36 UTC (rev 34682)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2011-02-07 10:50:35 UTC (rev 34683)
@@ -729,24 +729,18 @@
 	 * at once are to be predictable*/
 	CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
 	{
-		float delta_mat[4][4], imat[4][4], mat[4][4];
-
-		where_is_pose_bone(scene, ob, pchan, CFRA, 1);
-
-		copy_m4_m4(mat, pchan->pose_mat);
-
-		/* calculate pchan->pose_mat without loc/size/rot & constraints applied */
-		where_is_pose_bone(scene, ob, pchan, CFRA, 0);
-		invert_m4_m4(imat, pchan->pose_mat);
-		mul_m4_m4m4(delta_mat, mat, imat);
-
+		float delta_mat[4][4];
+		
+		/* chan_mat already contains the delta transform from rest pose to pose-mode pose
+		 * as that is baked into there so that B-Bones will work. Once we've set this as the
+		 * new raw-transform components, don't recalc the poses yet, otherwise IK result will 
+		 * change, thus changing the result we may be trying to record.
+		 */
+		copy_m4_m4(delta_mat, pchan->chan_mat);
 		pchan_apply_mat4(pchan, delta_mat, TRUE);
-
-		where_is_pose_bone(scene, ob, pchan, CFRA, 1);
 	}
 	CTX_DATA_END;
-
-	// ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
+	
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
 	/* note, notifier might evolve */




More information about the Bf-blender-cvs mailing list