[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13624] trunk/blender/source/blender: Constraints Bugfixes/Tweaks:

Joshua Leung aligorith at gmail.com
Sun Feb 10 11:01:58 CET 2008


Revision: 13624
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13624
Author:   aligorith
Date:     2008-02-10 11:01:57 +0100 (Sun, 10 Feb 2008)

Log Message:
-----------
Constraints Bugfixes/Tweaks:

* Optimised transform constraint a bit
* PyConstraints now show the script-selection menu correctly when a new constraint is added (i.e.  it now displays the correct initial value).

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/src/buttons_object.c
    trunk/blender/source/blender/src/editconstraint.c

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2008-02-10 03:40:24 UTC (rev 13623)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2008-02-10 10:01:57 UTC (rev 13624)
@@ -3057,24 +3057,24 @@
 		float dvec[3], sval[3];
 		short i;
 		
+		/* extract components of owner's matrix */
+		VECCOPY(loc, cob->matrix[3]);
+		Mat4ToEul(cob->matrix, eul);
+		Mat4ToSize(cob->matrix, size);
+		
 		/* obtain target effect */
 		switch (data->from) {
 			case 2:	/* scale */
-				Mat4ToSize(ct->matrix, dvec);
+				VecCopyf(dvec, size);
 				break;
 			case 1: /* rotation */
-				Mat4ToEul(ct->matrix, dvec);
+				VecCopyf(dvec, eul);
 				break;
 			default: /* location */
-				VecCopyf(dvec, ct->matrix[3]);
+				VecCopyf(dvec, loc);
 				break;
-		}
+		}		
 		
-		/* extract components of owner's matrix */
-		VECCOPY(loc, cob->matrix[3]);
-		Mat4ToEul(cob->matrix, eul);
-		Mat4ToSize(cob->matrix, size);
-		
 		/* determine where in range current transforms lie */
 		if (data->expo) {
 			for (i=0; i<3; i++) {

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c	2008-02-10 03:40:24 UTC (rev 13623)
+++ trunk/blender/source/blender/src/buttons_object.c	2008-02-10 10:01:57 UTC (rev 13624)
@@ -661,7 +661,7 @@
 				menustr = buildmenu_pyconstraints(data->text, &pyconindex);
 				but2 = uiDefButI(block, MENU, B_CONSTRAINT_TEST, menustr,
 				      *xco+120, *yco-24, 150, 20, &pyconindex,
-				      0.0, 1.0, 0, 0, "Set the Script Constraint to use");
+				      0, 0, 0, 0, "Set the Script Constraint to use");
 				uiButSetFunc(but2, validate_pyconstraint_cb, data, &pyconindex);
 				MEM_freeN(menustr);	
 				

Modified: trunk/blender/source/blender/src/editconstraint.c
===================================================================
--- trunk/blender/source/blender/src/editconstraint.c	2008-02-10 03:40:24 UTC (rev 13623)
+++ trunk/blender/source/blender/src/editconstraint.c	2008-02-10 10:01:57 UTC (rev 13624)
@@ -859,12 +859,15 @@
 void validate_pyconstraint_cb (void *arg1, void *arg2)
 {
 	bPythonConstraint *data = arg1;
-	Text *text;
+	Text *text= NULL;
 	int index = *((int *)arg2);
 	int i;
 	
-	/* innovative use of a for...loop to search */
-	for (text=G.main->text.first, i=1; text && index!=i; i++, text=text->id.next);
+	/* exception for no script */
+	if (index) {
+		/* innovative use of a for...loop to search */
+		for (text=G.main->text.first, i=1; text && index!=i; i++, text=text->id.next);
+	}
 	data->text = text;
 }
 
@@ -878,7 +881,7 @@
 	int i;
 	
 	/* add title first */
-	sprintf(buf, "Scripts: %%t|");
+	sprintf(buf, "Scripts: %%t|[None]%%x0|");
 	BLI_dynstr_append(pupds, buf);
 	
 	/* loop through markers, adding them */





More information about the Bf-blender-cvs mailing list