fix occasional broken frame at the moment node transition happened

This commit is contained in:
Serhii Yolkin 2015-11-21 17:33:00 +01:00
parent f6e4027ef1
commit 990eb6a8f0

View File

@ -102,7 +102,8 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
if (mode == MixMode.AlwaysMix) {
//always use Mix instead of Applying the first non-zero weighted clip
foreach (var info in clipInfo) {
for (int c = 0; c < clipInfo.Length; c++) {
var info = clipInfo[c];
float weight = info.weight * layerWeight;
if (weight == 0)
continue;
@ -111,7 +112,9 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
animationTable[GetAnimationClipNameHashCode(info.clip)].Mix(skeleton, Mathf.Max(0, time - deltaTime), time, stateInfo.loop, null, weight);
}
foreach (var info in nextClipInfo) {
if (nextStateInfo.fullPathHash != 0) {
for (int c = 0; c < nextClipInfo.Length; c++) {
var info = nextClipInfo[c];
float weight = info.weight * layerWeight;
if (weight == 0)
continue;
@ -119,6 +122,7 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
float time = nextStateInfo.normalizedTime * info.clip.length;
animationTable[GetAnimationClipNameHashCode(info.clip)].Mix(skeleton, Mathf.Max(0, time - deltaTime), time, nextStateInfo.loop, null, weight);
}
}
} else if (mode >= MixMode.MixNext) {
//apply first non-zero weighted clip
int c = 0;
@ -147,6 +151,7 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
c = 0;
if (nextStateInfo.fullPathHash != 0) {
//apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
if (mode == MixMode.SpineStyle) {
for (; c < nextClipInfo.Length; c++) {
@ -173,6 +178,7 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
}
}
}
}
if (_UpdateLocal != null)
_UpdateLocal(this);