mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 02:36:56 +08:00
[lua] Allow negative scale and shear mix in transform constraint. See #1227.
This commit is contained in:
parent
1a50622fc5
commit
3f77c0e172
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user