From c1353efdd36bf784d63caf97132781a65f2a8fae Mon Sep 17 00:00:00 2001 From: John Date: Tue, 29 Nov 2016 01:42:02 +0800 Subject: [PATCH] [csharp] Better rotation direction reset. Based on https://github.com/EsotericSoftware/spine-runtimes/commit/6af978871bb6a339b767ee87e493c5927f40ea19 --- spine-csharp/src/AnimationState.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index c05067502..210c19d74 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -136,7 +136,7 @@ namespace Spine { from.trackTime += delta * from.timeScale; entry.mixTime += delta * entry.timeScale; } - + /// /// Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the @@ -242,6 +242,9 @@ namespace Spine { static private void ApplyRotateTimeline (RotateTimeline rotateTimeline, Skeleton skeleton, float time, float alpha, bool setupPose, float[] timelinesRotation, int i, bool firstFrame) { + + if (firstFrame) timelinesRotation[i] = 0; + if (alpha == 1) { rotateTimeline.Apply(skeleton, 0, time, null, 1, setupPose, false); return; @@ -275,11 +278,7 @@ namespace Spine { float r1 = setupPose ? bone.data.rotation : bone.rotation; float total, diff = r2 - r1; if (diff == 0) { - if (firstFrame) { - timelinesRotation[i] = 0; - total = 0; - } else - total = timelinesRotation[i]; + total = timelinesRotation[i]; } else { diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360; float lastTotal, lastDiff; @@ -505,7 +504,7 @@ namespace Spine { entry.trackEnd = mixDuration; return entry; } - + /// /// Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration. public void SetEmptyAnimations (float mixDuration) {