Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内部バージョンは維持 UniGLTF/UniGLTFVersion.cs #1158

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Assets/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ namespace UniGLTF
{
public static partial class UniGLTFVersion
{
public const int MAJOR = 0;
public const int MINOR = 81;
public const int MAJOR = 2;
public const int MINOR = 17;
public const int PATCH = 0;
public const string VERSION = "0.81.0";
public const string VERSION = "2.17.0";
}
}
41 changes: 35 additions & 6 deletions Assets/VRM/Editor/Format/VRMVersionMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ namespace VRM
///
/// v0.81.0: com.vrmc.unigltf to com.vrmc.gltf and same version with univrm.
///
/// Major = 2
/// Minor = VRMVersion.MINOR - 64
/// Patch = VRMVersion.PATCH
///
/// </summary>
public class VRMVersionMenu : EditorWindow
{
Expand Down Expand Up @@ -178,6 +182,21 @@ public UpmPackage(string path, string template)
[SerializeField]
string m_vrmVersion;

(int, int, int) m_uniGltfVersion
{
get
{
if (TryGetVersion(m_vrmVersion, out (int, int, int) vrmVersion))
{
return (2, vrmVersion.Item2 - 64, vrmVersion.Item3);
}
else
{
return (0, 0, 0);
}
}
}

static bool TryGetVersion(string src, out (int, int, int) version)
{
try
Expand Down Expand Up @@ -219,14 +238,24 @@ void OnGUI()
m_vrmVersion = EditorGUILayout.TextField("Major.Minor.Patch", m_vrmVersion);
GUILayout.Space(30);

GUILayout.Label("UniGLTF");
GUILayout.Label($"Current version: {UniGLTFVersion.VERSION}");
{
var enabled = GUI.enabled;
GUI.enabled = false;
EditorGUILayout.TextField("Major.Minor.Patch", $"{m_uniGltfVersion}");
GUI.enabled = enabled;
}
GUILayout.Space(30);

if (GUILayout.Button("Apply"))
{
if (TryGetVersion(m_vrmVersion, out (int, int, int) vrmVersion))
{
UpdateVrmVersion(vrmVersion);
UpdateUniGLTFVersion(vrmVersion);
UpdateUniGLTFVersion(m_uniGltfVersion, vrmVersion);
AssetDatabase.Refresh();
Debug.Log($"{vrmVersion}");
Debug.Log($"{m_uniGltfVersion}, {vrmVersion}");
}
else
{
Expand All @@ -240,13 +269,13 @@ void OnGUI()
}
}

void UpdateUniGLTFVersion((int, int, int) vrm)
void UpdateUniGLTFVersion((int, int, int) uniGltf, (int, int, int) vrm)
{
var utf8 = new UTF8Encoding(false);
File.WriteAllText(UniGltfVersionPath, string.Format(UniGltfVersionTemplate,
vrm.Item1,
vrm.Item2,
vrm.Item3), utf8);
uniGltf.Item1,
uniGltf.Item2,
uniGltf.Item3), utf8);

File.WriteAllText(UniGLTFPackage.Path, string.Format(UniGLTFPackage.Template,
$"{vrm.Item1}.{vrm.Item2}.{vrm.Item3}",
Expand Down