Show & check exporter version

This commit is contained in:
ousttrue 2018-04-22 17:20:03 +09:00
parent 10cc20f973
commit 7f3cd36966
4 changed files with 58 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}
}
}
}

View File

@ -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)
{

View File

@ -5,6 +5,9 @@ namespace VRM
{
public class VRMMetaObject : ScriptableObject
{
[SerializeField]
public string ExporterVersion;
#region Info
[SerializeField]
public string Title;