Allow transform constraint scale and shearY mix < 0.

#1227
This commit is contained in:
NathanSweet 2018-12-13 09:50:13 +01:00
parent 237f1fd968
commit 0062424589

View File

@ -242,16 +242,16 @@ public class TransformConstraint implements Constraint {
}
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX != 0) scaleX = (scaleX + (target.ascaleX - scaleX + data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY != 0) scaleY = (scaleY + (target.ascaleY - scaleY + data.offsetScaleY) * scaleMix) / scaleY;
}
float shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
float r = target.ashearY - shearY + data.offsetShearY;
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
bone.shearY += r * shearMix;
shearY += r * shearMix;
}
bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
@ -277,13 +277,13 @@ public class TransformConstraint implements Constraint {
}
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
scaleX *= ((target.ascaleX - 1 + data.offsetScaleX) * scaleMix) + 1;
scaleY *= ((target.ascaleY - 1 + data.offsetScaleY) * scaleMix) + 1;
}
float shearY = bone.ashearY;
if (shearMix > 0) shearY += (target.ashearY + data.offsetShearY) * shearMix;
if (shearMix != 0) shearY += (target.ashearY + data.offsetShearY) * shearMix;
bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}