Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_armature.c
| Show First 20 Lines • Show All 1,073 Lines • ▼ Show 20 Lines | static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_SUBDIV][4][4]) | ||||
| param.scaleOut = ebone->scaleOut; | param.scaleOut = ebone->scaleOut; | ||||
| param.curveInX = ebone->curveInX; | param.curveInX = ebone->curveInX; | ||||
| param.curveInY = ebone->curveInY; | param.curveInY = ebone->curveInY; | ||||
| param.curveOutX = ebone->curveOutX; | param.curveOutX = ebone->curveOutX; | ||||
| param.curveOutY = ebone->curveOutY; | param.curveOutY = ebone->curveOutY; | ||||
| ebone->segments = BKE_pchan_bbone_spline_compute(¶m, (Mat4 *)result_array); | ebone->segments = BKE_pchan_bbone_spline_compute(¶m, false, (Mat4 *)result_array); | ||||
| } | } | ||||
| static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pchan) | static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pchan) | ||||
| { | { | ||||
| float s[4][4], ebmat[4][4]; | float s[4][4], ebmat[4][4]; | ||||
| float length, xwidth, zwidth; | float length, xwidth, zwidth; | ||||
| float (*bone_mat)[4]; | float (*bone_mat)[4]; | ||||
| short bbone_segments; | short bbone_segments; | ||||
| Show All 22 Lines | static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pchan) | ||||
| size_to_mat4(s, (const float[3]){xwidth, length / bbone_segments, zwidth}); | size_to_mat4(s, (const float[3]){xwidth, length / bbone_segments, zwidth}); | ||||
| /* Compute BBones segment matrices... */ | /* Compute BBones segment matrices... */ | ||||
| /* Note that we need this even for one-segment bones, because box drawing need specific weirdo matrix for the box, | /* Note that we need this even for one-segment bones, because box drawing need specific weirdo matrix for the box, | ||||
| * that we cannot use to draw end points & co. */ | * that we cannot use to draw end points & co. */ | ||||
| if (pchan) { | if (pchan) { | ||||
| Mat4 *bbones_mat = (Mat4 *)pchan->draw_data->bbone_matrix; | Mat4 *bbones_mat = (Mat4 *)pchan->draw_data->bbone_matrix; | ||||
| if (bbone_segments > 1) { | if (bbone_segments > 1) { | ||||
| if (bbone_segments == pchan->runtime.bbone_segments) { | BKE_pchan_bbone_spline_setup(pchan, false, false, bbones_mat); | ||||
| memcpy(bbones_mat, pchan->runtime.bbone_pose_mats, sizeof(Mat4) * bbone_segments); | |||||
| } | |||||
| else { | |||||
| BKE_pchan_bbone_spline_setup(pchan, false, bbones_mat); | |||||
| } | |||||
| for (int i = bbone_segments; i--; bbones_mat++) { | for (int i = bbone_segments; i--; bbones_mat++) { | ||||
| mul_m4_m4m4(bbones_mat->mat, bbones_mat->mat, s); | mul_m4_m4m4(bbones_mat->mat, bbones_mat->mat, s); | ||||
| mul_m4_m4m4(bbones_mat->mat, bone_mat, bbones_mat->mat); | mul_m4_m4m4(bbones_mat->mat, bone_mat, bbones_mat->mat); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| mul_m4_m4m4(bbones_mat->mat, bone_mat, s); | mul_m4_m4m4(bbones_mat->mat, bone_mat, s); | ||||
| ▲ Show 20 Lines • Show All 820 Lines • Show Last 20 Lines | |||||