mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 10:46:53 +08:00
[unity] Fixed SkeletonMecanim throwing exception at non-Spine clip. Closes #1675.
This commit is contained in:
parent
3e93e2daf1
commit
b1e4c8f2b7
@ -213,14 +213,18 @@ namespace Spine.Unity {
|
|||||||
for (int c = 0; c < clipInfoCount; c++) {
|
for (int c = 0; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c];
|
var info = clipInfo[c];
|
||||||
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
previousAnimations.Add(GetAnimation(info.clip));
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
previousAnimations.Add(clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
for (int c = 0; c < nextClipInfoCount; c++) {
|
for (int c = 0; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c];
|
var info = nextClipInfo[c];
|
||||||
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
previousAnimations.Add(GetAnimation(info.clip));
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
previousAnimations.Add(clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +234,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
previousAnimations.Add(GetAnimation(info.clip));
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
previousAnimations.Add(clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,12 +267,16 @@ namespace Spine.Unity {
|
|||||||
// Always use Mix instead of Applying the first non-zero weighted clip.
|
// Always use Mix instead of Applying the first non-zero weighted clip.
|
||||||
for (int c = 0; c < clipInfoCount; c++) {
|
for (int c = 0; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
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);
|
||||||
}
|
}
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
for (int c = 0; c < nextClipInfoCount; c++) {
|
for (int c = 0; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isInterruptionActive) {
|
if (isInterruptionActive) {
|
||||||
@ -275,7 +285,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0),
|
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);
|
interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,13 +296,17 @@ namespace Spine.Unity {
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
for (; c < clipInfoCount; c++) {
|
for (; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
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);
|
||||||
++c; break;
|
++c; break;
|
||||||
}
|
}
|
||||||
// Mix the rest
|
// Mix the rest
|
||||||
for (; c < clipInfoCount; c++) {
|
for (; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
@ -299,14 +315,18 @@ namespace Spine.Unity {
|
|||||||
if (mode == MixMode.Hard) {
|
if (mode == MixMode.Hard) {
|
||||||
for (; c < nextClipInfoCount; c++) {
|
for (; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
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);
|
||||||
++c; break;
|
++c; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Mix the rest
|
// Mix the rest
|
||||||
for (; c < nextClipInfoCount; c++) {
|
for (; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +338,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
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);
|
||||||
++c; break;
|
++c; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,7 +349,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user