mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-27 21:18:00 -05:00
rename RuntimeGltfInstance
This commit is contained in:
parent
423889cb05
commit
89276c2783
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a396b6305c6ed494bad94f21d359e774
|
||||
guid: 423fb0cccbe420047ac28163cce68db4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace VRM
|
|||
}
|
||||
}
|
||||
|
||||
public void SaveAsAsset(UniGLTF.UnityObjectManager loaded)
|
||||
public void SaveAsAsset(UniGLTF.RuntimeGltfInstance loaded)
|
||||
{
|
||||
loaded.ShowMeshes();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user