Merge remote-tracking branch 'origin/master'

This commit is contained in:
NathanSweet 2016-11-23 13:38:54 +01:00
commit d66df0775b
4 changed files with 23 additions and 20 deletions

View File

@ -611,7 +611,7 @@ void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skelet
if (mixingOut && setupPose) { if (mixingOut && setupPose) {
const char* attachmentName = slot->data->attachmentName; const char* attachmentName = slot->data->attachmentName;
spSlot_setAttachment(slot, attachmentName ? 0 : spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName)); spSlot_setAttachment(slot, attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
return; return;
} }

View File

@ -67,6 +67,7 @@ _spEventQueue* _spEventQueue_create (_spAnimationState* state) {
void _spEventQueue_free (_spEventQueue* self) { void _spEventQueue_free (_spEventQueue* self) {
FREE(self->objects); FREE(self->objects);
FREE(self);
} }
void _spEventQueue_ensureCapacity (_spEventQueue* self, int newElements) { void _spEventQueue_ensureCapacity (_spEventQueue* self, int newElements) {
@ -152,8 +153,8 @@ void _spEventQueue_drain (_spEventQueue* self) {
if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, 0); if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, 0);
/* Fall through. */ /* Fall through. */
case SP_ANIMATION_DISPOSE: case SP_ANIMATION_DISPOSE:
if (entry->listener) entry->listener(SUPER(self->state), type, entry, 0); if (entry->listener) entry->listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0);
if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, 0); if (self->state->super.listener) self->state->super.listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0);
_spAnimationState_disposeTrackEntry(entry); _spAnimationState_disposeTrackEntry(entry);
break; break;
case SP_ANIMATION_EVENT: case SP_ANIMATION_EVENT:
@ -214,6 +215,7 @@ void spAnimationState_dispose (spAnimationState* self) {
_spEventQueue_free(internal->queue); _spEventQueue_free(internal->queue);
FREE(internal->events); FREE(internal->events);
FREE(internal->propertyIDs); FREE(internal->propertyIDs);
FREE(internal);
} }
void spAnimationState_update (spAnimationState* self, float delta) { void spAnimationState_update (spAnimationState* self, float delta) {

View File

@ -581,7 +581,7 @@ function Animation.AttachmentTimeline.new (frameCount)
end end
function self:getPropertyId () function self:getPropertyId ()
return Timeline.attachment * SHL_24 + self.slotIndex return TimelineType.attachment * SHL_24 + self.slotIndex
end end
function self:apply (skeleton, lastTime, time, firedEvents, alpha, setupPose, mixingOut) function self:apply (skeleton, lastTime, time, firedEvents, alpha, setupPose, mixingOut)
@ -592,7 +592,7 @@ function Animation.AttachmentTimeline.new (frameCount)
if not attachmentName then if not attachmentName then
slot:setAttachment(nil) slot:setAttachment(nil)
else else
skeleton:setAttachment(skeleton:getAttachmentByIndex(self.slotIndex, attachmentName)) slot:setAttachment(skeleton:getAttachmentByIndex(self.slotIndex, attachmentName))
end end
return; return;
end end
@ -767,7 +767,7 @@ function Animation.EventTimeline.new (frameCount)
} }
function self:getPropertyId () function self:getPropertyId ()
return Timeline.event * SHL_24 return TimelineType.event * SHL_24
end end
function self:getFrameCount () function self:getFrameCount ()
@ -824,7 +824,7 @@ function Animation.DrawOrderTimeline.new (frameCount)
} }
function self:getPropertyId () function self:getPropertyId ()
return Timeline.drawOrder * SHL_24 return TimelineType.drawOrder * SHL_24
end end
function self:getFrameCount () function self:getFrameCount ()

View File

@ -232,18 +232,18 @@ function AnimationState:update (delta)
end end
if not skip then if not skip then
local next = current.next local _next = current.next
if next then if _next then
-- When the next entry's delay is passed, change to the next entry, preserving leftover time. -- 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 if nextTime >= 0 then
next.delay = 0 _next.delay = 0
next.trackTime = nextTime + delta * next.timeScale _next.trackTime = nextTime + delta * _next.timeScale
current.trackTime = current.trackTime + currentDelta current.trackTime = current.trackTime + currentDelta
self:setCurrent(i, next) self:setCurrent(i, _next)
while next.mixingFrom do while _next.mixingFrom do
next.mixTime = next.mixTime + currentDelta _next.mixTime = _next.mixTime + currentDelta
next = next.mixingFrom _next = _next.mixingFrom
end end
skip = true skip = true
end end
@ -708,9 +708,9 @@ function AnimationState:_animationsChanged ()
end end
-- Set timelinesFirst for all entries, from lowest track to highest. -- Set timelinesFirst for all entries, from lowest track to highest.
local i = 1 local i = 0
local n = highest local n = highest + 1
while i <= n do while i < n do
local entry = tracks[i] local entry = tracks[i]
if entry then if entry then
self:setTimelinesFirst(entry); self:setTimelinesFirst(entry);
@ -719,7 +719,7 @@ function AnimationState:_animationsChanged ()
end end
i = i + 1 i = i + 1
end end
while i <= n do while i < n do
local entry = tracks[i] local entry = tracks[i]
if entry then self:checkTimelinesFirst(entry) end if entry then self:checkTimelinesFirst(entry) end
i = i + 1 i = i + 1
@ -756,6 +756,7 @@ function AnimationState:checkTimelinesUsage (entry, usageArray)
local n = #entry.animation.timelines local n = #entry.animation.timelines
local timelines = entry.animation.timelines local timelines = entry.animation.timelines
local usage = usageArray local usage = usageArray
local i = 1
while i <= n do while i <= n do
local id = "" .. timelines[i]:getPropertyId() local id = "" .. timelines[i]:getPropertyId()
local contained = propertyIDs[id] == id local contained = propertyIDs[id] == id