Skip to content

Commit

Permalink
Merge pull request #1773 from ousttrue/version/v0_103_0
Browse files Browse the repository at this point in the history
UniVRM-0.103.0
  • Loading branch information
ousttrue authored Sep 8, 2022
2 parents beb0f79 + 09363b7 commit b3a0cb3
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 390 deletions.
6 changes: 3 additions & 3 deletions Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace UniGLTF
public static partial class UniGLTFVersion
{
public const int MAJOR = 2;
public const int MINOR = 38;
public const int PATCH = 1;
public const string VERSION = "2.38.1";
public const int MINOR = 39;
public const int PATCH = 0;
public const string VERSION = "2.39.0";
}
}
4 changes: 2 additions & 2 deletions Assets/UniGLTF/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.vrmc.gltf",
"version": "0.102.1",
"version": "0.103.0",
"displayName": "UniGLTF",
"description": "GLTF importer and exporter",
"unity": "2019.4",
Expand All @@ -11,7 +11,7 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.102.1",
"com.vrmc.vrmshaders": "0.103.0",
"com.unity.modules.animation": "1.0.0"
}
}
6 changes: 3 additions & 3 deletions Assets/VRM/Runtime/Format/VRMVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace VRM
public static partial class VRMVersion
{
public const int MAJOR = 0;
public const int MINOR = 102;
public const int PATCH = 1;
public const string VERSION = "0.102.1";
public const int MINOR = 103;
public const int PATCH = 0;
public const string VERSION = "0.103.0";
}
}
2 changes: 1 addition & 1 deletion Assets/VRM/Samples~/BlendShapeMenu/BlendShapeMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static void AddARKitFaceTrackingBlendShapes(MenuCommand command)
var sb = new StringBuilder();
foreach (var name in NAMES)
{
if (avatar.Clips.Find(x => x.Preset == BlendShapePreset.Unknown && x.BlendShapeName == name))
if (avatar.Clips.Find(x => x != null && x.Preset == BlendShapePreset.Unknown && x.BlendShapeName == name))
{
// already exists
continue;
Expand Down
41 changes: 36 additions & 5 deletions Assets/VRM/Samples~/SimpleViewer/ViewerUI.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using UniGLTF;
using UniHumanoid;
Expand All @@ -11,10 +13,13 @@

namespace VRM.SimpleViewer
{


public class ViewerUI : MonoBehaviour
{
#if UNITY_WEBGL
[DllImport("__Internal")]
private static extern void WebGLFileDialog();
#endif

#region UI
[SerializeField]
Text m_version = default;
Expand Down Expand Up @@ -353,10 +358,29 @@ private void Update()
}
}

IEnumerator LoadTexture(string url)
{
var www = new WWW(url);
yield return www;
LoadModelAsync("tmp.vrm", www.bytes);
}

public void FileSelected(string url)
{
Debug.Log($"FileSelected: {url}");
StartCoroutine(LoadTexture(url));
}

void OnOpenClicked()
{
#if UNITY_STANDALONE_WIN
var path = FileDialogForWindows.FileDialog("open VRM", "vrm", "glb", "bvh", "gltf", "zip");
#elif UNITY_WEBGL
{
WebGLFileDialog();
return;
}
var path = "";
#elif UNITY_EDITOR
var path = UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm");
#else
Expand All @@ -370,16 +394,19 @@ void OnOpenClicked()
LoadModelAsync(path);
}

async void LoadModelAsync(string path)
async void LoadModelAsync(string path, byte[] bytes = null)
{
var size = bytes != null ? bytes.Length : 0;
Debug.Log($"LoadModelAsync: {path}: {size}bytes");

var ext = Path.GetExtension(path).ToLower();
switch (ext)
{
case ".gltf":
case ".glb":
case ".zip":
{
var instance = await GltfUtility.LoadAsync(path,
var instance = await GltfUtility.LoadBytesAsync(path, bytes,
GetIAwaitCaller(m_useAsync.isOn),
GetGltfMaterialGenerator(m_useUrpMaterial.isOn));
break;
Expand All @@ -389,7 +416,7 @@ async void LoadModelAsync(string path)
{
VrmUtility.MaterialGeneratorCallback materialCallback = (VRM.glTF_VRM_extensions vrm) => GetVrmMaterialGenerator(m_useUrpMaterial.isOn, vrm);
VrmUtility.MetaCallback metaCallback = m_texts.UpdateMeta;
var instance = await VrmUtility.LoadAsync(path, GetIAwaitCaller(m_useAsync.isOn), materialCallback, metaCallback, loadAnimation: m_loadAnimation.isOn);
var instance = await VrmUtility.LoadBytesAsync(path, bytes, GetIAwaitCaller(m_useAsync.isOn), materialCallback, metaCallback, loadAnimation: m_loadAnimation.isOn);
SetModel(instance);
break;
}
Expand Down Expand Up @@ -433,7 +460,11 @@ static IAwaitCaller GetIAwaitCaller(bool useAsync)
{
if (useAsync)
{
#if UNITY_WEBGL
return new RuntimeOnlyNoThreadAwaitCaller();
#else
return new RuntimeOnlyAwaitCaller();
#endif
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions Assets/VRM/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.vrmc.univrm",
"version": "0.102.1",
"version": "0.103.0",
"displayName": "VRM",
"description": "VRM importer",
"unity": "2019.4",
Expand All @@ -14,8 +14,8 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.102.1",
"com.vrmc.gltf": "0.102.1",
"com.vrmc.vrmshaders": "0.103.0",
"com.vrmc.gltf": "0.103.0",
"com.unity.ugui": "1.0.0"
},
"samples": [
Expand Down
Loading

0 comments on commit b3a0cb3

Please sign in to comment.