[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36679] trunk/blender/source/blender/ blenkernel/intern/object.c: object_mat3_to_rot wasn' t correctly accounting for the euler delta rotations, so setting the matrix of an object would fail in this case ( rotational jump).

Campbell Barton ideasman42 at gmail.com
Sat May 14 06:59:38 CEST 2011


Revision: 36679
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36679
Author:   campbellbarton
Date:     2011-05-14 04:59:37 +0000 (Sat, 14 May 2011)
Log Message:
-----------
object_mat3_to_rot wasn't correctly accounting for the euler delta rotations, so setting the matrix of an object would fail in this case (rotational jump).

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	2011-05-14 04:39:27 UTC (rev 36678)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2011-05-14 04:59:37 UTC (rev 36679)
@@ -1719,9 +1719,22 @@
 		ob->rotAngle -= ob->drotAngle;
 		break;
 	default: /* euler */
-		if(use_compat)	mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, mat);
-		else			mat3_to_eulO(ob->rot, ob->rotmode, mat);
-		sub_v3_v3(ob->rot, ob->drot);
+		{
+			float quat[4];
+			float dquat[4];
+			float tmat[3][3];
+
+			/* without drot we could apply 'mat' directly */
+			mat3_to_quat(quat, mat);
+			eulO_to_quat(dquat, ob->drot, ob->rotmode);
+			invert_qt(dquat);
+			mul_qt_qtqt(quat, dquat, quat);
+			quat_to_mat3(tmat, quat);
+			/* end drot correction */
+
+			if(use_compat)	mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
+			else			mat3_to_eulO(ob->rot, ob->rotmode, tmat);
+		}
 	}
 }
 




More information about the Bf-blender-cvs mailing list