Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

NathanSweet 8 ani în urmă
părinte
comite
d66df0775b

+ 1 - 1
spine-c/src/spine/Animation.c

@@ -611,7 +611,7 @@ void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skelet
 
 	if (mixingOut && setupPose) {
 		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;
 	}
 

+ 4 - 2
spine-c/src/spine/AnimationState.c

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

+ 4 - 4
spine-lua/Animation.lua

@@ -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 ()

+ 14 - 13
spine-lua/AnimationState.lua

@@ -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