mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-13 05:06:06 -05:00
TextureItem to MaterialFactory.GetTextureAsync
This commit is contained in:
@@ -29,7 +29,7 @@ namespace VRM.Samples
|
||||
|
||||
#region Load
|
||||
|
||||
void OnLoadClicked()
|
||||
async void OnLoadClicked()
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN
|
||||
var path = FileDialogForWindows.FileDialog("open VRM", ".vrm");
|
||||
@@ -53,7 +53,7 @@ namespace VRM.Samples
|
||||
|
||||
|
||||
// metaを取得(todo: thumbnailテクスチャのロード)
|
||||
var meta = context.ReadMeta();
|
||||
var meta = await context.ReadMetaAsync();
|
||||
Debug.LogFormat("meta: title:{0}", meta.Title);
|
||||
|
||||
// ParseしたJSONをシーンオブジェクトに変換していく
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace VRM.Samples
|
||||
m_canvas.LoadBVHButton.onClick.AddListener(LoadBVHClicked);
|
||||
}
|
||||
|
||||
void LoadVRMClicked()
|
||||
async void LoadVRMClicked()
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN
|
||||
var path = FileDialogForWindows.FileDialog("open VRM", ".vrm");
|
||||
@@ -94,7 +94,7 @@ namespace VRM.Samples
|
||||
|
||||
|
||||
// metaを取得(todo: thumbnailテクスチャのロード)
|
||||
var meta = context.ReadMeta();
|
||||
var meta = await context.ReadMetaAsync();
|
||||
Debug.LogFormat("meta: title:{0}", meta.Title);
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UniHumanoid;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -83,9 +84,9 @@ namespace VRM.Samples
|
||||
m_textDistributionOther.text = "";
|
||||
}
|
||||
|
||||
public void UpdateMeta(VRMImporterContext context)
|
||||
public async Task UpdateMetaAsync(VRMImporterContext context)
|
||||
{
|
||||
var meta = context.ReadMeta(true);
|
||||
var meta = await context.ReadMetaAsync(true);
|
||||
|
||||
m_textModelTitle.text = meta.Title;
|
||||
m_textModelVersion.text = meta.Version;
|
||||
@@ -211,7 +212,7 @@ namespace VRM.Samples
|
||||
string[] cmds = System.Environment.GetCommandLineArgs();
|
||||
if (cmds.Length > 1)
|
||||
{
|
||||
LoadModel(cmds[1]);
|
||||
LoadModelAsync(cmds[1]);
|
||||
}
|
||||
|
||||
m_texts.Start();
|
||||
@@ -282,7 +283,7 @@ namespace VRM.Samples
|
||||
case ".glb":
|
||||
case ".vrm":
|
||||
case ".zip":
|
||||
LoadModel(path);
|
||||
LoadModelAsync(path);
|
||||
break;
|
||||
|
||||
case ".bvh":
|
||||
@@ -291,7 +292,7 @@ namespace VRM.Samples
|
||||
}
|
||||
}
|
||||
|
||||
void LoadModel(string path)
|
||||
async void LoadModelAsync(string path)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
@@ -307,7 +308,7 @@ namespace VRM.Samples
|
||||
var context = new VRMImporterContext();
|
||||
var file = File.ReadAllBytes(path);
|
||||
context.ParseGlb(file);
|
||||
m_texts.UpdateMeta(context);
|
||||
await m_texts.UpdateMetaAsync(context);
|
||||
context.Load();
|
||||
context.ShowMeshes();
|
||||
context.EnableUpdateWhenOffscreen();
|
||||
|
||||
Reference in New Issue
Block a user