diff --git a/spine-as3/spine-as3-example/lib/spine-as3.swc b/spine-as3/spine-as3-example/lib/spine-as3.swc index 62336bc3c..3c1b185b6 100644 Binary files a/spine-as3/spine-as3-example/lib/spine-as3.swc and b/spine-as3/spine-as3-example/lib/spine-as3.swc differ diff --git a/spine-lua/AnimationState.lua b/spine-lua/AnimationState.lua index f26a64a11..9c5f4c1b9 100644 --- a/spine-lua/AnimationState.lua +++ b/spine-lua/AnimationState.lua @@ -211,9 +211,9 @@ function TrackEntry:setTimelineData(to, mixingToArray, propertyIDs) local entry = mixingTo[ii] skip = false if not entry:hasTimeline(id) then - if entry.mixDuration > 0 then + if entry.mixDuration > 0 then timelineData[i] = DIP_MIX - timelineDipMix[i] = entry + timelineDipMix[i] = entry skip = true break end @@ -293,7 +293,7 @@ function AnimationState:update (delta) current.delay = 0 end end - + if not skip then local _next = current.next if _next then @@ -330,7 +330,7 @@ function AnimationState:update (delta) from = from.mixingFrom end end - + current.trackTime = current.trackTime + currentDelta end end @@ -344,8 +344,11 @@ function AnimationState:updateMixingFrom (to, delta) local from = to.mixingFrom 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. 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). @@ -356,9 +359,7 @@ function AnimationState:updateMixingFrom (to, delta) end return finished end - - from.animationLast = from.nextAnimationLast - from.trackLast = from.nextTrackLast + from.trackTime = from.trackTime + delta * from.timeScale to.mixTime = to.mixTime + delta * to.timeScale return false; @@ -376,13 +377,23 @@ function AnimationState:apply (skeleton) for i,current in pairs(tracks) do if not (current == nil or current.delay > 0) then applied = true +<<<<<<< HEAD local blend = current.mixBlend if i == 0 then blend = MixBlend.first end - + -- Apply mixing from entries first. local mix = current.alpha - if current.mixingFrom then + if current.mixingFrom then 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 mix = 0 end @@ -401,9 +412,15 @@ function AnimationState:apply (skeleton) local timelinesRotation = current.timelinesRotation for i,timeline in ipairs(timelines) do +<<<<<<< HEAD local timelineBlend = MixBlend.setup 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 self:applyRotateTimeline(timeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, i * 2, firstFrame) -- FIXME passing ii * 2, indexing correct? @@ -446,18 +463,19 @@ function AnimationState:applyMixingFrom (to, skeleton, blend) local timelines = from.animation.timelines local alphaDip = from.alpha * to.interruptAlpha local alphaMix = alphaDip * (1 - mix) - + if blend == MixBlend.add then for i,timeline in ipairs(timelines) do timeline:apply(skeleton, animationLast, animationTime, events, alphaMix, blend, MixDirection.out) end +<<<<<<< HEAD else local timelineData = from.timelineData local timelineDipMix = from.timelineDipMix local firstFrame = #from.timelinesRotation == 0 local timelinesRotation = from.timelinesRotation - + from.totalAlpha = 0; for i,timeline in ipairs(timelines) do @@ -475,12 +493,19 @@ function AnimationState:applyMixingFrom (to, skeleton, blend) elseif timelineData[i] == DIP then timelineBlend = MixBlend.setup 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 timelineBlend = MixBlend.setup local dipMix = timelineDipMix[i] alpha = alphaDip * math_max(0, 1 - dipMix.mixtime / dipMix.mixDuration) end - + if not skipSubsequent then from.totalAlpha = from.totalAlpha + alpha if timeline.type == Animation.TimelineType.rotate then @@ -500,12 +525,17 @@ function AnimationState:applyMixingFrom (to, skeleton, blend) return mix end +<<<<<<< HEAD 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+1] = 0 end - + if alpha == 1 then timeline:apply(skeleton, 0, time, nil, 1, blend, MixDirection._in) return @@ -593,7 +623,7 @@ function AnimationState:queueEvents (entry, animationTime) -- Queue complete if completed a loop iteration or the animation. local queueComplete = false - if entry.loop then + if entry.loop then queueComplete = duration == 0 or (trackLastWrapped > entry.trackTime % duration) else queueComplete = (animationTime >= animationEnd and entry.animationLast < animationEnd) @@ -659,11 +689,11 @@ function AnimationState:setCurrent (index, current, interrupt) if interrupt then queue:interrupt(from) end current.mixingFrom = from current.mixTime = 0 - + if from.mixingFrom and from.mixDuration > 0 then current.interruptAlpha = current.interruptAlpha * math_min(1, from.mixTime / from.mixDuration) end - + from.timelinesRotation = {}; end @@ -720,7 +750,7 @@ function AnimationState:addAnimation (trackIndex, animation, loop, delay) local entry = self:trackEntry(trackIndex, animation, loop, last) local queue = self.queue local data = self.data - + if not last then self:setCurrent(trackIndex, entry, true) queue:drain() @@ -795,7 +825,7 @@ function AnimationState:trackEntry (trackIndex, animation, loop, last) entry.trackTime = 0 entry.trackLast = -1 entry.nextTrackLast = -1 - entry.trackEnd = 999999999 + entry.trackEnd = 999999999 entry.timeScale = 1 entry.alpha = 1 @@ -817,7 +847,7 @@ function AnimationState:disposeNext (entry) queue:dispose(_next) _next = _next.next end - entry.next = nil + entry.next = nil end function AnimationState:_animationsChanged () @@ -826,10 +856,15 @@ function AnimationState:_animationsChanged () self.propertyIDs = {} local propertyIDs = self.propertyIDs local mixingTo = self.mixingTo - + for i, entry in pairs(self.tracks) do +<<<<<<< HEAD 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 diff --git a/spine-starling/spine-starling-example/lib/spine-as3.swc b/spine-starling/spine-starling-example/lib/spine-as3.swc index 62336bc3c..3c1b185b6 100644 Binary files a/spine-starling/spine-starling-example/lib/spine-as3.swc and b/spine-starling/spine-starling-example/lib/spine-as3.swc differ diff --git a/spine-starling/spine-starling/lib/spine-as3.swc b/spine-starling/spine-starling/lib/spine-as3.swc index 62336bc3c..3c1b185b6 100644 Binary files a/spine-starling/spine-starling/lib/spine-as3.swc and b/spine-starling/spine-starling/lib/spine-as3.swc differ