[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54651] trunk/blender/source/blender/ editors/transform/transform_generics.c: Bugfix [#34283] armature bones losing their roll setting upon translation in
Joshua Leung
aligorith at gmail.com
Tue Feb 19 04:26:21 CET 2013
Revision: 54651
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54651
Author: aligorith
Date: 2013-02-19 03:26:18 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
Bugfix [#34283] armature bones losing their roll setting upon translation in
edit mode
My earlier fix for [#33974] (in r.54061) was causing some problems where
manually specified roll values on horizontal or angled bones were getting reset.
This could be nasty as you might not notice the changes for a while (especially
when using stick bones without axes displayed).
I've now put in place a hacky compromise solution which should catch both of
these situations nicely. For z-axis (i.e. vertical) movements, the r.54061 fix
is used, while for everything else (moving or just touch-n-go), the old setting
is used.
Modified Paths:
--------------
trunk/blender/source/blender/editors/transform/transform_generics.c
Modified: trunk/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_generics.c 2013-02-19 02:48:14 UTC (rev 54650)
+++ trunk/blender/source/blender/editors/transform/transform_generics.c 2013-02-19 03:26:18 UTC (rev 54651)
@@ -809,6 +809,7 @@
if (td->extra) {
float vec[3], up_axis[3];
float qrot[4];
+ bool ztrans_hack = false;
ebo = td->extra;
copy_v3_v3(up_axis, td->axismtx[2]);
@@ -823,7 +824,25 @@
mul_m3_v3(t->mat, up_axis);
}
- ebo->roll = ED_rollBoneToVector(ebo, up_axis, TRUE);
+ /* "ztrans_hack" is a hacky compromise fix for two bug reports
+ * - [#33974] : When extruding/translating bones vertically,
+ * the roll of each bone in such vertical chains would
+ * flip between z-axis forward and z-axis backwards
+ * - [#34283] : For "normal" transforms, the original fix for [#33974]
+ * would cause manually-set roll values on horizontal and
+ * diagonal bones to constantly get reset to values the system
+ * deems "correct" (usually 180 degree flips of the manual version)
+ */
+ if (t->mode == TFM_TRANSLATION) {
+ const float ZAXIS_REF[3] = {0.0f, 0.0f, 1.0f};
+ float tdelta[3];
+
+ /* tdelta is the translation - enable this hack when it is z-axis movement */
+ normalize_v3_v3(tdelta, t->values);
+ ztrans_hack = compare_v3v3(tdelta, ZAXIS_REF, 0.1f);
+ }
+
+ ebo->roll = ED_rollBoneToVector(ebo, up_axis, ztrans_hack);
}
}
}
More information about the Bf-blender-cvs
mailing list