Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_conversions.c
| Show First 20 Lines • Show All 1,059 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* ********************* armature ************** */ | /* ********************* armature ************** */ | ||||
| static void createTransArmatureVerts_init_roll_fix(TransData *td, EditBone *ebo) | static void createTransArmatureVerts_init_roll_fix(TransData *td, EditBone *ebo) | ||||
| { | { | ||||
| /* To fix roll, see comments in transform_generic.c::recalcData_objects() */ | /* To fix roll, see comments in transform_generic.c::recalcData_objects() */ | ||||
| const float z_axis[3] = {0.0f, 0.0f, 1.0f}; | const float z_axis[3] = {0.0f, 0.0f, 1.0f}; | ||||
| const float x_axis[3] = {1.0f, 0.0f, 0.0f}; | |||||
| float vec[3]; | float vec[3]; | ||||
| sub_v3_v3v3(vec, ebo->tail, ebo->head); | sub_v3_v3v3(vec, ebo->tail, ebo->head); | ||||
| normalize_v3(vec); | normalize_v3(vec); | ||||
| td->extra = ebo; | td->extra = ebo; | ||||
| if (fabsf(dot_v3v3(vec, z_axis)) > 0.999999f) { | if (fabsf(dot_v3v3(vec, z_axis)) > M_SQRT1_2) { | ||||
| /* If nearly aligned with Z axis, do not alter roll. See T38843. */ | /* If more aligned with Z axis than with X axis, use X axis as reference. See T38843. */ | ||||
| ebo->temp_f = ebo->roll; | ebo->temp_f = ebo->roll - ED_rollBoneToVector(ebo, x_axis, false); | ||||
| ebo->temp_i = true; | |||||
| } | } | ||||
| else { | else { | ||||
| ebo->temp_f = ebo->roll - ED_rollBoneToVector(ebo, z_axis, false); | ebo->temp_f = ebo->roll - ED_rollBoneToVector(ebo, z_axis, false); | ||||
| ebo->temp_i = false; | |||||
| } | } | ||||
| td->ival = ebo->roll; | td->ival = ebo->roll; | ||||
| } | } | ||||
| static void createTransArmatureVerts(TransInfo *t) | static void createTransArmatureVerts(TransInfo *t) | ||||
| { | { | ||||
| EditBone *ebo; | EditBone *ebo; | ||||
| bArmature *arm = t->obedit->data; | bArmature *arm = t->obedit->data; | ||||
| ▲ Show 20 Lines • Show All 5,998 Lines • Show Last 20 Lines | |||||