forked from blender/blender
himisa-patch-1 #1
@ -63,6 +63,25 @@ 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) {
|
||||
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];
|
||||
float dstx = mdq.scale[3][0], dsty = mdq.scale[3][1], dstz = mdq.scale[3][2];
|
||||
mdq.scale[3][0] -= dst[0];
|
||||
mdq.scale[3][1] -= dst[1];
|
||||
mdq.scale[3][2] -= dst[2];
|
||||
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]);
|
||||
deform_dq = &mdq;
|
||||
}
|
||||
|
||||
add_weighted_dq_dq(dq_accum, deform_dq, weight);
|
||||
}
|
||||
else {
|
||||
|
@ -2049,22 +2049,6 @@ void add_weighted_dq_dq(DualQuat *dq_sum, const DualQuat *dq, float weight)
|
||||
{
|
||||
bool flipped = false;
|
||||
|
||||
/* FIX https://projects.blender.org/blender/blender/issues/32022 */
|
||||
DualQuat mdq;
|
||||
if (dq->scale_weight) {
|
||||
memcpy(&mdq, dq, sizeof(DualQuat));
|
||||
float w = mdq.quat[0], x = mdq.quat[1], y = mdq.quat[2], z = mdq.quat[3];
|
||||
float dstx = mdq.scale[3][0], dsty = mdq.scale[3][1], dstz = mdq.scale[3][2];
|
||||
mdq.scale[3][0] -= dstx;
|
||||
mdq.scale[3][1] -= dsty;
|
||||
mdq.scale[3][2] -= dstz;
|
||||
mdq.trans[0] -= .5f * (x * dstx + y * dsty + z * dstz);
|
||||
mdq.trans[1] += .5f * (w * dstx + y * dstz - z * dsty);
|
||||
mdq.trans[2] += .5f * (w * dsty + z * dstx - x * dstz);
|
||||
mdq.trans[3] += .5f * (w * dstz + x * dsty - y * dstx);
|
||||
dq = &mdq;
|
||||
}
|
||||
|
||||
/* make sure we interpolate quats in the right direction */
|
||||
if (dot_qtqt(dq->quat, dq_sum->quat) < 0) {
|
||||
flipped = true;
|
||||
|
Loading…
Reference in New Issue
Block a user