rename RuntimeGltfInstance

This commit is contained in:
ousttrue 2021-06-11 17:16:47 +09:00
parent 423889cb05
commit 89276c2783
6 changed files with 15 additions and 14 deletions

View File

@ -61,7 +61,7 @@ namespace UniGLTF
};
#region Load. Build unity objects
public virtual async Task<UnityObjectManager> LoadAsync(IAwaitCaller awaitCaller = null, Func<string, IDisposable> MeasureTime = null)
public virtual async Task<RuntimeGltfInstance> LoadAsync(IAwaitCaller awaitCaller = null, Func<string, IDisposable> MeasureTime = null)
{
if (awaitCaller == null)
{
@ -109,7 +109,7 @@ namespace UniGLTF
await OnLoadHierarchy(awaitCaller, MeasureTime);
return UnityObjectManager.AttachTo(Root, this);
return RuntimeGltfInstance.AttachTo(Root, this);
}
/// <summary>

View File

@ -8,7 +8,7 @@ namespace UniGLTF
/// <summary>
/// Build unity objects from parsed gltf
/// </summary>
public static UnityObjectManager Load(this ImporterContext self)
public static RuntimeGltfInstance Load(this ImporterContext self)
{
var meassureTime = new ImporterContextSpeedLog();
var task = self.LoadAsync(default(ImmediateCaller), meassureTime.MeasureTime);

View File

@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using VRMShaders;
namespace UniGLTF
{
/// <summary>
/// Mesh, Material, Texture などを抱えておいて確実に破棄できるようにする
/// ImporterContext の Load 結果の GltfModel
///
/// Runtime でモデルを Destory したときに関連リソース(Texture, Material...などの UnityEngine.Object)を自動的に Destroy する。
/// </summary>
public class UnityObjectManager : MonoBehaviour, IResponsibilityForDestroyObjects
public class RuntimeGltfInstance : MonoBehaviour, IResponsibilityForDestroyObjects
{
/// <summary>
/// this is UniGLTF root gameObject
@ -17,9 +18,9 @@ namespace UniGLTF
List<(SubAssetKey, UnityEngine.Object)> m_resources = new List<(SubAssetKey, UnityEngine.Object)>();
public static UnityObjectManager AttachTo(GameObject go, ImporterContext context)
public static RuntimeGltfInstance AttachTo(GameObject go, ImporterContext context)
{
var loaded = go.AddComponent<UnityObjectManager>();
var loaded = go.AddComponent<RuntimeGltfInstance>();
context.TransferOwnership((k, o) =>
{
loaded.m_resources.Add((k, o));

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a396b6305c6ed494bad94f21d359e774
guid: 423fb0cccbe420047ac28163cce68db4
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -97,7 +97,7 @@ namespace VRM.Samples
Debug.LogFormat("meta: title:{0}", meta.Title);
// ParseしたJSONをシーンオブジェクトに変換していく
var loaded = default(UnityObjectManager);
var loaded = default(RuntimeGltfInstance);
if (m_loadAsync)
{
loaded = await context.LoadAsync();
@ -136,7 +136,7 @@ namespace VRM.Samples
parser.ParseGlb(bytes);
var context = new VRMImporterContext(parser);
var loaded = default(UnityObjectManager);
var loaded = default(RuntimeGltfInstance);
if (m_loadAsync)
{
loaded = await context.LoadAsync();
@ -167,7 +167,7 @@ namespace VRM.Samples
#endif
}
void OnLoaded(UnityObjectManager loaded)
void OnLoaded(RuntimeGltfInstance loaded)
{
var root = loaded.gameObject;

View File

@ -129,7 +129,7 @@ namespace VRM
}
}
public void SaveAsAsset(UniGLTF.UnityObjectManager loaded)
public void SaveAsAsset(UniGLTF.RuntimeGltfInstance loaded)
{
loaded.ShowMeshes();