diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-25 23:50:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-25 23:50:50 +0300 |
commit | 6f1077ed2cc0070ffcefcd5b0ba0fa8d6033c465 (patch) | |
tree | 80c81c0ff70aee9209318625f22e9e303d9f793f /source | |
parent | 95d8cfc25df30adbb18437b8de0bc840797574ee (diff) |
bone roll recalculate, option to use active bones Z axis.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 61d16f99f2f..fc9324d1742 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2108,6 +2108,7 @@ static EnumPropertyItem prop_calc_roll_types[] = { {0, "X", 0, "X Axis", ""}, {1, "Y", 0, "Y Axis", ""}, {2, "Z", 0, "Z Axis", ""}, + {5, "ACTIVE", 0, "Active Bone", ""}, {6, "VIEW", 0, "View Axis", ""}, {7, "CURSOR", 0, "Cursor", ""}, {0, NULL, 0, NULL, NULL} @@ -2155,14 +2156,29 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) } copy_v3_v3(vec, rv3d->viewinv[2]); + mul_m3_v3(imat, vec); + } + else if (type==5) { + bArmature *arm= ob->data; + EditBone *ebone= (EditBone *)arm->act_edbone; + float mat[3][3], nor[3]; + + if(ebone==NULL) { + BKE_report(op->reports, RPT_ERROR, "No active bone set"); + return OPERATOR_CANCELLED; + } + + sub_v3_v3v3(nor, ebone->tail, ebone->head); + vec_roll_to_mat3(nor, ebone->roll, mat); + copy_v3_v3(vec, mat[2]); } else { /* Axis */ assert(type >= 0 && type <= 5); if(type<3) vec[type]= 1.0f; else vec[type-2]= -1.0f; + mul_m3_v3(imat, vec); } - mul_m3_v3(imat, vec); if(axis_flip) negate_v3(vec); CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { |