mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
e406c140be
Binary file not shown.
@ -211,9 +211,9 @@ function TrackEntry:setTimelineData(to, mixingToArray, propertyIDs)
|
|||||||
local entry = mixingTo[ii]
|
local entry = mixingTo[ii]
|
||||||
skip = false
|
skip = false
|
||||||
if not entry:hasTimeline(id) then
|
if not entry:hasTimeline(id) then
|
||||||
if entry.mixDuration > 0 then
|
if entry.mixDuration > 0 then
|
||||||
timelineData[i] = DIP_MIX
|
timelineData[i] = DIP_MIX
|
||||||
timelineDipMix[i] = entry
|
timelineDipMix[i] = entry
|
||||||
skip = true
|
skip = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -293,7 +293,7 @@ function AnimationState:update (delta)
|
|||||||
current.delay = 0
|
current.delay = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not skip then
|
if not skip then
|
||||||
local _next = current.next
|
local _next = current.next
|
||||||
if _next then
|
if _next then
|
||||||
@ -330,7 +330,7 @@ function AnimationState:update (delta)
|
|||||||
from = from.mixingFrom
|
from = from.mixingFrom
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
current.trackTime = current.trackTime + currentDelta
|
current.trackTime = current.trackTime + currentDelta
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -344,8 +344,11 @@ function AnimationState:updateMixingFrom (to, delta)
|
|||||||
local from = to.mixingFrom
|
local from = to.mixingFrom
|
||||||
if from == nil then return true end
|
if from == nil then return true end
|
||||||
|
|
||||||
local finished = self:updateMixingFrom(from, delta)
|
local finished = self:updateMixingFrom(from, delta)
|
||||||
|
|
||||||
|
from.animationLast = from.nextAnimationLast
|
||||||
|
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 or to.timeScale == 0)) 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).
|
||||||
@ -356,9 +359,7 @@ function AnimationState:updateMixingFrom (to, delta)
|
|||||||
end
|
end
|
||||||
return finished
|
return finished
|
||||||
end
|
end
|
||||||
|
|
||||||
from.animationLast = from.nextAnimationLast
|
|
||||||
from.trackLast = from.nextTrackLast
|
|
||||||
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;
|
||||||
@ -376,13 +377,23 @@ function AnimationState:apply (skeleton)
|
|||||||
for i,current in pairs(tracks) do
|
for i,current in pairs(tracks) do
|
||||||
if not (current == nil or current.delay > 0) then
|
if not (current == nil or current.delay > 0) then
|
||||||
applied = true
|
applied = true
|
||||||
|
<<<<<<< HEAD
|
||||||
local blend = current.mixBlend
|
local blend = current.mixBlend
|
||||||
if i == 0 then blend = MixBlend.first end
|
if i == 0 then blend = MixBlend.first end
|
||||||
|
|
||||||
-- Apply mixing from entries first.
|
-- Apply mixing from entries first.
|
||||||
local mix = current.alpha
|
local mix = current.alpha
|
||||||
if current.mixingFrom then
|
if current.mixingFrom then
|
||||||
mix = mix * self:applyMixingFrom(current, skeleton, blend)
|
mix = mix * self:applyMixingFrom(current, skeleton, blend)
|
||||||
|
=======
|
||||||
|
local currrentPose = MixPose.currentLayered
|
||||||
|
if i == 0 then currentPose = MixPose.current end
|
||||||
|
|
||||||
|
-- Apply mixing from entries first.
|
||||||
|
local mix = current.alpha
|
||||||
|
if current.mixingFrom then
|
||||||
|
mix = mix * self:applyMixingFrom(current, skeleton, currentPose)
|
||||||
|
>>>>>>> 3.6
|
||||||
elseif current.trackTime >= current.trackEnd and current.next == nil then
|
elseif current.trackTime >= current.trackEnd and current.next == nil then
|
||||||
mix = 0
|
mix = 0
|
||||||
end
|
end
|
||||||
@ -401,9 +412,15 @@ function AnimationState:apply (skeleton)
|
|||||||
local timelinesRotation = current.timelinesRotation
|
local timelinesRotation = current.timelinesRotation
|
||||||
|
|
||||||
for i,timeline in ipairs(timelines) do
|
for i,timeline in ipairs(timelines) do
|
||||||
|
<<<<<<< HEAD
|
||||||
local timelineBlend = MixBlend.setup
|
local timelineBlend = MixBlend.setup
|
||||||
if timelineData[i] == SUBSEQUENT then timelineBlend = blend end
|
if timelineData[i] == SUBSEQUENT then timelineBlend = blend end
|
||||||
|
|
||||||
|
=======
|
||||||
|
local pose = MixPose.currentPose
|
||||||
|
if timelineData[i] >= FIRST then pose = MixPose.setup end
|
||||||
|
|
||||||
|
>>>>>>> 3.6
|
||||||
if timeline.type == Animation.TimelineType.rotate then
|
if timeline.type == Animation.TimelineType.rotate then
|
||||||
self:applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, i * 2,
|
self:applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, i * 2,
|
||||||
firstFrame) -- FIXME passing ii * 2, indexing correct?
|
firstFrame) -- FIXME passing ii * 2, indexing correct?
|
||||||
@ -446,18 +463,19 @@ function AnimationState:applyMixingFrom (to, skeleton, blend)
|
|||||||
local timelines = from.animation.timelines
|
local timelines = from.animation.timelines
|
||||||
local alphaDip = from.alpha * to.interruptAlpha
|
local alphaDip = from.alpha * to.interruptAlpha
|
||||||
local alphaMix = alphaDip * (1 - mix)
|
local alphaMix = alphaDip * (1 - mix)
|
||||||
|
|
||||||
if blend == MixBlend.add then
|
if blend == MixBlend.add then
|
||||||
for i,timeline in ipairs(timelines) do
|
for i,timeline in ipairs(timelines) do
|
||||||
timeline:apply(skeleton, animationLast, animationTime, events, alphaMix, blend, MixDirection.out)
|
timeline:apply(skeleton, animationLast, animationTime, events, alphaMix, blend, MixDirection.out)
|
||||||
end
|
end
|
||||||
|
<<<<<<< HEAD
|
||||||
else
|
else
|
||||||
local timelineData = from.timelineData
|
local timelineData = from.timelineData
|
||||||
local timelineDipMix = from.timelineDipMix
|
local timelineDipMix = from.timelineDipMix
|
||||||
|
|
||||||
local firstFrame = #from.timelinesRotation == 0
|
local firstFrame = #from.timelinesRotation == 0
|
||||||
local timelinesRotation = from.timelinesRotation
|
local timelinesRotation = from.timelinesRotation
|
||||||
|
|
||||||
from.totalAlpha = 0;
|
from.totalAlpha = 0;
|
||||||
|
|
||||||
for i,timeline in ipairs(timelines) do
|
for i,timeline in ipairs(timelines) do
|
||||||
@ -475,12 +493,19 @@ function AnimationState:applyMixingFrom (to, skeleton, blend)
|
|||||||
elseif timelineData[i] == DIP then
|
elseif timelineData[i] == DIP then
|
||||||
timelineBlend = MixBlend.setup
|
timelineBlend = MixBlend.setup
|
||||||
alpha = alphaDip
|
alpha = alphaDip
|
||||||
|
=======
|
||||||
|
|
||||||
|
if not skipSubsequent then
|
||||||
|
from.totalAlpha = from.totalAlpha + alpha
|
||||||
|
if timeline.type == Animation.TimelineType.rotate then
|
||||||
|
self:applyRotateTimeline(timeline, skeleton, animationTime, alpha, pose, timelinesRotation, i * 2, firstFrame)
|
||||||
|
>>>>>>> 3.6
|
||||||
else
|
else
|
||||||
timelineBlend = MixBlend.setup
|
timelineBlend = MixBlend.setup
|
||||||
local dipMix = timelineDipMix[i]
|
local dipMix = timelineDipMix[i]
|
||||||
alpha = alphaDip * math_max(0, 1 - dipMix.mixtime / dipMix.mixDuration)
|
alpha = alphaDip * math_max(0, 1 - dipMix.mixtime / dipMix.mixDuration)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not skipSubsequent then
|
if not skipSubsequent then
|
||||||
from.totalAlpha = from.totalAlpha + alpha
|
from.totalAlpha = from.totalAlpha + alpha
|
||||||
if timeline.type == Animation.TimelineType.rotate then
|
if timeline.type == Animation.TimelineType.rotate then
|
||||||
@ -500,12 +525,17 @@ function AnimationState:applyMixingFrom (to, skeleton, blend)
|
|||||||
return mix
|
return mix
|
||||||
end
|
end
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame)
|
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame)
|
||||||
if firstFrame then
|
if firstFrame then
|
||||||
|
=======
|
||||||
|
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, pose, timelinesRotation, i, firstFrame)
|
||||||
|
if firstFrame then
|
||||||
|
>>>>>>> 3.6
|
||||||
timelinesRotation[i] = 0
|
timelinesRotation[i] = 0
|
||||||
timelinesRotation[i+1] = 0
|
timelinesRotation[i+1] = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if alpha == 1 then
|
if alpha == 1 then
|
||||||
timeline:apply(skeleton, 0, time, nil, 1, blend, MixDirection._in)
|
timeline:apply(skeleton, 0, time, nil, 1, blend, MixDirection._in)
|
||||||
return
|
return
|
||||||
@ -593,7 +623,7 @@ function AnimationState:queueEvents (entry, animationTime)
|
|||||||
|
|
||||||
-- Queue complete if completed a loop iteration or the animation.
|
-- Queue complete if completed a loop iteration or the animation.
|
||||||
local queueComplete = false
|
local queueComplete = false
|
||||||
if entry.loop then
|
if entry.loop then
|
||||||
queueComplete = duration == 0 or (trackLastWrapped > entry.trackTime % duration)
|
queueComplete = duration == 0 or (trackLastWrapped > entry.trackTime % duration)
|
||||||
else
|
else
|
||||||
queueComplete = (animationTime >= animationEnd and entry.animationLast < animationEnd)
|
queueComplete = (animationTime >= animationEnd and entry.animationLast < animationEnd)
|
||||||
@ -659,11 +689,11 @@ function AnimationState:setCurrent (index, current, interrupt)
|
|||||||
if interrupt then queue:interrupt(from) end
|
if interrupt then queue:interrupt(from) end
|
||||||
current.mixingFrom = from
|
current.mixingFrom = from
|
||||||
current.mixTime = 0
|
current.mixTime = 0
|
||||||
|
|
||||||
if from.mixingFrom and from.mixDuration > 0 then
|
if from.mixingFrom and from.mixDuration > 0 then
|
||||||
current.interruptAlpha = current.interruptAlpha * math_min(1, from.mixTime / from.mixDuration)
|
current.interruptAlpha = current.interruptAlpha * math_min(1, from.mixTime / from.mixDuration)
|
||||||
end
|
end
|
||||||
|
|
||||||
from.timelinesRotation = {};
|
from.timelinesRotation = {};
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -720,7 +750,7 @@ function AnimationState:addAnimation (trackIndex, animation, loop, delay)
|
|||||||
local entry = self:trackEntry(trackIndex, animation, loop, last)
|
local entry = self:trackEntry(trackIndex, animation, loop, last)
|
||||||
local queue = self.queue
|
local queue = self.queue
|
||||||
local data = self.data
|
local data = self.data
|
||||||
|
|
||||||
if not last then
|
if not last then
|
||||||
self:setCurrent(trackIndex, entry, true)
|
self:setCurrent(trackIndex, entry, true)
|
||||||
queue:drain()
|
queue:drain()
|
||||||
@ -795,7 +825,7 @@ function AnimationState:trackEntry (trackIndex, animation, loop, last)
|
|||||||
entry.trackTime = 0
|
entry.trackTime = 0
|
||||||
entry.trackLast = -1
|
entry.trackLast = -1
|
||||||
entry.nextTrackLast = -1
|
entry.nextTrackLast = -1
|
||||||
entry.trackEnd = 999999999
|
entry.trackEnd = 999999999
|
||||||
entry.timeScale = 1
|
entry.timeScale = 1
|
||||||
|
|
||||||
entry.alpha = 1
|
entry.alpha = 1
|
||||||
@ -817,7 +847,7 @@ function AnimationState:disposeNext (entry)
|
|||||||
queue:dispose(_next)
|
queue:dispose(_next)
|
||||||
_next = _next.next
|
_next = _next.next
|
||||||
end
|
end
|
||||||
entry.next = nil
|
entry.next = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function AnimationState:_animationsChanged ()
|
function AnimationState:_animationsChanged ()
|
||||||
@ -826,10 +856,15 @@ function AnimationState:_animationsChanged ()
|
|||||||
self.propertyIDs = {}
|
self.propertyIDs = {}
|
||||||
local propertyIDs = self.propertyIDs
|
local propertyIDs = self.propertyIDs
|
||||||
local mixingTo = self.mixingTo
|
local mixingTo = self.mixingTo
|
||||||
|
|
||||||
for i, entry in pairs(self.tracks) do
|
for i, entry in pairs(self.tracks) do
|
||||||
|
<<<<<<< HEAD
|
||||||
if entry and (i == 0 or entry.mixBlend ~= MixBlend.add) then
|
if entry and (i == 0 or entry.mixBlend ~= MixBlend.add) then
|
||||||
entry:setTimelineData(nil, mixingTo, propertyIDs)
|
entry:setTimelineData(nil, mixingTo, propertyIDs)
|
||||||
|
=======
|
||||||
|
if entry then
|
||||||
|
entry:setTimelineData(nil, mixingTo, propertyIDs)
|
||||||
|
>>>>>>> 3.6
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user