[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32106] trunk/blender/source/blender: Fix for [#21875] Copy rotation only on y axies
Janne Karhu
jhkarh at gmail.com
Fri Sep 24 19:49:33 CEST 2010
Revision: 32106
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32106
Author: jhk
Date: 2010-09-24 19:49:33 +0200 (Fri, 24 Sep 2010)
Log Message:
-----------
Fix for [#21875] Copy rotation only on y axies
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/constraint.c
trunk/blender/source/blender/blenlib/BLI_math_rotation.h
trunk/blender/source/blender/blenlib/intern/math_rotation.c
Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c 2010-09-24 17:47:28 UTC (rev 32105)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c 2010-09-24 17:49:33 UTC (rev 32106)
@@ -1636,8 +1636,9 @@
mat4_to_size(size, cob->matrix);
/* to allow compatible rotations, must get both rotations in the order of the owner... */
- mat4_to_eulO(eul, cob->rotOrder, ct->matrix);
mat4_to_eulO(obeul, cob->rotOrder, cob->matrix);
+ /* we must get compatible eulers from the beginning because some of them can be modified below (see bug #21875) */
+ mat4_to_compatible_eulO(eul, obeul, cob->rotOrder, ct->matrix);
if ((data->flag & ROTLIKE_X)==0)
eul[0] = obeul[0];
@@ -1669,6 +1670,7 @@
eul[2] *= -1;
}
+ /* good to make eulers compatible again, since we don't know how much they were changed above */
compatible_eul(eul, obeul);
loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder);
}
Modified: trunk/blender/source/blender/blenlib/BLI_math_rotation.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_rotation.h 2010-09-24 17:47:28 UTC (rev 32105)
+++ trunk/blender/source/blender/blenlib/BLI_math_rotation.h 2010-09-24 17:49:33 UTC (rev 32106)
@@ -147,6 +147,7 @@
void axis_angle_to_eulO(float eul[3], short order, float axis[3], float angle);
void mat3_to_compatible_eulO(float eul[3], float old[3], short order, float mat[3][3]);
+void mat4_to_compatible_eulO(float eul[3], float old[3], short order, float mat[4][4]);
void rotate_eulO(float eul[3], short order, char axis, float angle);
Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c 2010-09-24 17:47:28 UTC (rev 32105)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c 2010-09-24 17:49:33 UTC (rev 32106)
@@ -1249,6 +1249,15 @@
copy_v3_v3(eul, eul1);
}
+void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order,float M[4][4])
+{
+ float m[3][3];
+
+ /* for now, we'll just do this the slow way (i.e. copying matrices) */
+ copy_m3_m4(m, M);
+ normalize_m3(m);
+ mat3_to_compatible_eulO(eul, oldrot, order, m);
+}
/* rotate the given euler by the given angle on the specified axis */
// NOTE: is this safe to do with different axis orders?
void rotate_eulO(float beul[3], short order, char axis, float ang)
More information about the Bf-blender-cvs
mailing list