Merge pull request #2171 from ousttrue/fix/version_menu

[exporter] asset.generator を修正
This commit is contained in:
ousttrue 2023-10-20 21:34:38 +09:00 committed by GitHub
commit ad8a938e50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 48 additions and 97 deletions

View File

@ -53,6 +53,7 @@
"Temp/":true
},
"cSpell.words": [
"GLTF",
"UNIVRM"
]
}

View File

@ -1,7 +1,7 @@
namespace VRM
namespace UniGLTF
{
public static partial class VRMVersion
public static partial class PackageVersion
{
public const int MAJOR = 0;
public const int MINOR = 115;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b7339aecd19a8ec4fbe33ca20d8ef675
guid: ab81045d7751d4040b553ecbac5ab9e4
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,9 +1,9 @@
using System;
using System.Text.RegularExpressions;
namespace VRM
namespace UniGLTF
{
public static partial class VRMVersion
public static partial class PackageVersion
{
/// <summary>
/// Returns true if a passed version is newer than current UniVRM.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: daece183c090e0b4aa9097151202c316
guid: a025b7dc17054bb41ae56d364d78d120
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -40,11 +40,11 @@ namespace UniGLTF
/// <summary>
/// VRM
/// </summary>
const string VrmVersionPath = "Assets/VRM/Runtime/Format/VRMVersion.cs";
const string VrmVersionPath = "Assets/UniGLTF/Runtime/UniGLTF/PackageVersion.cs";
const string VrmVersionTemplate = @"
namespace VRM
namespace UniGLTF
{{
public static partial class VRMVersion
public static partial class PackageVersion
{{
public const int MAJOR = {0};
public const int MINOR = {1};
@ -251,7 +251,7 @@ namespace VRM
void OnGUI()
{
GUILayout.Label("VRM");
GUILayout.Label($"Current version: {VRMVersion.VERSION}");
GUILayout.Label($"Current version: {PackageVersion.VERSION}");
m_vrmVersion = EditorGUILayout.TextField("Major.Minor.Patch", m_vrmVersion);
GUILayout.Space(30);
@ -324,7 +324,7 @@ namespace VRM
public static void ShowVersionDialog()
{
var window = ScriptableObject.CreateInstance<VRMVersionMenu>();
window.m_vrmVersion = VRMVersion.VERSION;
window.m_vrmVersion = PackageVersion.VERSION;
// window.m_uniGltfVersion = UniGLTFVersion.VERSION;
window.ShowUtility();
}

View File

@ -176,7 +176,7 @@ namespace VRM
{
serializedObject.Update();
if (VRMVersion.IsNewer(m_exporterVersion.stringValue))
if (PackageVersion.IsNewer(m_exporterVersion.stringValue))
{
// モデルのバージョンが、ライブラリのバージョンより新しい
EditorGUILayout.HelpBox("Check UniVRM new version.", MessageType.Warning);

View File

@ -73,7 +73,7 @@ namespace VRM.DevOnly.PackageExporter
var path = string.Format("{0}/{1}-{2}_{3}.unitypackage",
folder,
prefix,
VRMVersion.VERSION,
UniGLTF.PackageVersion.VERSION,
GetGitHash(Application.dataPath + "/VRM").Substring(0, 4)
).Replace("\\", "/");

View File

@ -6,13 +6,13 @@ namespace VRM
{
public static class VrmTopMenu
{
private const string UserMenuPrefix = VRMVersion.MENU;
private const string DevelopmentMenuPrefix = VRMVersion.MENU + "/Development";
private const string UserMenuPrefix = PackageVersion.MENU;
private const string DevelopmentMenuPrefix = PackageVersion.MENU + "/Development";
[MenuItem(UserMenuPrefix + "/Version: " + VRMVersion.VRM_VERSION, validate = true)]
[MenuItem(UserMenuPrefix + "/Version: " + PackageVersion.VRM_VERSION, validate = true)]
private static bool ShowVersionValidation() => false;
[MenuItem(UserMenuPrefix + "/Version: " + VRMVersion.VRM_VERSION, priority = 0)]
[MenuItem(UserMenuPrefix + "/Version: " + PackageVersion.VRM_VERSION, priority = 0)]
private static void ShowVersion() { }
[MenuItem(UserMenuPrefix + "/Export to VRM 0.x", priority = 1)]

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 4ab9ac9856a4d4c4aa652c07c5b496e6
timeCreated: 1522130257
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,8 +15,8 @@ VRM extension is for 3d humanoid avatars (and models) in VR applications.
public static readonly Utf8String ExtensionNameUtf8 = Utf8String.From(ExtensionName);
[JsonSchema(Description = @"Version of exporter that vrm created. " + VRMVersion.VRM_VERSION)]
public string exporterVersion = "UniVRM-" + VRMVersion.VERSION;
[JsonSchema(Description = @"Version of exporter that vrm created. " + PackageVersion.VRM_VERSION)]
public string exporterVersion = "UniVRM-" + PackageVersion.VERSION;
[JsonSchema(Description = @"Version of VRM specification. " + VRMSpecVersion.VERSION)]
public string specVersion = VRMSpecVersion.Version;

View File

@ -22,10 +22,10 @@ namespace VRM
private static void UpdateMigrationFlags(MigrationFlags migrationFlags, string exportedVrmVersionString)
{
if (!VRMVersion.ParseVersion(exportedVrmVersionString, out var exportedVrmVersion)) return;
if (!PackageVersion.ParseVersion(exportedVrmVersionString, out var exportedVrmVersion)) return;
migrationFlags.IsBaseColorFactorGamma = VRMVersion.IsNewer(
new VRMVersion.Version
migrationFlags.IsBaseColorFactorGamma = PackageVersion.IsNewer(
new PackageVersion.Version
{
Major = 0,
Minor = 54,
@ -35,8 +35,8 @@ namespace VRM
exportedVrmVersion
);
migrationFlags.IsRoughnessTextureValueSquared = VRMVersion.IsNewer(
new VRMVersion.Version
migrationFlags.IsRoughnessTextureValueSquared = PackageVersion.IsNewer(
new PackageVersion.Version
{
Major = 0,
Minor = 69,
@ -45,8 +45,8 @@ namespace VRM
},
exportedVrmVersion
);
migrationFlags.IsEmissiveFactorGamma = VRMVersion.IsNewer(
new VRMVersion.Version
migrationFlags.IsEmissiveFactorGamma = PackageVersion.IsNewer(
new PackageVersion.Version
{
Major = 0,
Minor = 107,

View File

@ -253,7 +253,7 @@ namespace VRM.SimpleViewer
private void Start()
{
m_version.text = string.Format("VRMViewer {0}.{1}",
VRMVersion.MAJOR, VRMVersion.MINOR);
PackageVersion.MAJOR, PackageVersion.MINOR);
m_open.onClick.AddListener(OnOpenClicked);
m_useFastSpringBone.onValueChanged.AddListener(OnUseFastSpringBoneValueChanged);
OnUseFastSpringBoneValueChanged(m_useFastSpringBone.isOn);

View File

@ -1,22 +1,17 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using UniJSON;
using UnityEngine;
namespace VRM
{
public class UniVRMVersionTests
{
[Test]
[TestCase(VRMVersion.VERSION, false)]
[TestCase(UniGLTF.PackageVersion.VERSION, false)]
[TestCase("0.199", true)]
[TestCase("0.199.0", true)]
[TestCase("1.0.0", true)]
public void IsNewerTest(string newer, bool isNewer)
{
Assert.AreEqual(isNewer, VRMVersion.IsNewer(newer));
Assert.AreEqual(isNewer, UniGLTF.PackageVersion.IsNewer(newer));
}
[Test]
@ -31,7 +26,7 @@ namespace VRM
[TestCase("1.0.0", "0.51.0", true)]
public void IsNewerTest(string newer, string older, bool isNewer)
{
Assert.AreEqual(isNewer, VRMVersion.IsNewer(newer, older));
Assert.AreEqual(isNewer, UniGLTF.PackageVersion.IsNewer(newer, older));
}
[Test]
@ -43,8 +38,8 @@ namespace VRM
[TestCase("aaaaa", false, 0, 0, 0, "")]
public void ParseVersionTest(string version, bool canBeParsed, int major, int minor, int patch, string pre)
{
VRMVersion.Version v;
var res = VRMVersion.ParseVersion(version, out v);
UniGLTF.PackageVersion.Version v;
var res = UniGLTF.PackageVersion.ParseVersion(version, out v);
Assert.AreEqual(canBeParsed, res);
if (res)
{

View File

@ -4,9 +4,9 @@ namespace UniVRM10
{
public static class Vrm10TopMenu
{
private const string UserMenuPrefix = VRMVersion.MENU;
private const string DevelopmentMenuPrefix = VRMVersion.MENU + "/Development";
private const string ExperimentalMenuPrefix = VRMVersion.MENU + "/Experimental";
private const string UserMenuPrefix = VRM10SpecVersion.MENU;
private const string DevelopmentMenuPrefix = VRM10SpecVersion.MENU + "/Development";
private const string ExperimentalMenuPrefix = VRM10SpecVersion.MENU + "/Experimental";
[MenuItem(UserMenuPrefix + "/Export VRM-1.0", priority = 1)]
private static void OpenExportDialog() => VRM10ExportDialog.Open();

View File

@ -1,27 +1,13 @@
using System;
namespace UniVRM10
{
/// <summary>
/// https://github.com/vrm-c/vrm-specification/tree/master/specification
///
/// spec version として解釈できる git tag を運用するべきか。
///
/// コード生成を通して自動で更新する必要がある。
/// </summary>
public class VRMSpecVersion
public static partial class VRM10SpecVersion
{
public const int Major = 1;
public const int Minor = 0;
public const int MAJOR = 1;
public const int MINOR = 0;
public const int PATCH = 0;
public const string PRE_ID = "";
public static string Version
{
get
{
return String.Format("{0}.{1}.draft", Major, Minor);
}
}
public const string VERSION = "1.0.draft";
const string VERSION = "1.0.0";
}
}

View File

@ -1,12 +1,9 @@
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Text.RegularExpressions;
namespace UniVRM10
{
public static partial class VRMVersion
public static partial class VRM10SpecVersion
{
/// <summary>
/// Returns true if a passed version is newer than current UniVRM.

View File

@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 93c46c8b64555f14bada9f5bb0b7761a
timeCreated: 1522130257
licenseType: Free
guid: 83197292b727c684ea74bbdbf6d40ef0
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,13 +0,0 @@
namespace UniVRM10
{
public static partial class VRMVersion
{
public const int MAJOR = 1;
public const int MINOR = 0;
public const int PATCH = 0;
public const string PRE_ID = "";
public const string VERSION = "1.0.0.beta";
}
}

View File

@ -310,7 +310,7 @@ namespace UniVRM10.VRM10Viewer
private void Start()
{
m_version.text = string.Format("VRMViewer {0}.{1}",
VRMVersion.MAJOR, VRMVersion.MINOR);
VRM10SpecVersion.MAJOR, VRM10SpecVersion.MINOR);
m_openModel.onClick.AddListener(OnOpenModelClicked);
m_openMotion.onClick.AddListener(OnOpenMotionClicked);

View File

@ -25,7 +25,7 @@ namespace VrmLib
public Coordinates Coordinates;
public string AssetVersion = "2.0";
public string AssetGenerator;
public string AssetGenerator = $"UniVRM-{PackageVersion.VERSION}";
public string AssetCopyright;
public string AssetMinVersion;

View File

@ -310,7 +310,7 @@ namespace UniVRM10.VRM10Viewer
private void Start()
{
m_version.text = string.Format("VRMViewer {0}.{1}",
VRMVersion.MAJOR, VRMVersion.MINOR);
VRM10SpecVersion.MAJOR, VRM10SpecVersion.MINOR);
m_openModel.onClick.AddListener(OnOpenModelClicked);
m_openMotion.onClick.AddListener(OnOpenMotionClicked);

View File

@ -253,7 +253,7 @@ namespace VRM.SimpleViewer
private void Start()
{
m_version.text = string.Format("VRMViewer {0}.{1}",
VRMVersion.MAJOR, VRMVersion.MINOR);
PackageVersion.MAJOR, PackageVersion.MINOR);
m_open.onClick.AddListener(OnOpenClicked);
m_useFastSpringBone.onValueChanged.AddListener(OnUseFastSpringBoneValueChanged);
OnUseFastSpringBoneValueChanged(m_useFastSpringBone.isOn);