From 90f3823c15625e18a7d8ace33e367ff6e42ddb18 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 13 Dec 2018 18:07:23 +0100 Subject: [PATCH] [csharp] Allow negative scale and shear mix in transform constraint. See #1227. --- spine-csharp/src/TransformConstraint.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spine-csharp/src/TransformConstraint.cs b/spine-csharp/src/TransformConstraint.cs index 395bd26da..10bca9e74 100644 --- a/spine-csharp/src/TransformConstraint.cs +++ b/spine-csharp/src/TransformConstraint.cs @@ -58,7 +58,7 @@ namespace Spine { bones = new ExposedList(); 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); }