[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19935] trunk/blender/source/blender/src/ poseobject.c: Bugfix #18603: Clear User Transform does not work -- 2.49RC1

Joshua Leung aligorith at gmail.com
Mon Apr 27 02:49:04 CEST 2009


Revision: 19935
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19935
Author:   aligorith
Date:     2009-04-27 02:49:01 +0200 (Mon, 27 Apr 2009)

Log Message:
-----------
Bugfix #18603: Clear User Transform does not work -- 2.49RC1

Modified the behaviour of Clear User Transform so that when there's no action, Clear User Transform now resets the entire pose to the rest pose. However, when there is an action, the pose on selected bones gets cleared to the pose defined in the action, not the rest pose.

Modified Paths:
--------------
    trunk/blender/source/blender/src/poseobject.c

Modified: trunk/blender/source/blender/src/poseobject.c
===================================================================
--- trunk/blender/source/blender/src/poseobject.c	2009-04-26 21:33:22 UTC (rev 19934)
+++ trunk/blender/source/blender/src/poseobject.c	2009-04-27 00:49:01 UTC (rev 19935)
@@ -1748,19 +1748,26 @@
 	if (ob->pose == NULL)
 		return;
 	
-	/* find selected bones */
-	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if (pchan->bone && (pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) {
-			/* just clear the BONE_UNKEYED flag, allowing this bone to get overwritten by actions again */
-			pchan->bone->flag &= ~BONE_UNKEYED;
+	/* if the object has an action, restore pose to the pose defined by the action by clearing pose on selected bones */
+	if (ob->action) {
+		/* find selected bones */
+		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+			if (pchan->bone && (pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) {
+				/* just clear the BONE_UNKEYED flag, allowing this bone to get overwritten by actions again */
+				pchan->bone->flag &= ~BONE_UNKEYED;
+			}
 		}
+		
+		/* clear pose locking flag 
+		 *	- this will only clear the user-defined pose in the selected bones, where BONE_UNKEYED has been cleared
+		 */
+		ob->pose->flag |= POSE_DO_UNLOCK;
 	}
+	else {
+		/* no action, so restore entire pose to rest pose (cannot restore only selected bones) */
+		rest_pose(ob->pose);
+	}
 	
-	/* clear pose locking flag 
-	 *	- this will only clear the user-defined pose in the selected bones, where BONE_UNKEYED has been cleared
-	 */
-	ob->pose->flag |= POSE_DO_UNLOCK;
-	
 	DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
 	BIF_undo_push("Clear User Transform");
 }





More information about the Bf-blender-cvs mailing list