diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-31 13:42:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-31 13:42:31 +0300 |
commit | 23e5b79ced59dd248359e9e4fe498faa8230a29f (patch) | |
tree | d7d8ab7fdf62937ea1781bfa29106a716bb080ae /source/blender/editors/armature | |
parent | ce863a9fdc9bbf6ead41496e04e12ef69ff58996 (diff) |
armature recalc roll now works properly with mirror enabled.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 4d72e6a69a6..6d677e2f89e 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2180,6 +2180,9 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) float imat[3][3]; + bArmature *arm= ob->data; + EditBone *ebone; + copy_m3_m4(imat, ob->obmat); invert_m3(imat); @@ -2194,13 +2197,14 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, cursor_local); /* cursor */ - CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { - float cursor_rel[3]; - sub_v3_v3v3(cursor_rel, cursor_local, ebone->head); - if(axis_flip) negate_v3(cursor_rel); - ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only); + for(ebone= arm->edbo->first; ebone; ebone= ebone->next) { + if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) { + float cursor_rel[3]; + sub_v3_v3v3(cursor_rel, cursor_local, ebone->head); + if(axis_flip) negate_v3(cursor_rel); + ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only); + } } - CTX_DATA_END; } else { float vec[3]= {0.0f, 0.0f, 0.0f}; @@ -2237,11 +2241,23 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) if(axis_flip) negate_v3(vec); - CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { - /* roll func is a callback which assumes that all is well */ - ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only); + for(ebone= arm->edbo->first; ebone; ebone= ebone->next) { + if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) { + /* roll func is a callback which assumes that all is well */ + ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only); + } + } + } + + if (arm->flag & ARM_MIRROR_EDIT) { + for(ebone= arm->edbo->first; ebone; ebone= ebone->next) { + if((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) { + EditBone *ebone_mirr= ED_armature_bone_get_mirrored(arm->edbo, ebone); + if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) { + ebone->roll= -ebone_mirr->roll; + } + } } - CTX_DATA_END; } /* note, notifier might evolve */ |