[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18646] branches/blender2.5/blender/source /blender: 2.5 - Pose-Channel (i.e.

Joshua Leung aligorith at gmail.com
Sat Jan 24 11:03:23 CET 2009


Revision: 18646
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18646
Author:   aligorith
Date:     2009-01-24 11:03:19 +0100 (Sat, 24 Jan 2009)

Log Message:
-----------
2.5 - Pose-Channel (i.e. PoseMode bone) Transforms work again

In the brief tests I did on a few rigs, this seems to work ok. Martin may want to check on the code for any cleanups that may be needed here.

Coming soon will be some modifications to the primative insert-key operator added earlier, so that Animato can be used to animate characters!

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-24 09:55:31 UTC (rev 18645)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-24 10:03:19 UTC (rev 18646)
@@ -866,7 +866,7 @@
 	}
 }
 
-/* Convert Action-block to new system
+/* Convert Action-block to new system 
  * NOTE: we need to be careful here, as same data-structs are used for new system too!
  */
 static void action_to_animdata (ID *id, bAction *act)

Modified: branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c	2009-01-24 09:55:31 UTC (rev 18645)
+++ branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c	2009-01-24 10:03:19 UTC (rev 18646)
@@ -98,6 +98,7 @@
 #include "BKE_utildefines.h"
 #include "BKE_bmesh.h"
 #include "BKE_context.h"
+#include "BKE_report.h"
 
 //#include "BIF_editaction.h"
 //#include "BIF_editview.h"
@@ -579,7 +580,7 @@
 	/* proper way to get parent transform + own transform + constraints transform */
 	Mat3CpyMat4(omat, ob->obmat);
 	
-	if(pchan->parent) { 	 
+	if (pchan->parent) { 	 
 		if(pchan->bone->flag & BONE_HINGE) 	 
 			Mat3CpyMat4(pmat, pchan->parent->bone->arm_mat); 	 
 		else 	 
@@ -610,7 +611,7 @@
 	Mat3MulMat3(td->axismtx, omat, pmat);
 	Mat3Ortho(td->axismtx);
 	
-	if(t->mode==TFM_BONESIZE) {
+	if (t->mode==TFM_BONESIZE) {
 		bArmature *arm= t->poseobj->data;
 		
 		if(arm->drawtype==ARM_ENVELOPE) {
@@ -627,7 +628,7 @@
 	}
 	
 	/* in this case we can do target-less IK grabbing */
-	if(t->mode==TFM_TRANSLATION) {
+	if (t->mode==TFM_TRANSLATION) {
 		bKinematicConstraint *data= has_targetless_ik(pchan);
 		if(data) {
 			if(data->flag & CONSTRAINT_IK_TIP) {
@@ -689,7 +690,7 @@
 				bone->flag |= BONE_TRANSFORM;
 			else
 				bone->flag &= ~BONE_TRANSFORM;
-
+			
 			bone->flag &= ~BONE_HINGE_CHILD_TRANSFORM;
 			bone->flag &= ~BONE_TRANSFORM_CHILD;
 		}
@@ -952,8 +953,6 @@
 /* only called with pose mode active object now */
 static void createTransPose(bContext *C, TransInfo *t, Object *ob)
 {
-	// TRANSFORM_FIX_ME
-#if 0
 	bArmature *arm;
 	bPoseChannel *pchan;
 	TransData *td;
@@ -964,16 +963,16 @@
 	t->total= 0;
 	
 	/* check validity of state */
-	arm=get_armature (ob);
-	if (arm==NULL || ob->pose==NULL) return;
+	arm= get_armature(ob);
+	if ((arm==NULL) || (ob->pose==NULL)) return;
 	
 	if (arm->flag & ARM_RESTPOS) {
-		if(ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) {
-			notice("Pose edit not possible while Rest Position is enabled");
+		if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) {
+			//notice("Pose edit not possible while Rest Position is enabled");
+			BKE_report(CTX_reports(C), RPT_ERROR, "Can't select linked when sync selection is enabled.");
 			return;
 		}
 	}
-	if (!(ob->lay & G.vd->lay)) return;
 
 	/* do we need to add temporal IK chains? */
 	if ((arm->flag & ARM_AUTO_IK) && t->mode==TFM_TRANSLATION) {
@@ -989,10 +988,6 @@
 	t->flag |= T_POSE;
 	t->poseobj= ob;	/* we also allow non-active objects to be transformed, in weightpaint */
 	
-	/* make sure the lock is set OK, unlock can be accidentally saved? */
-	ob->pose->flag |= POSE_LOCKED;
-	ob->pose->flag &= ~POSE_DO_UNLOCK;
-
 	/* init trans data */
     td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone");
     tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt");
@@ -1004,18 +999,20 @@
 	
 	/* use pose channels to fill trans data */
 	td= t->data;
-	for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if(pchan->bone->flag & BONE_TRANSFORM) {
+	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+		if (pchan->bone->flag & BONE_TRANSFORM) {
 			add_pose_transdata(t, pchan, ob, td);
 			td++;
 		}
 	}
 	
-	if(td != (t->data+t->total)) printf("Bone selection count error\n");
+	if(td != (t->data+t->total)) {
+		// printf("Bone selection count error\n");
+		BKE_report(CTX_reports(C), RPT_DEBUG, "Bone selection count error.");
+	}
 	
 	/* initialise initial auto=ik chainlen's? */
 	if (ik_on) transform_autoik_update(t, 0);
-#endif
 }
 
 /* ********************* armature ************** */
@@ -4605,7 +4602,9 @@
 		}
 	}
 	else if (ob && (ob->flag & OB_POSEMODE)) {
-		createTransPose(C, t, OBACT);
+		// XXX this is currently limited to active armature only... 
+		// XXX active-layer checking isn't done as that should probably be checked through context instead
+		createTransPose(C, t, ob);
 	}
 	else if (G.f & G_WEIGHTPAINT) {
 		/* exception, we look for the one selected armature */

Modified: branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c	2009-01-24 09:55:31 UTC (rev 18645)
+++ branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c	2009-01-24 10:03:19 UTC (rev 18646)
@@ -448,17 +448,6 @@
 			DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA);  /* sets recalc flags */
 		}
 	}
-	else if( (t->flag & T_POSE) && t->poseobj) {
-		Object *ob= t->poseobj;
-		bArmature *arm= ob->data;
-		
-		/* old optimize trick... this enforces to bypass the depgraph */
-		if (!(arm->flag & ARM_DELAYDEFORM)) {
-			DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);  /* sets recalc flags */
-		}
-		else
-			where_is_pose(ob);
-	}
 	else if(G.f & G_PARTICLEEDIT) {
 		flushTransParticles(t);
 	}
@@ -574,6 +563,17 @@
 			
 		}
 	}
+	else if( (t->flag & T_POSE) && t->poseobj) {
+		Object *ob= t->poseobj;
+		bArmature *arm= ob->data;
+		
+		/* old optimize trick... this enforces to bypass the depgraph */
+		if (!(arm->flag & ARM_DELAYDEFORM)) {
+			DAG_object_flush_update(scene, ob, OB_RECALC_DATA);  /* sets recalc flags */
+		}
+		else
+			where_is_pose(scene, ob);
+	}
 	else {
 		for(base= FIRSTBASE; base; base= base->next) {
 			Object *ob= base->object;





More information about the Bf-blender-cvs mailing list