[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54653] trunk/blender/source/blender: fix for [#34283] wasn't working in my tests (attached to original report),
Campbell Barton
ideasman42 at gmail.com
Tue Feb 19 05:37:29 CET 2013
Revision: 54653
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54653
Author: campbellbarton
Date: 2013-02-19 04:37:28 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
fix for [#34283] wasn't working in my tests (attached to original report),
made bone roll get compatible angle values with the original roll.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_rotation.h
trunk/blender/source/blender/blenlib/intern/math_rotation.c
trunk/blender/source/blender/editors/transform/transform_generics.c
Modified: trunk/blender/source/blender/blenlib/BLI_math_rotation.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_rotation.h 2013-02-19 04:07:39 UTC (rev 54652)
+++ trunk/blender/source/blender/blenlib/BLI_math_rotation.h 2013-02-19 04:37:28 UTC (rev 54653)
@@ -186,6 +186,8 @@
float angle_wrap_rad(float angle);
float angle_wrap_deg(float angle);
+float angle_compat_rad(float angle, float angle_compat);
+
int mat3_from_axis_conversion(int from_forward, int from_up, int to_forward, int to_up,
float r_mat[3][3]);
Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c 2013-02-19 04:07:39 UTC (rev 54652)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c 2013-02-19 04:37:28 UTC (rev 54653)
@@ -1740,6 +1740,12 @@
return mod_inline(angle + 180.0f, 360.0f) - 180.0f;
}
+/* returns an angle compatible with angle_compat */
+float angle_compat_rad(float angle, float angle_compat)
+{
+ return angle + (floorf(((angle_compat - angle) / (float)M_PI) + 0.5f)) * (float)M_PI;
+}
+
/* axis conversion */
static float _axis_convert_matrix[23][3][3] = {
{{-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}},
Modified: trunk/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_generics.c 2013-02-19 04:07:39 UTC (rev 54652)
+++ trunk/blender/source/blender/editors/transform/transform_generics.c 2013-02-19 04:37:28 UTC (rev 54653)
@@ -809,6 +809,7 @@
if (td->extra) {
float vec[3], up_axis[3];
float qrot[4];
+ float roll;
bool ztrans_hack = false;
ebo = td->extra;
@@ -842,7 +843,8 @@
ztrans_hack = compare_v3v3(tdelta, ZAXIS_REF, 0.1f);
}
- ebo->roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack);
+ roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack);
+ ebo->roll = angle_compat_rad(roll, ebo->roll);
}
}
}
More information about the Bf-blender-cvs
mailing list