Browse Source

[lua] Allow negative scale and shear mix in transform constraint. See #1227.

badlogic 6 years ago
parent
commit
3f77c0e172
1 changed files with 4 additions and 4 deletions
  1. 4 4
      spine-lua/TransformConstraint.lua

+ 4 - 4
spine-lua/TransformConstraint.lua

@@ -281,7 +281,7 @@ function TransformConstraint:applyAbsoluteLocal ()
 
 
 		local scaleX = bone.ascaleX
 		local scaleX = bone.ascaleX
 		local scaleY = bone.ascaleY
 		local scaleY = bone.ascaleY
-		if scaleMix > 0 then
+		if scaleMix ~= 0 then
 			if scaleX > 0.00001 then
 			if scaleX > 0.00001 then
 				scaleX = (scaleX + (target.ascaleX - scaleX + self.data.offsetScaleX) * scaleMix) / scaleX
 				scaleX = (scaleX + (target.ascaleX - scaleX + self.data.offsetScaleX) * scaleMix) / scaleX
 			end
 			end
@@ -291,7 +291,7 @@ function TransformConstraint:applyAbsoluteLocal ()
 		end
 		end
 
 
 		local shearY = bone.ashearY
 		local shearY = bone.ashearY
-		if shearMix > 0 then
+		if shearMix ~= 0 then
 			local r = target.ashearY - shearY + self.data.offsetShearY
 			local r = target.ashearY - shearY + self.data.offsetShearY
 			r = r - (16384 - math_floor(16384.499999999996 - r / 360)) * 360
 			r = r - (16384 - math_floor(16384.499999999996 - r / 360)) * 360
 			bone.shearY = bone.shearY + r * shearMix
 			bone.shearY = bone.shearY + r * shearMix
@@ -324,7 +324,7 @@ function TransformConstraint:applyRelativeLocal ()
 
 
 		local scaleX = bone.ascaleX
 		local scaleX = bone.ascaleX
 		local scaleY = bone.ascaleY
 		local scaleY = bone.ascaleY
-		if scaleMix > 0 then
+		if scaleMix ~= 0 then
 			if scaleX > 0.00001 then
 			if scaleX > 0.00001 then
 				scaleX = scaleX * (((target.ascaleX - 1 + self.data.offsetScaleX) * scaleMix) + 1)
 				scaleX = scaleX * (((target.ascaleX - 1 + self.data.offsetScaleX) * scaleMix) + 1)
 			end
 			end
@@ -334,7 +334,7 @@ function TransformConstraint:applyRelativeLocal ()
 		end
 		end
 
 
 		local shearY = bone.ashearY
 		local shearY = bone.ashearY
-		if shearMix > 0 then shearY = shearY + (target.ashearY + self.data.offsetShearY) * shearMix end
+		if shearMix ~= 0 then shearY = shearY + (target.ashearY + self.data.offsetShearY) * shearMix end
 
 
 		bone:updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY)
 		bone:updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY)
 	end
 	end