mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-13 05:54:59 -05:00
Show & check exporter version
This commit is contained in:
parent
10cc20f973
commit
7f3cd36966
|
|
@ -38,9 +38,10 @@ namespace VRM
|
|||
{
|
||||
var meta=ScriptableObject.CreateInstance<VRMMetaObject>();
|
||||
meta.name = "Meta";
|
||||
meta.ExporterVersion = VRM.extensions.VRM.exporterVersion;
|
||||
|
||||
var gltfMeta = VRM.extensions.VRM.meta;
|
||||
meta.Version = gltfMeta.version;
|
||||
meta.Version = gltfMeta.version; // model version
|
||||
meta.Author = gltfMeta.author;
|
||||
meta.ContactInformation = gltfMeta.contactInformation;
|
||||
meta.Reference = gltfMeta.reference;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
public static class VRMVersion
|
||||
|
|
@ -10,5 +12,48 @@ namespace VRM
|
|||
|
||||
public const string DecrementMenuName = "VRM/Version(0.36) Decrement";
|
||||
public const string IncrementMenuName = "VRM/Version(0.36) Increment";
|
||||
|
||||
public static bool IsNewer(string version)
|
||||
{
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var prefix = "UniVRM-";
|
||||
if (version.StartsWith(prefix))
|
||||
{
|
||||
version = version.Substring(prefix.Length);
|
||||
}
|
||||
|
||||
var splited = version.Split('.');
|
||||
if (splited.Length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var major = int.Parse(splited[0]);
|
||||
var minor = int.Parse(splited[1]);
|
||||
|
||||
if (major < MAJOR)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (major > MAJOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return minor > MINOR;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,14 @@ namespace VRM
|
|||
|
||||
so.Update();
|
||||
|
||||
GUI.enabled = false;
|
||||
EditorGUILayout.PropertyField(m_propMap["ExporterVersion"]);
|
||||
if (VRMVersion.IsNewer(m_propMap["ExporterVersion"].stringValue))
|
||||
{
|
||||
EditorGUILayout.HelpBox("Check UniVRM new version. https://github.com/dwango/UniVRM/releases", MessageType.Warning);
|
||||
}
|
||||
GUI.enabled = true;
|
||||
|
||||
m_foldoutInfo = EditorGUILayout.Foldout(m_foldoutInfo, "Information");
|
||||
if (m_foldoutInfo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ namespace VRM
|
|||
{
|
||||
public class VRMMetaObject : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
public string ExporterVersion;
|
||||
|
||||
#region Info
|
||||
[SerializeField]
|
||||
public string Title;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user