mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 10:46:53 +08:00
[lua] Ported fix for DeformTimeline, see #932
This commit is contained in:
parent
8b14b18fda
commit
807c4d27bd
@ -800,21 +800,43 @@ function Animation.DeformTimeline.new (frameCount)
|
|||||||
|
|
||||||
local frameVertices = self.frameVertices
|
local frameVertices = self.frameVertices
|
||||||
local vertexCount = #(frameVertices[0])
|
local vertexCount = #(frameVertices[0])
|
||||||
|
|
||||||
if (#verticesArray ~= vertexCount and not setupPose) then alpha = 1 end -- Don't mix from uninitialized slot vertices.
|
|
||||||
local vertices = utils.setArraySize(verticesArray, vertexCount)
|
local vertices = utils.setArraySize(verticesArray, vertexCount)
|
||||||
|
|
||||||
if time < frames[0] then
|
if time < frames[0] then
|
||||||
|
local vertexAttachment = slotAttachment;
|
||||||
if pose == MixPose.setup then
|
if pose == MixPose.setup then
|
||||||
verticesArray = {}
|
if (vertexAttachment.bones == nil) then
|
||||||
slot.attachmentVertices = verticesArray
|
local i = 1
|
||||||
elseif pose == MixPose.current then
|
local setupVertices = vertexAttachment.vertices
|
||||||
alpha = 1 - alpha
|
while i <= vertexCount do
|
||||||
local i = 1
|
vertices[i] = setupVertices[i]
|
||||||
while i <= vertexCount do
|
i = i + 1
|
||||||
vertices[i] = vertices[i] * alpha
|
end
|
||||||
i = i + 1
|
else
|
||||||
|
local i = 1
|
||||||
|
while i <= vertexCount do
|
||||||
|
vertices[i] = 0
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
elseif pose == MixPose.current then
|
||||||
|
if (alpha ~= 1) then
|
||||||
|
if (vertexAttachment.bones == nil) then
|
||||||
|
local setupVertices = vertexAttachment.vertices
|
||||||
|
local i = 1
|
||||||
|
while i <= vertexCount do
|
||||||
|
vertices[i] = vertices[i] + (setupVertices[i] - vertices[i]) * alpha
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
alpha = 1 - alpha
|
||||||
|
local i = 1
|
||||||
|
while i <= vertexCount do
|
||||||
|
vertices[i] = vertices[i] * alpha
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user