実は gltf の入った zip も読める

This commit is contained in:
ousttrue
2021-01-12 17:19:59 +09:00
parent a0003f2dc2
commit 845b0b71ec

View File

@@ -264,7 +264,7 @@ namespace VRM.Samples
void OnOpenClicked()
{
#if UNITY_STANDALONE_WIN
var path = FileDialogForWindows.FileDialog("open VRM", "vrm", "glb", "bvh");
var path = FileDialogForWindows.FileDialog("open VRM", "vrm", "glb", "bvh", "gltf", "zip");
#elif UNITY_EDITOR
var path = UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm");
#else
@@ -281,6 +281,7 @@ namespace VRM.Samples
case ".gltf":
case ".glb":
case ".vrm":
case ".zip":
LoadModel(path);
break;
@@ -328,6 +329,19 @@ namespace VRM.Samples
break;
}
case ".gltf":
case ".zip":
{
var context = new UniGLTF.ImporterContext();
context.Parse(path);
context.Load();
context.ShowMeshes();
context.EnableUpdateWhenOffscreen();
context.ShowMeshes();
SetModel(context.Root);
break;
}
default:
Debug.LogWarningFormat("unknown file type: {0}", path);
break;