[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32809] trunk/blender/source/blender/ editors/transform/transform_manipulator.c: bugfix [#24480] Axis Angle + manipulators: bad behaviour
Campbell Barton
ideasman42 at gmail.com
Mon Nov 1 11:29:08 CET 2010
Revision: 32809
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32809
Author: campbellbarton
Date: 2010-11-01 11:29:05 +0100 (Mon, 01 Nov 2010)
Log Message:
-----------
bugfix [#24480] Axis Angle + manipulators: bad behaviour
Modified Paths:
--------------
trunk/blender/source/blender/editors/transform/transform_manipulator.c
Modified: trunk/blender/source/blender/editors/transform/transform_manipulator.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_manipulator.c 2010-11-01 10:22:46 UTC (rev 32808)
+++ trunk/blender/source/blender/editors/transform/transform_manipulator.c 2010-11-01 10:29:05 UTC (rev 32809)
@@ -201,24 +201,50 @@
}
else {
if(test_rotmode_euler(ob->rotmode)) {
+ eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
+ }
+ else if(ob->rotmode == ROT_MODE_AXISANGLE) {
+ /* X/Y are arbitrary axies, most importantly Z is the axis of rotation
+ * there is also an axis flipping problem if the rotation axis points
+ * exactly on Z and Y value is modified. */
+ float cross_vec[3]= {0};
+ float quat[4];
-
- if (ob->parent)
- {
- float parent_mat[3][3], amat[3][3];
-
- eulO_to_gimbal_axis(amat, ob->rot, ob->rotmode);
- copy_m3_m4(parent_mat, ob->parent->obmat);
- normalize_m3(parent_mat);
- mul_m3_m3m3(gmat, parent_mat, amat);
- return 1;
+ if(ob->rotAxis[0] || ob->rotAxis[1]) {
+ cross_vec[2]= 1.0f;
}
- else
- {
- eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
- return 1;
+ else {
+ cross_vec[0]= 1.0f; /* could be X or Y */
}
+
+ /* X-axis */
+ cross_v3_v3v3(gmat[0], cross_vec, ob->rotAxis);
+ normalize_v3(gmat[0]);
+ axis_angle_to_quat(quat, ob->rotAxis, ob->rotAngle);
+ mul_qt_v3(quat, gmat[0]);
+
+ /* Y-axis */
+ axis_angle_to_quat(quat, ob->rotAxis, M_PI/2.0);
+ copy_v3_v3(gmat[1], gmat[0]);
+ mul_qt_v3(quat, gmat[1]);
+
+ /* Z-axis */
+ copy_v3_v3(gmat[2], ob->rotAxis);
+
+ normalize_m3(gmat);
}
+ else { /* quat */
+ return 0;
+ }
+
+ if (ob->parent)
+ {
+ float parent_mat[3][3];
+ copy_m3_m4(parent_mat, ob->parent->obmat);
+ normalize_m3(parent_mat);
+ mul_m3_m3m3(gmat, parent_mat, gmat);
+ }
+ return 1;
}
}
More information about the Bf-blender-cvs
mailing list