瀏覽代碼

Fixed AnimationState#clearNext.

Nathan Sweet 4 年之前
父節點
當前提交
d4271ccae9

+ 6 - 10
spine-as3/spine-as3/src/spine/animation/AnimationState.as

@@ -106,7 +106,7 @@ package spine.animation {
 					if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
 						tracks[i] = null;
 						queue.end(current);
-						disposeNext(current);
+						clearNext(current);
 						continue;
 					}
 				}
@@ -445,7 +445,7 @@ package spine.animation {
 
 			queue.end(current);
 
-			disposeNext(current);
+			clearNext(current);
 
 			var entry : TrackEntry = current;
 			while (true) {
@@ -462,11 +462,6 @@ package spine.animation {
 			queue.drain();
 		}
 
-		/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
-		private function clearNext(entry : TrackEntry) : void {
-			disposeNext(entry.next);
-		}
-
 		private function setCurrent(index : int, current : TrackEntry, interrupt : Boolean) : void {
 			var from : TrackEntry = expandToIndex(index);
 			tracks[index] = current;
@@ -504,11 +499,11 @@ package spine.animation {
 					tracks[trackIndex] = current.mixingFrom;
 					queue.interrupt(current);
 					queue.end(current);
-					disposeNext(current);
+					clearNext(current);
 					current = current.mixingFrom;
 					interrupt = false;
 				} else
-					disposeNext(current);
+					clearNext(current);
 			}
 			var entry : TrackEntry = trackEntry(trackIndex, animation, loop, current);
 			setCurrent(trackIndex, entry, interrupt);
@@ -609,7 +604,8 @@ package spine.animation {
 			return entry;
 		}
 
-		private function disposeNext(entry : TrackEntry) : void {
+		/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
+		public function clearNext(entry : TrackEntry) : void {
 			var next : TrackEntry = entry.next;
 			while (next != null) {
 				queue.dispose(next);

+ 6 - 12
spine-csharp/src/AnimationState.cs

@@ -170,7 +170,7 @@ namespace Spine {
 					// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
 					tracksItems[i] = null;
 					queue.End(current);
-					DisposeNext(current);
+					ClearNext(current);
 					continue;
 				}
 				if (current.mixingFrom != null && UpdateMixingFrom(current, delta)) {
@@ -615,7 +615,7 @@ namespace Spine {
 
 			queue.End(current);
 
-			DisposeNext(current);
+			ClearNext(current);
 
 			TrackEntry entry = current;
 			while (true) {
@@ -632,12 +632,6 @@ namespace Spine {
 			queue.Drain();
 		}
 
-		/// <summary>
-		/// Removes the <see cref="TrackEntry.Next">next entry</see> and all entries after it for the specified entry.</summary>
-		public void ClearNext (TrackEntry entry) {
-			DisposeNext(entry.next);
-		}
-
 		/// <summary>Sets the active TrackEntry for a given track number.</summary>
 		private void SetCurrent (int index, TrackEntry current, bool interrupt) {
 			TrackEntry from = ExpandToIndex(index);
@@ -683,11 +677,11 @@ namespace Spine {
 					tracks.Items[trackIndex] = current.mixingFrom;
 					queue.Interrupt(current);
 					queue.End(current);
-					DisposeNext(current);
+					ClearNext(current);
 					current = current.mixingFrom;
 					interrupt = false; // mixingFrom is current again, but don't interrupt it twice.
 				} else
-					DisposeNext(current);
+					ClearNext(current);
 			}
 			TrackEntry entry = NewTrackEntry(trackIndex, animation, loop, current);
 			SetCurrent(trackIndex, entry, interrupt);
@@ -836,8 +830,8 @@ namespace Spine {
 			return entry;
 		}
 
-		/// <summary>Dispose all track entries queued after the given TrackEntry.</summary>
-		private void DisposeNext (TrackEntry entry) {
+		/// <summary>Removes the <see cref="TrackEntry.Next">next entry</see> and all entries after it for the specified entry.</summary>
+		public void ClearNext (TrackEntry entry) {
 			TrackEntry next = entry.next;
 			while (next != null) {
 				queue.Dispose(next);

+ 6 - 10
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java

@@ -150,7 +150,7 @@ public class AnimationState {
 				// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
 				tracks[i] = null;
 				queue.end(current);
-				disposeNext(current);
+				clearNext(current);
 				continue;
 			}
 			if (current.mixingFrom != null && updateMixingFrom(current, delta)) {
@@ -514,7 +514,7 @@ public class AnimationState {
 
 		queue.end(current);
 
-		disposeNext(current);
+		clearNext(current);
 
 		TrackEntry entry = current;
 		while (true) {
@@ -531,11 +531,6 @@ public class AnimationState {
 		queue.drain();
 	}
 
-	/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
-	public void clearNext (TrackEntry entry) {
-		disposeNext(entry.next);
-	}
-
 	private void setCurrent (int index, TrackEntry current, boolean interrupt) {
 		TrackEntry from = expandToIndex(index);
 		tracks.set(index, current);
@@ -583,11 +578,11 @@ public class AnimationState {
 				tracks.set(trackIndex, current.mixingFrom);
 				queue.interrupt(current);
 				queue.end(current);
-				disposeNext(current);
+				clearNext(current);
 				current = current.mixingFrom;
 				interrupt = false; // mixingFrom is current again, but don't interrupt it twice.
 			} else
-				disposeNext(current);
+				clearNext(current);
 		}
 		TrackEntry entry = trackEntry(trackIndex, animation, loop, current);
 		setCurrent(trackIndex, entry, interrupt);
@@ -730,7 +725,8 @@ public class AnimationState {
 		return entry;
 	}
 
-	private void disposeNext (TrackEntry entry) {
+	/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
+	public void clearNext (TrackEntry entry) {
 		TrackEntry next = entry.next;
 		while (next != null) {
 			queue.dispose(next);

+ 5 - 9
spine-lua/spine-lua/AnimationState.lua

@@ -284,7 +284,7 @@ function AnimationState:update (delta)
 					if current.trackLast >= current.trackEnd and current.mixingFrom == nil then
 						tracks[i] = nil
 						queue:_end(current)
-						self:disposeNext(current)
+						self:clearNext(current)
 						skip = true
 					end
 				end
@@ -679,7 +679,7 @@ function AnimationState:clearTrack (trackIndex)
 
 	queue:_end(current)
 
-	self:disposeNext(current)
+	self:clearNext(current)
 
 	local entry = current
 	while (true) do
@@ -696,10 +696,6 @@ function AnimationState:clearTrack (trackIndex)
 	queue:drain()
 end
 
-function AnimationState:clearNext (entry)
-	self:disposeNext(entry.next)
-end
-
 function AnimationState:setCurrent (index, current, interrupt)
 	local from = self:expandToIndex(index)
 	self.tracks[index] = current
@@ -739,11 +735,11 @@ function AnimationState:setAnimation (trackIndex, animation, loop)
 			tracks[trackIndex] = current.mixingFrom
 			queue:interrupt(current)
 			queue:_end(current)
-			self:disposeNext(current)
+			self:clearNext(current)
 			current = current.mixingFrom
 			interrupt = false
 		else
-			self:disposeNext(current)
+			self:clearNext(current)
 		end
 	end
 	local entry = self:trackEntry(trackIndex, animation, loop, current)
@@ -860,7 +856,7 @@ function AnimationState:trackEntry (trackIndex, animation, loop, last)
 	return entry
 end
 
-function AnimationState:disposeNext (entry)
+function AnimationState:clearNext (entry)
 	local _next = entry.next
 	local queue = self.queue
 	while _next do

+ 6 - 10
spine-ts/core/src/AnimationState.ts

@@ -102,7 +102,7 @@ module spine {
 				} else if (current.trackLast >= current.trackEnd && !current.mixingFrom) {
 					tracks[i] = null;
 					this.queue.end(current);
-					this.disposeNext(current);
+					this.clearNext(current);
 					continue;
 				}
 				if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
@@ -460,7 +460,7 @@ module spine {
 
 			this.queue.end(current);
 
-			this.disposeNext(current);
+			this.clearNext(current);
 
 			let entry = current;
 			while (true) {
@@ -477,11 +477,6 @@ module spine {
 			this.queue.drain();
 		}
 
-		/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
-		clearNext(entry: TrackEntry) {
-			this.disposeNext(entry.next);
-		}
-
 		setCurrent (index: number, current: TrackEntry, interrupt: boolean) {
 			let from = this.expandToIndex(index);
 			this.tracks[index] = current;
@@ -528,11 +523,11 @@ module spine {
 					this.tracks[trackIndex] = current.mixingFrom;
 					this.queue.interrupt(current);
 					this.queue.end(current);
-					this.disposeNext(current);
+					this.clearNext(current);
 					current = current.mixingFrom;
 					interrupt = false;
 				} else
-					this.disposeNext(current);
+					this.clearNext(current);
 			}
 			let entry = this.trackEntry(trackIndex, animation, loop, current);
 			this.setCurrent(trackIndex, entry, interrupt);
@@ -673,7 +668,8 @@ module spine {
 			return entry;
 		}
 
-		disposeNext (entry: TrackEntry) {
+		/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
+		clearNext (entry: TrackEntry) {
 			let next = entry.next;
 			while (next) {
 				this.queue.dispose(next);