diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-25 22:49:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-25 22:49:07 +0300 |
commit | 95d8cfc25df30adbb18437b8de0bc840797574ee (patch) | |
tree | 0a7ba3821a821dde9682b2a431a048ba19cd699e /source/blender/blenlib | |
parent | d2a2cab975d1c4bcd6a047f9f983993c2993a8ad (diff) |
bugfix [#24907] bone roll z up broken and python script showing correct method to roll bones
from Josh Wedlake (joshwedlake), who provided a reference script used to apply changes in ED_rollBoneToVector().
- Obvious bug fixed where Z-Up didnt work right.
- More align axis options to Recalculate Roll operator: X/Y/Z/View Axis & Negate.
- Axis Only option, ignore the axis direction, use shortest rotation to align bones.
ED_rollBoneToVector() changes:
- would give bad roll when the axis wasn't normalized or perpendicular to the bone.
some callers accounted for this but not all.
- option to align to the axis but not the direction.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 14 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 2e596951fef..ec62954149c 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -121,15 +121,15 @@ void mid_v3_v3v3(float r[3], const float a[3], const float b[3]); /********************************* Comparison ********************************/ -MINLINE int is_zero_v3(float a[3]); -MINLINE int is_one_v3(float a[3]); +MINLINE int is_zero_v3(const float a[3]); +MINLINE int is_one_v3(const float a[3]); -MINLINE int equals_v3v3(float a[3], float b[3]); -MINLINE int compare_v3v3(float a[3], float b[3], float limit); -MINLINE int compare_len_v3v3(float a[3], float b[3], float limit); +MINLINE int equals_v3v3(const float a[3], const float b[3]); +MINLINE int compare_v3v3(const float a[3], const float b[3], const float limit); +MINLINE int compare_len_v3v3(const float a[3], const float b[3], const float limit); -MINLINE int compare_v4v4(float a[4], float b[4], float limit); -MINLINE int equals_v4v4(float a[4], float b[4]); +MINLINE int compare_v4v4(const float a[4], const float b[4], const float limit); +MINLINE int equals_v4v4(const float a[4], const float b[4]); MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 6bccb0045fa..9718b37ee8a 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -419,27 +419,27 @@ MINLINE void normal_float_to_short_v3(short *out, const float *in) /********************************* Comparison ********************************/ -MINLINE int is_zero_v3(float *v) +MINLINE int is_zero_v3(const float *v) { return (v[0] == 0 && v[1] == 0 && v[2] == 0); } -MINLINE int is_one_v3(float *v) +MINLINE int is_one_v3(const float *v) { return (v[0] == 1 && v[1] == 1 && v[2] == 1); } -MINLINE int equals_v3v3(float *v1, float *v2) +MINLINE int equals_v3v3(const float *v1, const float *v2) { return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2])); } -MINLINE int equals_v4v4(float *v1, float *v2) +MINLINE int equals_v4v4(const float *v1, const float *v2) { return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2]) && (v1[3]==v2[3])); } -MINLINE int compare_v3v3(float *v1, float *v2, float limit) +MINLINE int compare_v3v3(const float *v1, const float *v2, const float limit) { if(fabs(v1[0]-v2[0])<limit) if(fabs(v1[1]-v2[1])<limit) @@ -449,7 +449,7 @@ MINLINE int compare_v3v3(float *v1, float *v2, float limit) return 0; } -MINLINE int compare_len_v3v3(float *v1, float *v2, float limit) +MINLINE int compare_len_v3v3(const float *v1, const float *v2, const float limit) { float x,y,z; @@ -460,7 +460,7 @@ MINLINE int compare_len_v3v3(float *v1, float *v2, float limit) return ((x*x + y*y + z*z) < (limit*limit)); } -MINLINE int compare_v4v4(float *v1, float *v2, float limit) +MINLINE int compare_v4v4(const float *v1, const float *v2, const float limit) { if(fabs(v1[0]-v2[0])<limit) if(fabs(v1[1]-v2[1])<limit) |