UnityObjectManager から ScriptedImporter に移譲する

This commit is contained in:
ousttrue 2021-06-10 19:53:48 +09:00
parent a17c789a02
commit e9d4654678
4 changed files with 10 additions and 8 deletions

View File

@ -51,7 +51,7 @@ namespace UniGLTF
var loaded = loader.Load();
loaded.ShowMeshes();
loader.TransferOwnership((k, o) =>
loaded.TransferOwnership((k, o) =>
{
context.AddObjectToAsset(k.Name, o);
return true;

View File

@ -313,8 +313,7 @@ namespace UniGLTF
{
foreach (var mesh in Meshes.ToArray())
{
// mesh の extract は実装していないので SubAssetKey を使わない
if (take(default, mesh.Mesh))
if (take(SubAssetKey.Create(mesh.Mesh), mesh.Mesh))
{
Meshes.Remove(mesh);
}

View File

@ -47,16 +47,19 @@ namespace UniGLTF
public void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take)
{
throw new NotImplementedException();
foreach (var (key, x) in m_resources.ToArray())
{
if (take(key, x))
{
m_resources.Remove((key, x));
}
}
}
public void Dispose()
{
foreach (var (key, x) in m_resources)
{
#if VRM_DEVELOP
// Debug.Log($"Destroy: {x}");
#endif
UnityObjectDestoyer.DestroyRuntimeOrEditor(x);
}
}

View File

@ -45,7 +45,7 @@ namespace UniVRM10
var loaded = loader.Load();
loaded.ShowMeshes();
loader.TransferOwnership((key, o) =>
loaded.TransferOwnership((key, o) =>
{
context.AddObjectToAsset(key.Name, o);
return true;