[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11385] trunk/blender/source/blender/src/ transform_conversions.c: Object Transform:

Joshua Leung aligorith at gmail.com
Fri Jul 27 07:03:57 CEST 2007


Revision: 11385
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11385
Author:   aligorith
Date:     2007-07-27 07:03:57 +0200 (Fri, 27 Jul 2007)

Log Message:
-----------
Object Transform:

If object has a parent, and constraints should not be inversed for transform, then constraints are now disabled like tracking is. 

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

Modified: trunk/blender/source/blender/src/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/src/transform_conversions.c	2007-07-27 04:01:03 UTC (rev 11384)
+++ trunk/blender/source/blender/src/transform_conversions.c	2007-07-27 05:03:57 UTC (rev 11385)
@@ -2093,21 +2093,37 @@
 static void ObjectToTransData(TransData *td, Object *ob) 
 {
 	Object *track;
+	ListBase fakecons = {NULL, NULL};
 	float obmtx[3][3];
+	short constinv;
 
 	/* axismtx has the real orientation */
 	Mat3CpyMat4(td->axismtx, ob->obmat);
 	Mat3Ortho(td->axismtx);
 
-	/* hack: tempolarily disable tracking when getting object matrix, 
-	 *		to stop it from screwing up space conversion matrix later
+	/* hack: tempolarily disable tracking and/or constraints when getting 
+	 *		object matrix, if tracking is on, or if constraints don't need
+	 * 		inverse correction to stop it from screwing up space conversion
+	 *		matrix later
 	 */
-	if (ob->track) {
+	constinv= constraints_list_needinv(&ob->constraints)
+	if (ob->track || constinv==0) {
 		track= ob->track;
 		ob->track= NULL;
 		
+		if (constinv == 0) {
+			fakecons.first = ob->constraints.first;
+			fakecons.last = ob->constraints.last;
+			ob->constraints.first = ob->constraints.last = NULL;
+		}
+		
 		where_is_object(ob);
 		
+		if (constinv == 0) {
+			ob->constraints.first = fakecons.first;
+			ob->constraints.last = fakecons.last;
+		}
+		
 		ob->track= track;
 	}
 	else
@@ -2129,7 +2145,7 @@
 	VECCOPY(td->center, ob->obmat[3]);
 
 	/* is there a need to set the global<->data space conversion matrices? */
-	if (ob->parent || constraints_list_needinv(&ob->constraints)) {
+	if (ob->parent || constinv) {
 		float totmat[3][3], obinv[3][3];
 		
 		/* Get the effect of parenting, and/or certain constraints.





More information about the Bf-blender-cvs mailing list