Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-05-21 17:22:31 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-05-21 17:22:31 +0400
commitebbeb082d1bef78d1fa162822db2af44468e97cd (patch)
tree2f31fdc6ed9774e1969cc8ccf336255246afaf51 /source/blender/blenkernel/intern/armature.c
parentd203edfc9384f8632fce122dc8313a4745799a86 (diff)
Fix T40271: recalculation of the bone roll does not work correctly.
Check that up_axis is not aligned with bone was wrong in at least two aspects (not working against negative alignement case, and since ages it seems, using Z axis when bones are along Y axis...). Also optimized a bit here, better to have a normalized version of vec_roll_to_mat3(), since it needs normalized vector anyway, and we have to normalize it for the tests before calling it anyway (so now, we only do that twice in Transform code, instead of three times). And we can perform aling test *before* calling vec_roll_to_mat3!
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r--source/blender/blenkernel/intern/armature.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index fda252e81fd..95f8426872d 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1482,17 +1482,14 @@ void mat3_to_vec_roll(float mat[3][3], float r_vec[3], float *r_roll)
* M* = 1 / (x^2 + z^2) * │ │
* └ -2 * x * z, x^2 - z^2 ┘
*/
-void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3])
+void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3])
{
#define THETA_THRESHOLD_NEGY 1.0e-9f
#define THETA_THRESHOLD_NEGY_CLOSE 1.0e-5f
- float nor[3];
float theta;
float rMatrix[3][3], bMatrix[3][3];
- normalize_v3_v3(nor, vec);
-
theta = 1.0f + nor[1];
/* With old algo, 1.0e-13f caused T23954 and T31333, 1.0e-6f caused T27675 and T30438,
@@ -1543,6 +1540,13 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3])
#undef THETA_THRESHOLD_NEGY_CLOSE
}
+void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3])
+{
+ float nor[3];
+
+ normalize_v3_v3(nor, vec);
+ vec_roll_to_mat3_normalized(nor, roll, mat);
+}
/* recursive part, calculates restposition of entire tree of children */
/* used by exiting editmode too */