Jelajahi Sumber

[ts] Fix for rotation timelines in AnimationState

badlogic 8 tahun lalu
induk
melakukan
3c254deb31

+ 4 - 6
spine-ts/build/spine-all.js

@@ -1447,6 +1447,8 @@ var spine;
 			return mix;
 		};
 		AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
+			if (firstFrame)
+				timelinesRotation[i] = 0;
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -1475,12 +1477,7 @@ var spine;
 			var r1 = setupPose ? bone.data.rotation : bone.rotation;
 			var total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				}
-				else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			}
 			else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@@ -1570,6 +1567,7 @@ var spine;
 					this.queue.interrupt(from);
 				current.mixingFrom = from;
 				current.mixTime = 0;
+				from.timelinesRotation.length = 0;
 				if (from.mixingFrom != null)
 					current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

File diff ditekan karena terlalu besar
+ 0 - 0
spine-ts/build/spine-all.js.map


+ 4 - 6
spine-ts/build/spine-canvas.js

@@ -1447,6 +1447,8 @@ var spine;
 			return mix;
 		};
 		AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
+			if (firstFrame)
+				timelinesRotation[i] = 0;
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -1475,12 +1477,7 @@ var spine;
 			var r1 = setupPose ? bone.data.rotation : bone.rotation;
 			var total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				}
-				else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			}
 			else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@@ -1570,6 +1567,7 @@ var spine;
 					this.queue.interrupt(from);
 				current.mixingFrom = from;
 				current.mixTime = 0;
+				from.timelinesRotation.length = 0;
 				if (from.mixingFrom != null)
 					current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

File diff ditekan karena terlalu besar
+ 0 - 0
spine-ts/build/spine-canvas.js.map


+ 4 - 6
spine-ts/build/spine-core.js

@@ -1100,6 +1100,8 @@ var spine;
 			return mix;
 		};
 		AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
+			if (firstFrame)
+				timelinesRotation[i] = 0;
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -1128,12 +1130,7 @@ var spine;
 			var r1 = setupPose ? bone.data.rotation : bone.rotation;
 			var total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				}
-				else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			}
 			else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@@ -1223,6 +1220,7 @@ var spine;
 					this.queue.interrupt(from);
 				current.mixingFrom = from;
 				current.mixTime = 0;
+				from.timelinesRotation.length = 0;
 				if (from.mixingFrom != null)
 					current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

File diff ditekan karena terlalu besar
+ 0 - 0
spine-ts/build/spine-core.js.map


+ 4 - 6
spine-ts/build/spine-threejs.js

@@ -1100,6 +1100,8 @@ var spine;
 			return mix;
 		};
 		AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
+			if (firstFrame)
+				timelinesRotation[i] = 0;
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -1128,12 +1130,7 @@ var spine;
 			var r1 = setupPose ? bone.data.rotation : bone.rotation;
 			var total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				}
-				else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			}
 			else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@@ -1223,6 +1220,7 @@ var spine;
 					this.queue.interrupt(from);
 				current.mixingFrom = from;
 				current.mixTime = 0;
+				from.timelinesRotation.length = 0;
 				if (from.mixingFrom != null)
 					current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

File diff ditekan karena terlalu besar
+ 0 - 0
spine-ts/build/spine-threejs.js.map


+ 4 - 6
spine-ts/build/spine-webgl.js

@@ -1100,6 +1100,8 @@ var spine;
 			return mix;
 		};
 		AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
+			if (firstFrame)
+				timelinesRotation[i] = 0;
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -1128,12 +1130,7 @@ var spine;
 			var r1 = setupPose ? bone.data.rotation : bone.rotation;
 			var total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				}
-				else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			}
 			else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@@ -1223,6 +1220,7 @@ var spine;
 					this.queue.interrupt(from);
 				current.mixingFrom = from;
 				current.mixTime = 0;
+				from.timelinesRotation.length = 0;
 				if (from.mixingFrom != null)
 					current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

File diff ditekan karena terlalu besar
+ 0 - 0
spine-ts/build/spine-webgl.js.map


+ 4 - 6
spine-ts/build/spine-widget.js

@@ -1100,6 +1100,8 @@ var spine;
 			return mix;
 		};
 		AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
+			if (firstFrame)
+				timelinesRotation[i] = 0;
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -1128,12 +1130,7 @@ var spine;
 			var r1 = setupPose ? bone.data.rotation : bone.rotation;
 			var total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				}
-				else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			}
 			else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@@ -1223,6 +1220,7 @@ var spine;
 					this.queue.interrupt(from);
 				current.mixingFrom = from;
 				current.mixTime = 0;
+				from.timelinesRotation.length = 0;
 				if (from.mixingFrom != null)
 					current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

File diff ditekan karena terlalu besar
+ 0 - 0
spine-ts/build/spine-widget.js.map


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

@@ -80,8 +80,8 @@ module spine {
 							next = next.mixingFrom;
 						}
 						continue;
-					}					
-				} else {					
+					}
+				} else {
 					// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
 					if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
 						tracks[i] = null;
@@ -111,9 +111,9 @@ module spine {
 			}
 
 			from.animationLast = from.nextAnimationLast;
-			from.trackLast = from.nextTrackLast;			
+			from.trackLast = from.nextTrackLast;
 			from.trackTime += delta * from.timeScale;
-			entry.mixTime += delta * from.timeScale;			
+			entry.mixTime += delta * from.timeScale;
 		}
 
 		apply (skeleton: Skeleton) {
@@ -129,7 +129,7 @@ module spine {
 
 				// Apply mixing from entries first.
 				let mix = current.alpha;
-				if (current.mixingFrom != null) 
+				if (current.mixingFrom != null)
 					mix *= this.applyMixingFrom(current, skeleton);
 				else if (current.trackTime >= current.trackEnd)
 					mix = 0;
@@ -211,6 +211,9 @@ module spine {
 
 		applyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean,
 			timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
+
+			if (firstFrame) timelinesRotation[i] = 0;
+
 			if (alpha == 1) {
 				timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
 				return;
@@ -245,11 +248,7 @@ module spine {
 			let r1 = setupPose ? bone.data.rotation : bone.rotation;
 			let total = 0, diff = r2 - r1;
 			if (diff == 0) {
-				if (firstFrame) {
-					timelinesRotation[i] = 0;
-					total = 0;
-				} else
-					total = timelinesRotation[i];
+				total = timelinesRotation[i];
 			} else {
 				diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
 				let lastTotal = 0, lastDiff = 0;
@@ -347,6 +346,8 @@ module spine {
 				current.mixingFrom = from;
 				current.mixTime = 0;
 
+				from.timelinesRotation.length = 0;
+
 				// If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
 				if (from.mixingFrom != null) current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
 			}

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini