Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/armature_utils.c
| Show First 20 Lines • Show All 226 Lines • ▼ Show 20 Lines | |||||
| #undef EBONE_TEMP_UINT | #undef EBONE_TEMP_UINT | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) | void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) | ||||
| { | { | ||||
| float delta[3]; | float delta[3], roll; | ||||
| /* Find the current bone matrix */ | /* Find the current bone matrix */ | ||||
| sub_v3_v3v3(delta, ebone->tail, ebone->head); | sub_v3_v3v3(delta, ebone->tail, ebone->head); | ||||
| vec_roll_to_mat3(delta, ebone->roll, mat); | roll = ebone->roll; | ||||
| if (!normalize_v3(delta)) { | |||||
| /* Use the orientation of the parent bone if any. */ | |||||
| const EditBone *ebone_parent = ebone->parent; | |||||
| if (ebone_parent) { | |||||
| sub_v3_v3v3(delta, ebone_parent->tail, ebone_parent->head); | |||||
| normalize_v3(delta); | |||||
| roll = ebone_parent->roll; | |||||
| } | |||||
| } | |||||
| vec_roll_to_mat3_normalized(delta, roll, mat); | |||||
| } | } | ||||
| void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]) | void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]) | ||||
| { | { | ||||
| float m3[3][3]; | float m3[3][3]; | ||||
| ED_armature_ebone_to_mat3(ebone, m3); | ED_armature_ebone_to_mat3(ebone, m3); | ||||
| ▲ Show 20 Lines • Show All 706 Lines • Show Last 20 Lines | |||||