From e8861704d2e74ca6639d9047f03d5b5c15fd5586 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 9 Jun 2023 17:13:42 +0900 Subject: [PATCH] UniVRM-0.112.0 --- .../UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs | 4 +- Assets/UniGLTF/package.json | 4 +- Assets/VRM/Runtime/Format/VRMVersion.cs | 4 +- Assets/VRM/Samples~/SimpleViewer/ViewerUI.cs | 60 ++++++++++++++++- Assets/VRM/package.json | 6 +- .../Samples~/VRM10Viewer/VRM10ViewerUI.cs | 64 +++++++++++++++++-- Assets/VRM10/package.json | 6 +- Assets/VRMShaders/package.json | 2 +- 8 files changed, 128 insertions(+), 22 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs b/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs index d90a79ab7..a1aad4c02 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs @@ -4,8 +4,8 @@ namespace UniGLTF public static partial class UniGLTFVersion { public const int MAJOR = 2; - public const int MINOR = 47; + public const int MINOR = 48; public const int PATCH = 0; - public const string VERSION = "2.47.0"; + public const string VERSION = "2.48.0"; } } diff --git a/Assets/UniGLTF/package.json b/Assets/UniGLTF/package.json index 5d8ef9510..32d9a03fb 100644 --- a/Assets/UniGLTF/package.json +++ b/Assets/UniGLTF/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.gltf", - "version": "0.111.0", + "version": "0.112.0", "displayName": "UniGLTF", "description": "GLTF importer and exporter", "unity": "2019.4", @@ -11,7 +11,7 @@ "name": "VRM Consortium" }, "dependencies": { - "com.vrmc.vrmshaders": "0.111.0", + "com.vrmc.vrmshaders": "0.112.0", "com.unity.modules.animation": "1.0.0" }, "samples": [ diff --git a/Assets/VRM/Runtime/Format/VRMVersion.cs b/Assets/VRM/Runtime/Format/VRMVersion.cs index 660ba2150..94b0dab09 100644 --- a/Assets/VRM/Runtime/Format/VRMVersion.cs +++ b/Assets/VRM/Runtime/Format/VRMVersion.cs @@ -4,8 +4,8 @@ namespace VRM public static partial class VRMVersion { public const int MAJOR = 0; - public const int MINOR = 111; + public const int MINOR = 112; public const int PATCH = 0; - public const string VERSION = "0.111.0"; + public const string VERSION = "0.112.0"; } } diff --git a/Assets/VRM/Samples~/SimpleViewer/ViewerUI.cs b/Assets/VRM/Samples~/SimpleViewer/ViewerUI.cs index 04942584a..6d9be86f7 100644 --- a/Assets/VRM/Samples~/SimpleViewer/ViewerUI.cs +++ b/Assets/VRM/Samples~/SimpleViewer/ViewerUI.cs @@ -195,6 +195,61 @@ namespace VRM.SimpleViewer Loaded m_loaded; + static class ArgumentChecker + { + static string[] Supported = { + ".gltf", + ".glb", + ".vrm", + ".zip", + }; + + static string UnityHubPath => System.Environment.GetEnvironmentVariable("ProgramFiles") + "\\Unity\\Hub"; + + public static bool IsLoadable(string path) + { + if (!File.Exists(path)) + { + // not exists + return false; + } + + if (Application.isEditor) + { + // skip editor argument + // {UnityHub_Resources}\PackageManager\ProjectTemplates\com.unity.template.3d-5.0.4.tgz + if (path.StartsWith(UnityHubPath)) + { + return false; + } + } + + var ext = Path.GetExtension(path).ToLower(); + if (!Supported.Contains(ext)) + { + // unknown extension + return false; + } + + return true; + } + + public static bool TryGetFirstLoadable(out string cmd) + { + foreach (var arg in System.Environment.GetCommandLineArgs()) + { + if (ArgumentChecker.IsLoadable(arg)) + { + cmd = arg; + return true; + } + } + + cmd = default; + return false; + } + } + private void Start() { m_version.text = string.Format("VRMViewer {0}.{1}", @@ -211,10 +266,9 @@ namespace VRM.SimpleViewer LoadMotion("tmp.bvh", m_motion.text); } - string[] cmds = System.Environment.GetCommandLineArgs(); - if (cmds.Length > 1) + if (ArgumentChecker.TryGetFirstLoadable(out var cmd)) { - LoadPathAsync(cmds[1]); + LoadPathAsync(cmd); } m_texts.Start(); diff --git a/Assets/VRM/package.json b/Assets/VRM/package.json index 9f69e52a4..fe20812b2 100644 --- a/Assets/VRM/package.json +++ b/Assets/VRM/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.univrm", - "version": "0.111.0", + "version": "0.112.0", "displayName": "VRM", "description": "VRM importer", "unity": "2019.4", @@ -14,8 +14,8 @@ "name": "VRM Consortium" }, "dependencies": { - "com.vrmc.vrmshaders": "0.111.0", - "com.vrmc.gltf": "0.111.0", + "com.vrmc.vrmshaders": "0.112.0", + "com.vrmc.gltf": "0.112.0", "com.unity.ugui": "1.0.0" }, "samples": [ diff --git a/Assets/VRM10/Samples~/VRM10Viewer/VRM10ViewerUI.cs b/Assets/VRM10/Samples~/VRM10Viewer/VRM10ViewerUI.cs index cbd775e12..dbfc4bdb3 100644 --- a/Assets/VRM10/Samples~/VRM10Viewer/VRM10ViewerUI.cs +++ b/Assets/VRM10/Samples~/VRM10Viewer/VRM10ViewerUI.cs @@ -244,6 +244,61 @@ namespace UniVRM10.VRM10Viewer Loaded m_loaded; + static class ArgumentChecker + { + static string[] Supported = { + ".gltf", + ".glb", + ".vrm", + ".zip", + }; + + static string UnityHubPath => System.Environment.GetEnvironmentVariable("ProgramFiles") + "\\Unity\\Hub"; + + public static bool IsLoadable(string path) + { + if (!File.Exists(path)) + { + // not exists + return false; + } + + if (Application.isEditor) + { + // skip editor argument + // {UnityHub_Resources}\PackageManager\ProjectTemplates\com.unity.template.3d-5.0.4.tgz + if (path.StartsWith(UnityHubPath)) + { + return false; + } + } + + var ext = Path.GetExtension(path).ToLower(); + if (!Supported.Contains(ext)) + { + // unknown extension + return false; + } + + return true; + } + + public static bool TryGetFirstLoadable(out string cmd) + { + foreach (var arg in System.Environment.GetCommandLineArgs()) + { + if (ArgumentChecker.IsLoadable(arg)) + { + cmd = arg; + return true; + } + } + + cmd = default; + return false; + } + } + private void Start() { m_version.text = string.Format("VRMViewer {0}.{1}", @@ -259,13 +314,9 @@ namespace UniVRM10.VRM10Viewer Motion = BvhMotion.LoadBvhFromText(m_motion.text); } - string[] cmds = System.Environment.GetCommandLineArgs(); - for (int i = 1; i < cmds.Length; ++i) + if (ArgumentChecker.TryGetFirstLoadable(out var cmd)) { - if (File.Exists(cmds[i])) - { - LoadModel(cmds[i]); - } + LoadModel(cmd); } m_texts.Start(); @@ -431,6 +482,7 @@ namespace UniVRM10.VRM10Viewer instance.ShowMeshes(); instance.EnableUpdateWhenOffscreen(); m_loaded = new Loaded(instance, m_target.transform); + m_showBoxMan.isOn = false; } catch (Exception ex) { diff --git a/Assets/VRM10/package.json b/Assets/VRM10/package.json index 0d3176f42..c2cfbd33d 100644 --- a/Assets/VRM10/package.json +++ b/Assets/VRM10/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.vrm", - "version": "0.111.0", + "version": "0.112.0", "displayName": "VRM-1.0", "description": "VRM-1.0 importer", "unity": "2019.4", @@ -14,8 +14,8 @@ "name": "VRM Consortium" }, "dependencies": { - "com.vrmc.vrmshaders": "0.111.0", - "com.vrmc.gltf": "0.111.0" + "com.vrmc.vrmshaders": "0.112.0", + "com.vrmc.gltf": "0.112.0" }, "samples": [ { diff --git a/Assets/VRMShaders/package.json b/Assets/VRMShaders/package.json index 9976e9a5c..c0a46231f 100644 --- a/Assets/VRMShaders/package.json +++ b/Assets/VRMShaders/package.json @@ -1,6 +1,6 @@ { "name": "com.vrmc.vrmshaders", - "version": "0.111.0", + "version": "0.112.0", "displayName": "VRM Shaders", "description": "VRM Shaders", "unity": "2019.4",