mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[lua] Fixed bug in AnimationState, indexing of timelines was incorrect. Fixed but in AttachmentTimeline, called wrong setAttachment
This commit is contained in:
parent
65982c7eca
commit
2e252783a7
@ -581,7 +581,7 @@ function Animation.AttachmentTimeline.new (frameCount)
|
||||
end
|
||||
|
||||
function self:getPropertyId ()
|
||||
return Timeline.attachment * SHL_24 + self.slotIndex
|
||||
return TimelineType.attachment * SHL_24 + self.slotIndex
|
||||
end
|
||||
|
||||
function self:apply (skeleton, lastTime, time, firedEvents, alpha, setupPose, mixingOut)
|
||||
@ -592,7 +592,7 @@ function Animation.AttachmentTimeline.new (frameCount)
|
||||
if not attachmentName then
|
||||
slot:setAttachment(nil)
|
||||
else
|
||||
skeleton:setAttachment(skeleton:getAttachmentByIndex(self.slotIndex, attachmentName))
|
||||
slot:setAttachment(skeleton:getAttachmentByIndex(self.slotIndex, attachmentName))
|
||||
end
|
||||
return;
|
||||
end
|
||||
@ -767,7 +767,7 @@ function Animation.EventTimeline.new (frameCount)
|
||||
}
|
||||
|
||||
function self:getPropertyId ()
|
||||
return Timeline.event * SHL_24
|
||||
return TimelineType.event * SHL_24
|
||||
end
|
||||
|
||||
function self:getFrameCount ()
|
||||
@ -824,7 +824,7 @@ function Animation.DrawOrderTimeline.new (frameCount)
|
||||
}
|
||||
|
||||
function self:getPropertyId ()
|
||||
return Timeline.drawOrder * SHL_24
|
||||
return TimelineType.drawOrder * SHL_24
|
||||
end
|
||||
|
||||
function self:getFrameCount ()
|
||||
|
||||
@ -232,18 +232,18 @@ function AnimationState:update (delta)
|
||||
end
|
||||
|
||||
if not skip then
|
||||
local next = current.next
|
||||
if next then
|
||||
local _next = current.next
|
||||
if _next then
|
||||
-- When the next entry's delay is passed, change to the next entry, preserving leftover time.
|
||||
local nextTime = current.trackLast - next.delay
|
||||
local nextTime = current.trackLast - _next.delay
|
||||
if nextTime >= 0 then
|
||||
next.delay = 0
|
||||
next.trackTime = nextTime + delta * next.timeScale
|
||||
_next.delay = 0
|
||||
_next.trackTime = nextTime + delta * _next.timeScale
|
||||
current.trackTime = current.trackTime + currentDelta
|
||||
self:setCurrent(i, next)
|
||||
while next.mixingFrom do
|
||||
next.mixTime = next.mixTime + currentDelta
|
||||
next = next.mixingFrom
|
||||
self:setCurrent(i, _next)
|
||||
while _next.mixingFrom do
|
||||
_next.mixTime = _next.mixTime + currentDelta
|
||||
_next = _next.mixingFrom
|
||||
end
|
||||
skip = true
|
||||
end
|
||||
@ -708,9 +708,9 @@ function AnimationState:_animationsChanged ()
|
||||
end
|
||||
|
||||
-- Set timelinesFirst for all entries, from lowest track to highest.
|
||||
local i = 1
|
||||
local n = highest
|
||||
while i <= n do
|
||||
local i = 0
|
||||
local n = highest + 1
|
||||
while i < n do
|
||||
local entry = tracks[i]
|
||||
if entry then
|
||||
self:setTimelinesFirst(entry);
|
||||
@ -719,7 +719,7 @@ function AnimationState:_animationsChanged ()
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
while i <= n do
|
||||
while i < n do
|
||||
local entry = tracks[i]
|
||||
if entry then self:checkTimelinesFirst(entry) end
|
||||
i = i + 1
|
||||
@ -756,6 +756,7 @@ function AnimationState:checkTimelinesUsage (entry, usageArray)
|
||||
local n = #entry.animation.timelines
|
||||
local timelines = entry.animation.timelines
|
||||
local usage = usageArray
|
||||
local i = 1
|
||||
while i <= n do
|
||||
local id = "" .. timelines[i]:getPropertyId()
|
||||
local contained = propertyIDs[id] == id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user