Эх сурвалжийг харах

[unity] Fixed Timeline preview speed-scale applied twice in Unity 2019 and newer versions. Closes #2312.

Harald Csaszar 2 жил өмнө
parent
commit
ccc41337f6

+ 17 - 1
spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs

@@ -27,6 +27,10 @@
  * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *****************************************************************************/
 
+#if UNITY_2019_1_OR_NEWER
+#define SPEED_INCLUDED_IN_CLIP_TIME
+#endif
+
 #define SPINE_EDITMODEPOSE
 
 using System;
@@ -212,7 +216,11 @@ namespace Spine.Unity.Playables {
 						float clipSpeed = (float)clipPlayable.GetSpeed();
 						trackEntry.EventThreshold = clipData.eventThreshold;
 						trackEntry.DrawOrderThreshold = clipData.drawOrderThreshold;
-						trackEntry.TrackTime = (float)clipPlayable.GetTime() * clipSpeed * rootPlayableSpeed;
+#if SPEED_INCLUDED_IN_CLIP_TIME
+						trackEntry.TrackTime = (float)clipPlayable.GetTime();
+#else
+						trackEntry.TrackTime = (float)clipPlayable.GetTime() * rootPlayableSpeed * clipSpeed;
+#endif
 						trackEntry.TimeScale = clipSpeed * rootPlayableSpeed;
 						trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
 						trackEntry.HoldPrevious = clipData.holdPrevious;
@@ -283,12 +291,20 @@ namespace Spine.Unity.Playables {
 					var fromClip = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(lastNonZeroWeightTrack - 1);
 					SpineAnimationStateBehaviour fromClipData = fromClip.GetBehaviour();
 					fromAnimation = fromClipData.animationReference != null ? fromClipData.animationReference.Animation : null;
+#if SPEED_INCLUDED_IN_CLIP_TIME
+					fromClipTime = (float)fromClip.GetTime();
+#else
 					fromClipTime = (float)fromClip.GetTime() * (float)fromClip.GetSpeed() * rootSpeed;
+#endif
 					fromClipLoop = fromClipData.loop;
 				}
 
 				Animation toAnimation = clipData.animationReference != null ? clipData.animationReference.Animation : null;
+#if SPEED_INCLUDED_IN_CLIP_TIME
+				float toClipTime = (float)inputPlayableClip.GetTime();
+#else
 				float toClipTime = (float)inputPlayableClip.GetTime() * (float)inputPlayableClip.GetSpeed() * rootSpeed;
+#endif
 				float mixDuration = clipData.mixDuration;
 
 				if (!clipData.customDuration && fromAnimation != null && toAnimation != null) {

+ 1 - 1
spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json

@@ -2,7 +2,7 @@
 	"name": "com.esotericsoftware.spine.timeline",
 	"displayName": "Spine Timeline Extensions",
 	"description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity and spine-csharp runtimes as UPM packages (not as spine-unity unitypackage), version 4.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
-	"version": "4.1.8",
+	"version": "4.1.9",
 	"unity": "2018.3",
 	"author": {
 		"name": "Esoteric Software",