mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
[lua] Ported 0 timeScale fix, see #1194.
This commit is contained in:
parent
0e2c41b491
commit
03e578642c
@ -299,7 +299,7 @@ function AnimationState:updateMixingFrom (to, delta)
|
|||||||
from.trackLast = from.nextTrackLast
|
from.trackLast = from.nextTrackLast
|
||||||
|
|
||||||
-- Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
-- Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
||||||
if (to.mixTime > 0 and (to.mixTime >= to.mixDuration or to.timeScale == 0)) then
|
if (to.mixTime > 0 and to.mixTime >= to.mixDuration) then
|
||||||
-- Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
-- Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
||||||
if (from.totalAlpha == 0 or to.mixDuration == 0) then
|
if (from.totalAlpha == 0 or to.mixDuration == 0) then
|
||||||
to.mixingFrom = from.mixingFrom
|
to.mixingFrom = from.mixingFrom
|
||||||
@ -310,6 +310,13 @@ function AnimationState:updateMixingFrom (to, delta)
|
|||||||
return finished
|
return finished
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- If to has 0 timeScale and is not the first entry, remove the mix and apply it one more time to return to the setup pose.
|
||||||
|
if to.timeScale == 0 and to.mixingTo then
|
||||||
|
to.timeScale = 1
|
||||||
|
to.mixTime = 0
|
||||||
|
to.mixDuration = 0
|
||||||
|
end
|
||||||
|
|
||||||
from.trackTime = from.trackTime + delta * from.timeScale
|
from.trackTime = from.trackTime + delta * from.timeScale
|
||||||
to.mixTime = to.mixTime + delta * to.timeScale
|
to.mixTime = to.mixTime + delta * to.timeScale
|
||||||
return false;
|
return false;
|
||||||
@ -781,30 +788,30 @@ function AnimationState:_animationsChanged ()
|
|||||||
|
|
||||||
self.propertyIDs = {}
|
self.propertyIDs = {}
|
||||||
|
|
||||||
for i, entry in pairs(self.tracks) do
|
for i, entry in pairs(self.tracks) do
|
||||||
if entry then
|
if entry then
|
||||||
while entry.mixingFrom do
|
while entry.mixingFrom do
|
||||||
entry = entry.mixingFrom
|
entry = entry.mixingFrom
|
||||||
end
|
end
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
if (entry.mixingTo == nil or entry.mixBlend ~= MixBlend.add) then
|
if (entry.mixingTo == nil or entry.mixBlend ~= MixBlend.add) then
|
||||||
self:setTimelineModes(entry)
|
self:setTimelineModes(entry)
|
||||||
end
|
end
|
||||||
entry = entry.mixingTo
|
entry = entry.mixingTo
|
||||||
until (entry == nil)
|
until (entry == nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function AnimationState:setTimelineModes(entry)
|
function AnimationState:setTimelineModes(entry)
|
||||||
local to = entry.mixingTo
|
local to = entry.mixingTo
|
||||||
local timelines = entry.animation.timelines
|
local timelines = entry.animation.timelines
|
||||||
local timelinesCount = #entry.animation.timelines
|
local timelinesCount = #entry.animation.timelines
|
||||||
local timelineMode = entry.timelineMode
|
local timelineMode = entry.timelineMode
|
||||||
local timelineHoldMix = entry.timelineHoldMix
|
local timelineHoldMix = entry.timelineHoldMix
|
||||||
local propertyIDs = self.propertyIDs
|
local propertyIDs = self.propertyIDs
|
||||||
|
|
||||||
if (to and to.holdPrevious) then
|
if (to and to.holdPrevious) then
|
||||||
local i = 1
|
local i = 1
|
||||||
while i <= timelinesCount do
|
while i <= timelinesCount do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user