mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[unity] Cleanup SkeletonAnimator Update.
This commit is contained in:
parent
d83361e8f0
commit
251ca5d03e
@ -92,29 +92,21 @@ namespace Spine.Unity {
|
||||
//skeleton.Update(Time.deltaTime); // Doesn't actually do anything, currently. (Spine 3.5).
|
||||
|
||||
// Clear Previous
|
||||
if (autoReset)
|
||||
{
|
||||
if (autoReset) {
|
||||
var previousAnimations = this.previousAnimations;
|
||||
for (int i = 0, n = previousAnimations.Count; i < n; i++) {
|
||||
for (int i = 0, n = previousAnimations.Count; i < n; i++)
|
||||
previousAnimations[i].SetKeyedItemsToSetupPose(skeleton);
|
||||
}
|
||||
previousAnimations.Clear();
|
||||
|
||||
previousAnimations.Clear();
|
||||
for (int layer = 0, n = animator.layerCount; layer < n; layer++) {
|
||||
float layerWeight = (layer == 0) ? 1 : animator.GetLayerWeight(layer);
|
||||
float layerWeight = (layer == 0) ? 1 : animator.GetLayerWeight(layer); // Animator.GetLayerWeight always returns 0 on the first layer. Should be interpreted as 1.
|
||||
if (layerWeight <= 0) continue;
|
||||
|
||||
AnimatorStateInfo nextStateInfo = animator.GetNextAnimatorStateInfo(layer);
|
||||
|
||||
#if UNITY_5
|
||||
bool hasNext = nextStateInfo.fullPathHash != 0;
|
||||
AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(layer);
|
||||
AnimatorClipInfo[] nextClipInfo = animator.GetNextAnimatorClipInfo(layer);
|
||||
#else
|
||||
bool hasNext = nextStateInfo.nameHash != 0;
|
||||
var clipInfo = animator.GetCurrentAnimationClipState(i);
|
||||
var nextClipInfo = animator.GetNextAnimationClipState(i);
|
||||
#endif
|
||||
|
||||
for (int c = 0; c < clipInfo.Length; c++) {
|
||||
var info = clipInfo[c];
|
||||
@ -131,22 +123,19 @@ namespace Spine.Unity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Apply
|
||||
for (int layer = 0, n = animator.layerCount; layer < n; layer++) {
|
||||
float layerWeight = (layer == 0) ? 1 : animator.GetLayerWeight(layer);
|
||||
float layerWeight = (layer == 0) ? 1 : animator.GetLayerWeight(layer); // Animator.GetLayerWeight always returns 0 on the first layer. Should be interpreted as 1.
|
||||
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(layer);
|
||||
AnimatorStateInfo nextStateInfo = animator.GetNextAnimatorStateInfo(layer);
|
||||
|
||||
#if UNITY_5
|
||||
bool hasNext = nextStateInfo.fullPathHash != 0;
|
||||
AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(layer);
|
||||
AnimatorClipInfo[] nextClipInfo = animator.GetNextAnimatorClipInfo(layer);
|
||||
#else
|
||||
bool hasNext = nextStateInfo.nameHash != 0;
|
||||
var clipInfo = animator.GetCurrentAnimationClipState(i);
|
||||
var nextClipInfo = animator.GetNextAnimationClipState(i);
|
||||
#endif
|
||||
// UNITY 4
|
||||
// bool hasNext = nextStateInfo.nameHash != 0;
|
||||
// var clipInfo = animator.GetCurrentAnimationClipState(i);
|
||||
// var nextClipInfo = animator.GetNextAnimationClipState(i);
|
||||
|
||||
MixMode mode = layerMixModes[layer];
|
||||
if (mode == MixMode.AlwaysMix) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user