ImporterContext.LoadAsync が UnityObjectManager を戻すようにインタフェースを変更

This commit is contained in:
ousttrue
2021-06-10 19:42:10 +09:00
parent aa6b826cb3
commit a17c789a02
27 changed files with 390 additions and 451 deletions

View File

@@ -97,16 +97,17 @@ namespace VRM.Samples
Debug.LogFormat("meta: title:{0}", meta.Title);
// ParseしたJSONをシーンオブジェクトに変換していく
var loaded = default(UnityObjectManager);
if (m_loadAsync)
{
await context.LoadAsync();
loaded = await context.LoadAsync();
}
else
{
context.Load();
loaded = context.Load();
}
OnLoaded(context);
OnLoaded(loaded);
}
}
@@ -135,15 +136,16 @@ namespace VRM.Samples
parser.ParseGlb(bytes);
var context = new VRMImporterContext(parser);
var loaded = default(UnityObjectManager);
if (m_loadAsync)
{
await context.LoadAsync();
loaded = await context.LoadAsync();
}
else
{
context.Load();
loaded = context.Load();
}
OnLoaded(context);
OnLoaded(loaded);
}
void LoadBVHClicked()
@@ -165,15 +167,14 @@ namespace VRM.Samples
#endif
}
void OnLoaded(VRMImporterContext context)
void OnLoaded(UnityObjectManager loaded)
{
var root = context.Root;
var root = loaded.gameObject;
root.transform.SetParent(transform, false);
//メッシュを表示します
context.ShowMeshes();
context.DisposeOnGameObjectDestroyed();
loaded.ShowMeshes();
// add motion
var humanPoseTransfer = root.AddComponent<UniHumanoid.HumanPoseTransfer>();