[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32583] trunk/blender/source/blender/ blenkernel/intern/object.c: bugfix with applying the object matrix with negative scales.

Campbell Barton ideasman42 at gmail.com
Tue Oct 19 07:36:16 CEST 2010


Revision: 32583
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32583
Author:   campbellbarton
Date:     2010-10-19 07:36:16 +0200 (Tue, 19 Oct 2010)

Log Message:
-----------
bugfix with applying the object matrix with negative scales.

--- fixes report by ronan ducluzeau
Scale default cube on X axis to -1.
Rotate it on X axis to 33?\194?\176.

Parent cube to lamp.
Clear parent and keep offset.

Cube's scaling value on X axis pass from -1 to 1
Cube's rotation value on Z axis pass from 0?\194?\176 to 180?\194?\176  

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

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2010-10-19 05:21:28 UTC (rev 32582)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2010-10-19 05:36:16 UTC (rev 32583)
@@ -1704,12 +1704,18 @@
 
 	/* location */
 	copy_v3_v3(ob->loc, mat[3]);
-	
-	/* rotation */
+
+	/* rotation & scale are linked, we need to create the mat's
+	 * for these together since they are related. */
 	copy_m3_m4(mat3, mat);
 	/* so scale doesnt interfear with rotation [#24291] */
 	normalize_m3_m3(mat3_n, (const float(*)[3])mat3);
+	if(mat3_n[0][0] < 0.0f) negate_v3(mat3_n[0]);
+	if(mat3_n[1][1] < 0.0f) negate_v3(mat3_n[1]);
+	if(mat3_n[2][2] < 0.0f) negate_v3(mat3_n[2]);
 
+
+	/* rotation */
 	object_mat3_to_rot(ob, mat3_n, 0);
 
 	/* scale */





More information about the Bf-blender-cvs mailing list