From 05d8b248b080e73f3a97c5c6d28bec0c02f32f3d Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 29 May 2020 16:20:37 +0200 Subject: [PATCH] [unity] Fixed Mecanim state not updated when referenced clip's `Loop Time` changes. Also fixes Override controllers which never used the override clips' loop parameter but the original one. Closes #1649. --- .../spine-unity/Components/SkeletonMecanim.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs index 7a1cda017..bfc993b35 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs @@ -269,14 +269,14 @@ namespace Spine.Unity { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, info.clip.isLooping, stateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In); } if (hasNext) { for (int c = 0; c < nextClipInfoCount; c++) { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In); } } if (isInterruptionActive) { @@ -288,7 +288,7 @@ namespace Spine.Unity { var clip = GetAnimation(info.clip); if (clip != null) clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), - interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In); + info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In); } } } else { // case MixNext || Hard @@ -298,7 +298,7 @@ namespace Spine.Unity { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, info.clip.isLooping, stateInfo.speed < 0), info.clip.isLooping, null, 1f, layerBlendMode, MixDirection.In); ++c; break; } // Mix the rest @@ -306,7 +306,7 @@ namespace Spine.Unity { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, info.clip.isLooping, stateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In); } c = 0; @@ -317,7 +317,7 @@ namespace Spine.Unity { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), info.clip.isLooping, null, 1f, layerBlendMode, MixDirection.In); ++c; break; } } @@ -326,7 +326,7 @@ namespace Spine.Unity { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In); } } @@ -340,7 +340,7 @@ namespace Spine.Unity { float weight = clipWeight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), info.clip.isLooping, null, 1f, layerBlendMode, MixDirection.In); ++c; break; } } @@ -351,7 +351,7 @@ namespace Spine.Unity { float weight = clipWeight * layerWeight; if (weight == 0) continue; var clip = GetAnimation(info.clip); if (clip != null) - clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In); + clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), info.clip.isLooping, null, weight, layerBlendMode, MixDirection.In); } } }