[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52609] trunk/blender/source/blender/ editors/transform/transform.c: Fix part of #32248: transform with a size limit constraint did not preserve negative scale.

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Nov 27 17:02:03 CET 2012


Revision: 52609
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52609
Author:   blendix
Date:     2012-11-27 16:02:03 +0000 (Tue, 27 Nov 2012)
Log Message:
-----------
Fix part of #32248: transform with a size limit constraint did not preserve negative scale.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2012-11-27 15:26:10 UTC (rev 52608)
+++ trunk/blender/source/blender/editors/transform/transform.c	2012-11-27 16:02:03 UTC (rev 52609)
@@ -2427,6 +2427,8 @@
 		bConstraintTypeInfo *cti = get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT);
 		bConstraintOb cob = {NULL};
 		bConstraint *con;
+		float size_sign[3], size_abs[3];
+		int i;
 		
 		/* Make a temporary bConstraintOb for using these limit constraints
 		 *  - they only care that cob->matrix is correctly set ;-)
@@ -2440,8 +2442,14 @@
 			/* Reset val if SINGLESIZE but using a constraint */
 			if (td->flag & TD_SINGLESIZE)
 				return;
+
+			/* separate out sign to apply back later */
+			for (i = 0; i < 3; i++) {
+				size_sign[i] = signf(td->ext->size[i]);
+				size_abs[i] = fabsf(td->ext->size[i]);
+			}
 			
-			size_to_mat4(cob.matrix, td->ext->size);
+			size_to_mat4(cob.matrix, size_abs);
 		}
 		
 		/* Evaluate valid constraints */
@@ -2489,7 +2497,9 @@
 			if (td->flag & TD_SINGLESIZE)
 				return;
 
+			/* extrace scale from matrix and apply back sign */
 			mat4_to_size(td->ext->size, cob.matrix);
+			mul_v3_v3(td->ext->size, size_sign);
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list