added frame dispersion to animationImporterUtil

This commit is contained in:
T-Kuhn 2022-11-21 16:59:20 +09:00
parent 3fc8d074ed
commit 66716a84b0
2 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,9 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using VRMShaders;
namespace UniGLTF
{
@ -185,7 +187,7 @@ namespace UniGLTF
return string.Join("/", path);
}
public static AnimationClip ConvertAnimationClip(GltfData data, glTFAnimation animation, IAxisInverter inverter, glTFNode root = null)
public static async Task<AnimationClip> ConvertAnimationClip(GltfData data, glTFAnimation animation, IAxisInverter inverter, IAwaitCaller awaitCaller, glTFNode root = null)
{
var clip = new AnimationClip();
clip.ClearCurves();
@ -309,6 +311,7 @@ namespace UniGLTF
Debug.LogWarningFormat("unknown path: {0}", channel.target.path);
break;
}
await awaitCaller.NextFrameIfTimedOut();
}
return clip;
}

View File

@ -136,10 +136,7 @@ namespace UniGLTF
foreach (var (key, gltfAnimation) in Enumerable.Zip(AnimationImporterUtil.EnumerateSubAssetKeys(GLTF), GLTF.animations, (x, y) => (x, y)))
{
await AnimationClipFactory.LoadAnimationClipAsync(key, () =>
{
var clip = AnimationImporterUtil.ConvertAnimationClip(Data, gltfAnimation, InvertAxis.Create());
return Task.FromResult(clip);
});
AnimationImporterUtil.ConvertAnimationClip(Data, gltfAnimation, InvertAxis.Create(), awaitCaller));
}
await awaitCaller.NextFrame();