diff --git a/Assets/UniGLTF/UniGLTF/Editor/UniGLTFVersionMenu.cs b/Assets/UniGLTF/UniGLTF/Editor/UniGLTFVersionMenu.cs
deleted file mode 100644
index 20579b3da..000000000
--- a/Assets/UniGLTF/UniGLTF/Editor/UniGLTFVersionMenu.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#if VRM_DEVELOP
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using UnityEditor;
-
-
-namespace UniGLTF
-{
- public static class UniGLTFVersionMenu
- {
- public const int MENU_PRIORITY = 99;
- static string path = "Assets/UniGLTF/Core/Scripts/UniGLTFVersion.cs";
-
- const string template = @"
-namespace UniGLTF
-{{
- public static partial class UniGLTFVersion
- {{
- public const int MAJOR = {0};
- public const int MINOR = {1};
-
- public const string VERSION = ""{0}.{1}"";
- }}
-}}
-";
-
- [MenuItem(UniGLTFVersion.MENU + "/Increment", priority = MENU_PRIORITY)]
- public static void IncrementVersion()
- {
- var source = string.Format(template, UniGLTFVersion.MAJOR, UniGLTFVersion.MINOR + 1);
- File.WriteAllText(path, source);
- AssetDatabase.Refresh();
- }
-
- [MenuItem(UniGLTFVersion.MENU + "/Decrement", priority = MENU_PRIORITY)]
- public static void DecrementVersion()
- {
- var source = string.Format(template, UniGLTFVersion.MAJOR, UniGLTFVersion.MINOR - 1);
- File.WriteAllText(path, source);
- AssetDatabase.Refresh();
- }
- }
-}
-#endif
diff --git a/Assets/UniGLTF/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta b/Assets/UniGLTF/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta
deleted file mode 100644
index ce8f77c74..000000000
--- a/Assets/UniGLTF/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta
+++ /dev/null
@@ -1,13 +0,0 @@
-fileFormatVersion: 2
-guid: 49d23365a29018d4cb142227a01e662d
-timeCreated: 1522130550
-licenseType: Free
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/UniGLTF/UniGLTF/Scripts/UniGLTFVersion.cs b/Assets/UniGLTF/UniGLTF/Scripts/UniGLTFVersion.cs
index 10f547bb7..9684c6287 100644
--- a/Assets/UniGLTF/UniGLTF/Scripts/UniGLTFVersion.cs
+++ b/Assets/UniGLTF/UniGLTF/Scripts/UniGLTFVersion.cs
@@ -3,11 +3,9 @@ namespace UniGLTF
{
public static partial class UniGLTFVersion
{
- public const int MAJOR = 0;
- public const int MINOR = 62;
-
+ public const int MAJOR = 2;
+ public const int MINOR = 0;
public const int PATCH = 0;
-
- public const string VERSION = "0.62.0";
+ public const string VERSION = "2.0.0";
}
}
diff --git a/Assets/UniGLTF/package.json b/Assets/UniGLTF/package.json
index f0e11741a..5f6055719 100644
--- a/Assets/UniGLTF/package.json
+++ b/Assets/UniGLTF/package.json
@@ -1,6 +1,6 @@
{
"name": "com.vrmc.unigltf",
- "version": "0.62.0",
+ "version": "2.0.0",
"displayName": "UniGLTF",
"description": "GLTF importer and exporter",
"unity": "2018.4",
@@ -12,6 +12,6 @@
},
"dependencies": {
"com.vrmc.vrmshaders": "0.62.0",
- "com.vrmc.meshutility": "0.62.0"
+ "com.vrmc.meshutility": "0.62.0",
}
}
\ No newline at end of file
diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs b/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs
index a2d05726e..d273a5431 100644
--- a/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs
+++ b/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs
@@ -2,13 +2,35 @@
using System.Text;
using UnityEditor;
using UnityEngine;
+using UniGLTF;
namespace VRM
{
public class VRMVersionMenu : EditorWindow
{
- const string VersionPath = "Assets/VRM/UniVRM/Scripts/Format/VRMVersion.cs";
- const string VersionTemplate = @"
+ ///
+ /// UNIGLTF
+ ///
+ static string UniGltfVersionPath = "Assets/UniGLTF/UniGLTF/Scripts/UniGLTFVersion.cs";
+
+ const string UniGltfVersionTemplate = @"
+namespace UniGLTF
+{{
+ public static partial class UniGLTFVersion
+ {{
+ public const int MAJOR = {0};
+ public const int MINOR = {1};
+ public const int PATCH = {2};
+ public const string VERSION = ""{0}.{1}.{2}"";
+ }}
+}}
+";
+
+ ///
+ /// VRM
+ ///
+ const string VrmVersionPath = "Assets/VRM/UniVRM/Scripts/Format/VRMVersion.cs";
+ const string VrmVersionTemplate = @"
namespace VRM
{{
public static partial class VRMVersion
@@ -21,10 +43,26 @@ namespace VRM
}}
";
- const string VRMShadersPackagePath = "Assets/VRMShaders/package.json";
- const string VRMShadersPackageTemplate = @"{{
+ struct UpmPackage
+ {
+ public readonly string Name;
+ public readonly string Path;
+ public readonly string Template;
+
+ public UpmPackage(string name, string path, string template)
+ {
+ Name = name;
+ Path = path;
+ Template = template;
+ }
+ }
+
+ UpmPackage[] Packages = new UpmPackage[]
+ {
+ new UpmPackage("VRMShaders", "Assets/VRMShaders/package.json",
+@"{{
""name"": ""com.vrmc.vrmshaders"",
- ""version"": ""{0}.{1}.{2}"",
+ ""version"": ""{1}"",
""displayName"": ""VRM Shaders"",
""description"": ""VRM Shaders"",
""unity"": ""2018.4"",
@@ -36,12 +74,11 @@ namespace VRM
""name"": ""VRM Consortium""
}}
}}
-";
-
- const string MeshUtilityPath = "Assets/MeshUtility/package.json";
- const string MeshUtilityTemplate = @"{{
+"),
+ new UpmPackage("MeshUtility", "Assets/MeshUtility/package.json",
+@"{{
""name"": ""com.vrmc.meshutility"",
- ""version"": ""{0}.{1}.{2}"",
+ ""version"": ""{1}"",
""displayName"": ""MeshUtility"",
""unity"": ""2018.4"",
""description"": ""MeshUtility is a package for mesh separation, etc. \n\nCheck out the latest information here: "",
@@ -52,12 +89,11 @@ namespace VRM
""name"": ""VRM Consortium""
}}
}}
-";
-
- const string VRMPackagePath = "Assets/VRM/package.json";
- const string VRMPackageTemplate = @"{{
+"),
+ new UpmPackage("VRM", "Assets/VRM/package.json",
+@"{{
""name"": ""com.vrmc.univrm"",
- ""version"": ""{0}.{1}.{2}"",
+ ""version"": ""{1}"",
""displayName"": ""VRM"",
""description"": ""VRM importer"",
""unity"": ""2018.4"",
@@ -71,58 +107,97 @@ namespace VRM
""name"": ""VRM Consortium""
}},
""dependencies"": {{
- ""com.vrmc.vrmshaders"": ""{0}.{1}.{2}"",
- ""com.vrmc.meshutility"": ""{0}.{1}.{2}""
+ ""com.vrmc.vrmshaders"": ""{1}"",
+ ""com.vrmc.meshutility"": ""{1}"",
+ ""com.vrmc.unigltf"": ""{0}"",
}}
}}
-";
+"),
+ };
+
+ UpmPackage UniGLTFPackage = new UpmPackage("UniGLTF", "Assets/UniGLTF/package.json",
+@"{{
+ ""name"": ""com.vrmc.unigltf"",
+ ""version"": ""{0}"",
+ ""displayName"": ""UniGLTF"",
+ ""description"": ""GLTF importer and exporter"",
+ ""unity"": ""2018.4"",
+ ""keywords"": [
+ ""gltf""
+ ],
+ ""author"": {{
+ ""name"": ""VRM Consortium""
+ }},
+ ""dependencies"": {{
+ ""com.vrmc.vrmshaders"": ""{1}"",
+ ""com.vrmc.meshutility"": ""{1}"",
+ }}
+}}");
[SerializeField]
- string m_version;
+ string m_vrmVersion;
+ [SerializeField]
+ string m_uniGltfVersion;
+
+ static bool TryGetVersion(string src, out (int, int, int) version)
+ {
+ if (string.IsNullOrEmpty(src))
+ {
+ version = default;
+ return false;
+ }
+
+ var splitted = src.Split('.');
+ if (splitted.Length != 3)
+ {
+ version = default;
+ return false;
+ }
+
+ version = (
+ int.Parse(splitted[0]),
+ int.Parse(splitted[1]),
+ int.Parse(splitted[2])
+ );
+ return true;
+ }
+
+ ///
+ /// バージョン管理ダイアログ
+ ///
void OnGUI()
{
+ GUILayout.Label("VRM");
GUILayout.Label($"Current version: {VRMVersion.VERSION}");
+ m_vrmVersion = EditorGUILayout.TextField("Major.Minor.Patch", m_vrmVersion);
+ GUILayout.Space(30);
- m_version = EditorGUILayout.TextField("Major.Minor.Patch", m_version);
+ GUILayout.Label("UniGLTF");
+ GUILayout.Label($"Current version: {UniGLTFVersion.VERSION}");
+ m_uniGltfVersion = EditorGUILayout.TextField("Major.Minor.Patch", m_uniGltfVersion);
+ GUILayout.Space(30);
if (GUILayout.Button("Apply"))
{
- if (string.IsNullOrEmpty(m_version))
+ if (TryGetVersion(m_vrmVersion, out (int, int, int) vrmVersion))
{
- return;
+ if (TryGetVersion(m_uniGltfVersion, out (int, int, int) uniGltfVersion))
+ {
+ UpdateVrmVersion(uniGltfVersion, vrmVersion);
+ UpdateUniGLTFVersion(uniGltfVersion, vrmVersion);
+ AssetDatabase.Refresh();
+ Debug.Log($"{uniGltfVersion}, {vrmVersion}");
+ }
+ else
+ {
+ Debug.LogWarning($"InvalidFormat: {m_uniGltfVersion}");
+ }
}
- var splitted = m_version.Split('.');
- if (splitted.Length != 3)
+ else
{
- Debug.LogWarning($"InvalidFormat: {m_version}");
- return;
+ Debug.LogWarning($"InvalidFormat: {m_vrmVersion}");
}
- var values = new int[3];
- for (int i = 0; i < 3; ++i)
- {
- values[i] = int.Parse(splitted[i]);
- }
-
- // generate
- var utf8 = new UTF8Encoding(false);
- File.WriteAllText(VersionPath, string.Format(VersionTemplate,
- values[0],
- values[1],
- values[2]), utf8);
- File.WriteAllText(VRMShadersPackagePath, string.Format(VRMShadersPackageTemplate,
- values[0],
- values[1],
- values[2]), utf8);
- File.WriteAllText(MeshUtilityPath, string.Format(MeshUtilityTemplate,
- values[0],
- values[1],
- values[2]), utf8);
- File.WriteAllText(VRMPackagePath, string.Format(VRMPackageTemplate,
- values[0],
- values[1],
- values[2]), utf8);
- AssetDatabase.Refresh();
}
if (GUILayout.Button("Close"))
@@ -131,13 +206,46 @@ namespace VRM
}
}
+ void UpdateUniGLTFVersion((int, int, int) uniGltf, (int, int, int) vrm)
+ {
+ var utf8 = new UTF8Encoding(false);
+ File.WriteAllText(UniGltfVersionPath, string.Format(UniGltfVersionTemplate,
+ uniGltf.Item1,
+ uniGltf.Item2,
+ uniGltf.Item3), utf8);
+
+ File.WriteAllText(UniGLTFPackage.Path, string.Format(UniGLTFPackage.Template,
+ $"{uniGltf.Item1}.{uniGltf.Item2}.{uniGltf.Item3}",
+ $"{vrm.Item1}.{vrm.Item2}.{vrm.Item3}"
+ ), utf8);
+ }
+
+ void UpdateVrmVersion((int, int, int) uniGltf, (int, int, int) vrm)
+ {
+ // generate
+ var utf8 = new UTF8Encoding(false);
+ File.WriteAllText(VrmVersionPath, string.Format(VrmVersionTemplate,
+ vrm.Item1,
+ vrm.Item2,
+ vrm.Item3), utf8);
+ // UPM
+ foreach (var upm in Packages)
+ {
+ File.WriteAllText(upm.Path, string.Format(upm.Template,
+ $"{uniGltf.Item1}.{uniGltf.Item2}.{uniGltf.Item3}",
+ $"{vrm.Item1}.{vrm.Item2}.{vrm.Item3}"
+ ), utf8);
+ }
+ }
+
#if VRM_DEVELOP
[MenuItem(VRMVersion.MENU + "/VersionDialog")]
#endif
static void ShowVersionDialog()
{
var window = ScriptableObject.CreateInstance();
- window.m_version = VRMVersion.VERSION;
+ window.m_vrmVersion = VRMVersion.VERSION;
+ window.m_uniGltfVersion = UniGLTFVersion.VERSION;
window.ShowUtility();
}
}
diff --git a/Assets/VRM/package.json b/Assets/VRM/package.json
index 54e6183f7..5425e573b 100644
--- a/Assets/VRM/package.json
+++ b/Assets/VRM/package.json
@@ -16,6 +16,6 @@
"dependencies": {
"com.vrmc.vrmshaders": "0.62.0",
"com.vrmc.meshutility": "0.62.0",
- "com.vrmc.unigltf": "0.62.0"
+ "com.vrmc.unigltf": "2.0.0",
}
}