mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[csharp] Allow negative scale and shear mix in transform constraint. See #1227.
This commit is contained in:
parent
3f77c0e172
commit
90f3823c15
@ -58,7 +58,7 @@ namespace Spine {
|
||||
bones = new ExposedList<Bone>();
|
||||
foreach (BoneData boneData in data.bones)
|
||||
bones.Add (skeleton.FindBone (boneData.name));
|
||||
|
||||
|
||||
target = skeleton.FindBone(data.target.name);
|
||||
}
|
||||
|
||||
@ -230,13 +230,13 @@ namespace Spine {
|
||||
}
|
||||
|
||||
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
|
||||
if (scaleMix > 0) {
|
||||
if (scaleMix != 0) {
|
||||
if (scaleX > 0.00001f) scaleX = (scaleX + (target.ascaleX - scaleX + data.offsetScaleX) * scaleMix) / scaleX;
|
||||
if (scaleY > 0.00001f) 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;
|
||||
@ -265,13 +265,13 @@ namespace Spine {
|
||||
}
|
||||
|
||||
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
|
||||
if (scaleMix > 0) {
|
||||
if (scaleMix != 0) {
|
||||
if (scaleX > 0.00001f) scaleX *= ((target.ascaleX - 1 + data.offsetScaleX) * scaleMix) + 1;
|
||||
if (scaleY > 0.00001f) 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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user