Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/armature.c
| Show First 20 Lines • Show All 2,841 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| float vec[3]; | float vec[3]; | ||||
| copy_v3_v3(vec, pchan->pose_mat[1]); | copy_v3_v3(vec, pchan->pose_mat[1]); | ||||
| mul_v3_fl(vec, pchan->bone->length); | mul_v3_fl(vec, pchan->bone->length); | ||||
| add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec); | add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec); | ||||
| } | } | ||||
| /* Calculate matrices used in overlay_armature.c */ | |||||
| static void pchan_calc_disp_mat(bArmature *arm, bPoseChannel *pchan) | |||||
| { | |||||
| float s[4][4]; | |||||
| float length; | |||||
| if (pchan->bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) { | |||||
| return; | |||||
| } | |||||
| if (pchan->custom && !(arm->flag & ARM_NO_CUSTOM)) { | |||||
| length = PCHAN_CUSTOM_DRAW_SIZE(pchan); | |||||
| } | |||||
| else { | |||||
| length = pchan->bone->length; | |||||
| } | |||||
| scale_m4_fl(s, length); | |||||
| mul_m4_m4m4(pchan->disp_mat, pchan->pose_mat, s); | |||||
| copy_m4_m4(pchan->disp_tail_mat, pchan->disp_mat); | |||||
| translate_m4(pchan->disp_tail_mat, 0.0f, 1.0f, 0.0f); | |||||
| } | |||||
| /* The main armature solver, does all constraints excluding IK */ | /* The main armature solver, does all constraints excluding IK */ | ||||
| /* pchan is validated, as having bone and parent pointer | /* pchan is validated, as having bone and parent pointer | ||||
| * 'do_extra': when zero skips loc/size/rot, constraints and strip modifiers. | * 'do_extra': when zero skips loc/size/rot, constraints and strip modifiers. | ||||
| */ | */ | ||||
| void BKE_pose_where_is_bone(struct Depsgraph *depsgraph, | void BKE_pose_where_is_bone(struct Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| Object *ob, | Object *ob, | ||||
| bPoseChannel *pchan, | bPoseChannel *pchan, | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | if (pchan->constraints.first) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* calculate head */ | /* calculate head */ | ||||
| copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]); | copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]); | ||||
| /* calculate tail */ | /* calculate tail */ | ||||
| BKE_pose_where_is_bone_tail(pchan); | BKE_pose_where_is_bone_tail(pchan); | ||||
| /* Calculate display matrices. */ | |||||
| pchan_calc_disp_mat(ob->data, pchan); | |||||
| } | } | ||||
| /* This only reads anim data from channels, and writes to channels */ | /* This only reads anim data from channels, and writes to channels */ | ||||
| /* This is the only function adding poses */ | /* This is the only function adding poses */ | ||||
| void BKE_pose_where_is(struct Depsgraph *depsgraph, Scene *scene, Object *ob) | void BKE_pose_where_is(struct Depsgraph *depsgraph, Scene *scene, Object *ob) | ||||
| { | { | ||||
| bArmature *arm; | bArmature *arm; | ||||
| Bone *bone; | Bone *bone; | ||||
| ▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines | |||||