From ba8eaaf8f1404a3f8237d2500db2987c5ade0f40 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 20 Jul 2020 15:59:55 +0900 Subject: [PATCH] update VRM/package.json and VRMShaders/package.json --- .../UniVRM/Editor/Format/VRMVersionMenu.cs | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs b/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs index 8cf3b08af..b0956d809 100644 --- a/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs +++ b/Assets/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Text; using UnityEditor; using UnityEngine; @@ -6,8 +7,8 @@ namespace VRM { public class VRMVersionMenu : EditorWindow { - const string path = "Assets/VRM/UniVRM/Scripts/Format/VRMVersion.cs"; - const string template = @" + const string VersionPath = "Assets/VRM/UniVRM/Scripts/Format/VRMVersion.cs"; + const string VersionTemplate = @" namespace VRM {{ public static partial class VRMVersion @@ -18,6 +19,44 @@ namespace VRM public const string VERSION = ""{0}.{1}.{2}""; }} }} +"; + + const string VRMShadersPackagePath = "Assets/VRMShaders/package.json"; + const string VRMShadersPackageTemplate = @"{{ + ""name"": ""com.vrmc.vrmshaders"", + ""version"": ""{0}.{1}.{2}"", + ""displayName"": ""VRM Shaders"", + ""description"": ""VRM Shaders"", + ""unity"": ""2018.4"", + ""keywords"": [ + ""vrm"", + ""shader"" + ], + ""author"": {{ + ""name"": ""VRM Consortium"" + }} +}} +"; + const string VRMPackagePath = "Assets/VRM/package.json"; + const string VRMPackageTemplate = @"{{ + ""name"": ""com.vrmc.univrm"", + ""version"": ""{0}.{1}.{2}"", + ""displayName"": ""VRM"", + ""description"": ""VRM importer"", + ""unity"": ""2018.4"", + ""keywords"": [ + ""vrm"", + ""importer"", + ""avatar"", + ""vr"" + ], + ""author"": {{ + ""name"": ""VRM Consortium"" + }}, + ""dependencies"": {{ + ""com.vrmc.vrmshaders"": ""{0}.{1}.{2}"" + }} +}} "; [SerializeField] @@ -47,14 +86,20 @@ namespace VRM values[i] = int.Parse(splitted[i]); } - // generate new VRMVersion.cs - var source = string.Format( - template, + // generate + var utf8 = new UTF8Encoding(false); + File.WriteAllText(VersionPath, string.Format(VersionTemplate, values[0], values[1], - values[2] - ); - File.WriteAllText(path, source); + values[2]), utf8); + File.WriteAllText(VRMShadersPackagePath, string.Format(VRMShadersPackageTemplate, + values[0], + values[1], + values[2]), utf8); + File.WriteAllText(VRMPackagePath, string.Format(VRMPackageTemplate, + values[0], + values[1], + values[2]), utf8); AssetDatabase.Refresh(); }