[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12803] trunk/blender/source/blender/src: == LimitLoc Transform - Tweaks ==

Joshua Leung aligorith at gmail.com
Thu Dec 6 03:57:48 CET 2007


Revision: 12803
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12803
Author:   aligorith
Date:     2007-12-06 03:57:47 +0100 (Thu, 06 Dec 2007)

Log Message:
-----------
== LimitLoc Transform - Tweaks ==

* Made 'cob' be a stack var instead of allocating memory (as suggested by Martin)
* Adjusted the position of "Trans" button in panel, and changed its name/tooltip to better describe its function

* 'Active' constraint now draws brighter than other constraints... this is still not clear enough though. 

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_object.c
    trunk/blender/source/blender/src/transform.c

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c	2007-12-06 00:01:46 UTC (rev 12802)
+++ trunk/blender/source/blender/src/buttons_object.c	2007-12-06 02:57:47 UTC (rev 12803)
@@ -527,7 +527,7 @@
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 	
 	/* rounded header */
-	rb_col= (con->flag & CONSTRAINT_ACTIVE)?40:20;
+	rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20;
 	uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-1, width+40, 22, NULL, 5.0, 0.0, 
 			 (con->flag & CONSTRAINT_EXPAND)?3:15 , rb_col-20, ""); 
 	
@@ -1249,7 +1249,7 @@
 				int togButWidth = 50;
 				int textButWidth = ((width/2)-togButWidth);
 				
-				height = 106; 
+				height = 136; 
 				uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, ""); 
 				
 				/* Draw Pairs of LimitToggle+LimitValue */
@@ -1283,11 +1283,11 @@
 					uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", *xco+(width-textButWidth-5), *yco-72, (textButWidth-5), 18, &(data->zmax), -1000, 1000, 0.1,0.5,"Highest z value to allow"); 
 				uiBlockEndAlign(block);
 				
-				// temp placement!!!
-				uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "Trans", *xco+245, *yco-100, 50, 18, &data->flag2, 0, 24, 0, 0, "Only use during transform"); 
+				/* special option(s) */
+				uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "For Transform", *xco+(width/4), *yco-100, (width/2), 18, &data->flag2, 0, 24, 0, 0, "Transforms are affected by this constraint as well"); 
 				
 				/* constraint space settings */
-				draw_constraint_spaceselect(block, con, *xco, *yco-100, is_armature_owner(ob), -1);
+				draw_constraint_spaceselect(block, con, *xco, *yco-130, is_armature_owner(ob), -1);
 			}
 			break;
 		case CONSTRAINT_TYPE_ROTLIMIT:

Modified: trunk/blender/source/blender/src/transform.c
===================================================================
--- trunk/blender/source/blender/src/transform.c	2007-12-06 00:01:46 UTC (rev 12802)
+++ trunk/blender/source/blender/src/transform.c	2007-12-06 02:57:47 UTC (rev 12803)
@@ -1318,23 +1318,23 @@
 {
 	if (td->con) {
 		bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
-		bConstraintOb *cob;
+		bConstraintOb cob;
 		bConstraint *con;
 		
 		/* Make a temporary bConstraintOb for using these limit constraints 
 		 * 	- they only care that cob->matrix is correctly set ;-)
 		 *	- current space should be local
 		 */
-		cob= MEM_callocN(sizeof(bConstraintOb), "bConstraintOb-Transform");
-		Mat4One(cob->matrix);
+		memset(&cob, 0, sizeof(bConstraintOb));
+		Mat4One(cob.matrix);
 		if (td->tdi) {
 			TransDataIpokey *tdi= td->tdi;
-			cob->matrix[3][0]= tdi->locx[0];
-			cob->matrix[3][1]= tdi->locy[0];
-			cob->matrix[3][2]= tdi->locz[0];
+			cob.matrix[3][0]= tdi->locx[0];
+			cob.matrix[3][1]= tdi->locy[0];
+			cob.matrix[3][2]= tdi->locz[0];
 		}
 		else {
-			VECCOPY(cob->matrix[3], td->loc);
+			VECCOPY(cob.matrix[3], td->loc);
 		}
 		
 		/* Evaluate valid constraints */
@@ -1351,8 +1351,8 @@
 				/* do space conversions */
 				if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
 					/* just multiply by td->mtx (this should be ok) */
-					Mat4CpyMat4(tmat, cob->matrix);
-					Mat4MulMat34(cob->matrix, td->mtx, tmat); // checkme
+					Mat4CpyMat4(tmat, cob.matrix);
+					Mat4MulMat34(cob.matrix, td->mtx, tmat); // checkme
 				}
 				else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
 					/* skip... incompatable spacetype */
@@ -1360,28 +1360,27 @@
 				}
 				
 				/* do constraint */
-				cti->evaluate_constraint(con, cob, NULL);
+				cti->evaluate_constraint(con, &cob, NULL);
 				
 				/* convert spaces again */
 				if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
 					/* just multiply by td->mtx (this should be ok) */
-					Mat4CpyMat4(tmat, cob->matrix);
-					Mat4MulMat34(cob->matrix, td->smtx, tmat); // checkme
+					Mat4CpyMat4(tmat, cob.matrix);
+					Mat4MulMat34(cob.matrix, td->smtx, tmat); // checkme
 				}
 			}
 		}
 		
-		/* copy results from cob->matrix, and free */
+		/* copy results from cob->matrix */
 		if (td->tdi) {
 			TransDataIpokey *tdi= td->tdi;
-			tdi->locx[0]= cob->matrix[3][0];
-			tdi->locy[0]= cob->matrix[3][1];
-			tdi->locz[0]= cob->matrix[3][2];
+			tdi->locx[0]= cob.matrix[3][0];
+			tdi->locy[0]= cob.matrix[3][1];
+			tdi->locz[0]= cob.matrix[3][2];
 		}
 		else {
-			VECCOPY(td->loc, cob->matrix[3]);
+			VECCOPY(td->loc, cob.matrix[3]);
 		}
-		MEM_freeN(cob);
 	}
 }
 





More information about the Bf-blender-cvs mailing list