From 95d8cfc25df30adbb18437b8de0bc840797574ee Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Nov 2010 19:49:07 +0000 Subject: 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. --- source/blender/editors/armature/editarmature_generate.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'source/blender/editors/armature/editarmature_generate.c') diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 6eda622ead8..6abdd85bf71 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -50,18 +50,12 @@ void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), { if (no != NULL && !is_zero_v3(no)) { - float tangent[3], vec[3], normal[3]; + float normal[3]; - VECCOPY(normal, no); + copy_v3_v3(normal, no); mul_m3_v3(tmat, normal); - - sub_v3_v3v3(tangent, bone->tail, bone->head); - project_v3_v3v3(vec, tangent, normal); - sub_v3_v3(normal, vec); - - normalize_v3(normal); - bone->roll = ED_rollBoneToVector(bone, normal); + bone->roll = ED_rollBoneToVector(bone, normal, FALSE); } } -- cgit v1.2.3