From c1c6d89192782e1283565e178cc640112c2239c3 Mon Sep 17 00:00:00 2001 From: himisa Date: Mon, 5 Jun 2023 13:16:23 +0200 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20source/blender/blenkernel/intern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blenkernel/intern/armature_deform.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c index ad6cb43b4a2..feeb8c58c63 100644 --- a/source/blender/blenkernel/intern/armature_deform.c +++ b/source/blender/blenkernel/intern/armature_deform.c @@ -63,23 +63,22 @@ static void pchan_deform_accumulate(const DualQuat *deform_dq, if (dq_accum) { BLI_assert(!co_accum); - /* FIX https://projects.blender.org/blender/blender/issues/32022 */ - DualQuat mdq; if (deform_dq->scale_weight) { + /* FIX https://projects.blender.org/blender/blender/issues/32022 */ + DualQuat mdq = *deform_dq; float dst[3]; - memcpy(&mdq, deform_dq, sizeof(DualQuat)); mul_v3_m4v3(dst, mdq.scale, co_in); sub_v3_v3(dst, co_in); - float w = mdq.quat[0], x = mdq.quat[1], y = mdq.quat[2], z = mdq.quat[3]; - mdq.trans[0] -= .5f * (x * dst[0] + y * dst[1] + z * dst[2]); - mdq.trans[1] += .5f * (w * dst[0] + y * dst[2] - z * dst[1]); - mdq.trans[2] += .5f * (w * dst[1] + z * dst[0] - x * dst[2]); - mdq.trans[3] += .5f * (w * dst[2] + x * dst[1] - y * dst[0]); + mdq.trans[0] -= .5f * (mdq.quat[1] * dst[0] + mdq.quat[2] * dst[1] + mdq.quat[3] * dst[2]); + mdq.trans[1] += .5f * (mdq.quat[0] * dst[0] + mdq.quat[2] * dst[2] - mdq.quat[3] * dst[1]); + mdq.trans[2] += .5f * (mdq.quat[0] * dst[1] + mdq.quat[3] * dst[0] - mdq.quat[1] * dst[2]); + mdq.trans[3] += .5f * (mdq.quat[0] * dst[2] + mdq.quat[1] * dst[1] - mdq.quat[2] * dst[0]); mdq.scale_weight = 0.f; - deform_dq = &mdq; + add_weighted_dq_dq(dq_accum, &mdq, weight); + } + else { + add_weighted_dq_dq(dq_accum, deform_dq, weight); } - - add_weighted_dq_dq(dq_accum, deform_dq, weight); } else { float tmp[3]; -- 2.30.2