mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-12 13:59:21 -05:00
IAnimationImporter を廃止し、 virtual async Task ImporterContext.LoadAnimationAsync を追加する
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using VRMShaders;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public interface IAnimationImporter
|
||||
{
|
||||
AnimationClip Import(glTF gltf, int i, Axes invertAxis);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f950ba9271cbff4cbc4345f5a23a5d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public sealed class RootAnimationImporter : IAnimationImporter
|
||||
{
|
||||
public AnimationClip Import(glTF gltf, int i, Axes invertAxis)
|
||||
{
|
||||
return AnimationImporterUtil.ConvertAnimationClip(gltf, gltf.animations[i], invertAxis.Create());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27640e6274339664ea492827be5a2217
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,26 +12,6 @@ namespace UniGLTF
|
||||
/// </summary>
|
||||
public class ImporterContext : IDisposable
|
||||
{
|
||||
#region Animation
|
||||
protected IAnimationImporter m_animationImporter;
|
||||
public void SetAnimationImporter(IAnimationImporter animationImporter)
|
||||
{
|
||||
m_animationImporter = animationImporter;
|
||||
}
|
||||
public IAnimationImporter AnimationImporter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_animationImporter == null)
|
||||
{
|
||||
m_animationImporter = new RootAnimationImporter();
|
||||
}
|
||||
return m_animationImporter;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ITextureDescriptorGenerator TextureDescriptorGenerator { get; protected set; }
|
||||
public IMaterialDescriptorGenerator MaterialDescriptorGenerator { get; protected set; }
|
||||
public TextureFactory TextureFactory { get; }
|
||||
@@ -121,6 +101,13 @@ namespace UniGLTF
|
||||
|
||||
await LoadGeometryAsync(awaitCaller, MeasureTime);
|
||||
|
||||
await LoadAnimationAsync(awaitCaller, MeasureTime);
|
||||
|
||||
await OnLoadHierarchy(awaitCaller, MeasureTime);
|
||||
}
|
||||
|
||||
protected virtual async Task LoadAnimationAsync(IAwaitCaller awaitCaller, Func<string, IDisposable> MeasureTime)
|
||||
{
|
||||
using (MeasureTime("AnimationImporter"))
|
||||
{
|
||||
if (GLTF.animations != null && GLTF.animations.Any())
|
||||
@@ -136,7 +123,7 @@ namespace UniGLTF
|
||||
}
|
||||
else
|
||||
{
|
||||
clip = AnimationImporter.Import(GLTF, i, InvertAxis);
|
||||
clip = AnimationImporterUtil.ConvertAnimationClip(GLTF, GLTF.animations[i], InvertAxis.Create());
|
||||
AnimationClips.Add(clip);
|
||||
}
|
||||
|
||||
@@ -146,10 +133,10 @@ namespace UniGLTF
|
||||
animation.clip = clip;
|
||||
}
|
||||
}
|
||||
|
||||
await awaitCaller.NextFrame();
|
||||
}
|
||||
}
|
||||
|
||||
await OnLoadHierarchy(awaitCaller, MeasureTime);
|
||||
}
|
||||
|
||||
protected virtual async Task LoadGeometryAsync(IAwaitCaller awaitCaller, Func<string, IDisposable> MeasureTime)
|
||||
|
||||
Reference in New Issue
Block a user