Merge pull request #1782 from ousttrue/fix/SimpleViewer_null

add LoadPathAsync
This commit is contained in:
ousttrue 2022-09-08 18:58:04 +09:00 committed by GitHub
commit faa1dcf62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -327,7 +327,7 @@ namespace VRM.SimpleViewer
string[] cmds = System.Environment.GetCommandLineArgs();
if (cmds.Length > 1)
{
LoadModelAsync(cmds[1]);
LoadPathAsync(cmds[1]);
}
m_texts.Start();
@ -391,10 +391,20 @@ namespace VRM.SimpleViewer
return;
}
LoadModelAsync(path);
LoadPathAsync(path);
}
async void LoadModelAsync(string path, byte[] bytes = null)
async void LoadPathAsync(string path)
{
if (!File.Exists(path))
{
Debug.LogWarning($"{path} not exists");
return;
}
LoadModelAsync(path, File.ReadAllBytes(path));
}
async void LoadModelAsync(string path, byte[] bytes)
{
var size = bytes != null ? bytes.Length : 0;
Debug.Log($"LoadModelAsync: {path}: {size}bytes");