[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.

This commit is contained in:
Harald Csaszar 2020-05-29 16:20:37 +02:00
parent bc559625f2
commit 05d8b248b0

View File

@ -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);
}
}
}