[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47721] trunk/blender/source/blender/ blenkernel/intern/constraint.c: Bugfix [#27886] Transform constraint maps wrongly with negative scale

Joshua Leung aligorith at gmail.com
Mon Jun 11 07:05:15 CEST 2012


Revision: 47721
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47721
Author:   aligorith
Date:     2012-06-11 05:05:05 +0000 (Mon, 11 Jun 2012)
Log Message:
-----------
Bugfix [#27886] Transform constraint maps wrongly with negative scale

AFAIK, it is impossible to determine exactly which axes may have negative
scaling values from a 4x4 matrix (which is the underlying cause of this bug).
However, we can figure out if there is some negative scaling going on in that
matrix (i.e. one of the axes has negative scale). So, the fix here is to
negatively scale everything if we detect this happening.

WARNING: do not rely on being able to accurately detecting positive/negative
values for more than a single axis per bone controller. Weird results may occur.
You have been warned.

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

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2012-06-11 04:34:59 UTC (rev 47720)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2012-06-11 05:05:05 UTC (rev 47721)
@@ -3278,6 +3278,15 @@
 		switch (data->from) {
 			case 2: /* scale */
 				mat4_to_size(dvec, ct->matrix);
+				
+				if (is_negative_m4(ct->matrix)) {
+					/* Bugfix [#27886] 
+					 * We can't be sure which axis/axes are negative, though we know that something is negative.
+					 * Assume we don't care about negativity of separate axes. <--- This is a limitation that
+					 * riggers will have to live with for now.
+					 */
+					negate_v3(dvec);
+				}
 				break;
 			case 1: /* rotation (convert to degrees first) */
 				mat4_to_eulO(dvec, cob->rotOrder, ct->matrix);




More information about the Bf-blender-cvs mailing list