From 1e820898ff4dfc734710a6640ca7bafc0bfc69db Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Thu, 22 Nov 2018 13:38:03 +0300 Subject: Depsgraph: add a new operation node for computing B-Bone segments. Computing the shape of a B-Bone is a quite expensive operation, and there are multiple constraints that can access this information in a variety of useful ways. This means computing the shape once per bone and saving it is good for performance. Since the shape may depend on the position of up to two other bones, often in a "cyclic" manner, this computation has to be a separate node with its own dependencies. Reviewers: sergey Differential Revision: https://developer.blender.org/D3975 --- source/blender/draw/intern/draw_armature.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/draw/intern') diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 40581093b28..aec25274ab1 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -1082,7 +1082,12 @@ static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pc if (pchan) { Mat4 *bbones_mat = (Mat4 *)pchan->draw_data->bbone_matrix; if (bbone_segments > 1) { - b_bone_spline_setup(pchan, false, bbones_mat); + if (bbone_segments == pchan->runtime.bbone_segments) { + memcpy(bbones_mat, pchan->runtime.bbone_pose_mats, sizeof(Mat4) * bbone_segments); + } + else { + b_bone_spline_setup(pchan, false, bbones_mat); + } for (int i = bbone_segments; i--; bbones_mat++) { mul_m4_m4m4(bbones_mat->mat, bbones_mat->mat, s); -- cgit v1.2.3