[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24555] trunk/blender/source/blender/ blenkernel/intern: Action Constraints Bugfix:

Joshua Leung aligorith at gmail.com
Sat Nov 14 03:50:47 CET 2009


Revision: 24555
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24555
Author:   aligorith
Date:     2009-11-14 03:50:45 +0100 (Sat, 14 Nov 2009)

Log Message:
-----------
Action Constraints Bugfix:

Action Constraints were failing when the rotation mode was non-default. Fixed this by copying over the current rotation mode when creating temp elements to evaluate with.

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

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2009-11-13 19:25:23 UTC (rev 24554)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2009-11-14 02:50:45 UTC (rev 24555)
@@ -1045,7 +1045,9 @@
 	copy_m4_m4(workob->constinv, ob->constinv);
 	workob->parent= ob->parent;
 	workob->track= ob->track;
-
+	
+	workob->rotmode= ob->rotmode;
+	
 	workob->trackflag= ob->trackflag;
 	workob->upflag= ob->upflag;
 	

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2009-11-13 19:25:23 UTC (rev 24554)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2009-11-14 02:50:45 UTC (rev 24555)
@@ -1925,7 +1925,7 @@
 		 */
 		if (data->type < 10) {
 			/* extract rotation (is in whatever space target should be in) */
-			mat4_to_eul( vec,tempmat);
+			mat4_to_eul(vec, tempmat);
 			vec[0] *= (float)(180.0/M_PI);
 			vec[1] *= (float)(180.0/M_PI);
 			vec[2] *= (float)(180.0/M_PI);
@@ -1933,7 +1933,7 @@
 		}
 		else if (data->type < 20) {
 			/* extract scaling (is in whatever space target should be in) */
-			mat4_to_size( vec,tempmat);
+			mat4_to_size(vec, tempmat);
 			axis= data->type - 10;
 		}
 		else {
@@ -1945,7 +1945,7 @@
 		/* Target defines the animation */
 		s = (vec[axis]-data->min) / (data->max-data->min);
 		CLAMP(s, 0, 1);
-		t = ( s * (data->end-data->start)) + data->start;
+		t = (s * (data->end-data->start)) + data->start;
 		
 		if (G.f & G_DEBUG)
 			printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
@@ -1959,9 +1959,13 @@
 			/* make a temporary pose and evaluate using that */
 			pose = MEM_callocN(sizeof(bPose), "pose");
 			
-			/* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set */
+			/* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set 
+			 *	- we need to manually copy over a few settings, including rotation order, otherwise this fails
+			 */
 			pchan = cob->pchan;
+			
 			tchan= verify_pose_channel(pose, pchan->name);
+			tchan->rotmode= pchan->rotmode;
 			
 			/* evaluate action using workob (it will only set the PoseChannel in question) */
 			what_does_obaction(cob->scene, cob->ob, &workob, pose, data->act, pchan->name, t);





More information about the Bf-blender-cvs mailing list