From be6e56aec32acea74873fef76333d1fe972bf97f Mon Sep 17 00:00:00 2001 From: G21 Date: Thu, 19 Apr 2018 14:33:21 +0900 Subject: [PATCH] move VRMExportUnityPackage to UniVRMTest --- Scripts/Editor/VRMExportUnityPackage.cs | 112 ------------------- Scripts/Editor/VRMExportUnityPackage.cs.meta | 12 -- 2 files changed, 124 deletions(-) delete mode 100644 Scripts/Editor/VRMExportUnityPackage.cs delete mode 100644 Scripts/Editor/VRMExportUnityPackage.cs.meta diff --git a/Scripts/Editor/VRMExportUnityPackage.cs b/Scripts/Editor/VRMExportUnityPackage.cs deleted file mode 100644 index 33355adb5..000000000 --- a/Scripts/Editor/VRMExportUnityPackage.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using System.IO; -using UnityEditor; -#if UNITY_2018_1_OR_NEWER -using UnityEditor.Build.Reporting; -#endif -using UnityEngine; - - -namespace VRM -{ - public static class VRMExportUnityPackage - { - static string GetDesktop() - { - return Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/VRM"; - } - - const string DATE_FORMAT = "yyyyMMdd"; - const string PREFIX = "UniVRM"; - - static string GetPath(string prefix) - { - var folder = GetDesktop(); - if (!Directory.Exists(folder)) - { - Directory.CreateDirectory(folder); - } - - //var date = DateTime.Today.ToString(DATE_FORMAT); - - var path = string.Format("{0}/{1}-{2}.unitypackage", - folder, - prefix, - VRMVersion.VERSION - ).Replace("\\", "/"); - - return path; - } - - static IEnumerable EnumerateFiles(string path) - { - if (Path.GetFileName(path).StartsWith(".git")) - { - yield break; - } - - if (Directory.Exists(path)) - { - foreach(var child in Directory.GetFileSystemEntries(path)) - { - foreach(var x in EnumerateFiles(child)) - { - yield return x; - } - } - } - else - { - if (Path.GetExtension(path).ToLower() != ".meta") - { - yield return path.Replace("\\", "/"); - } - } - } - -#if VRM_DEVELOP - [MenuItem("VRM/Export unitypackage")] -#endif - public static void CreateUnityPackage() - { - // まずビルドする - var levels = new string[] { "Assets/VRM/_RuntimeLoaderSample/VRMRuntimeLoaderSample.unity" }; - var buildPath = Path.GetFullPath(Application.dataPath + "/../build/build.exe"); - Debug.LogFormat("{0}", buildPath); - var build=BuildPipeline.BuildPlayer(levels, - buildPath, - BuildTarget.StandaloneWindows, - BuildOptions.None - ); -#if UNITY_2018_1_OR_NEWER - var iSuccess = build.summary.result != BuildResult.Succeeded; -#else - var iSuccess = !string.IsNullOrEmpty(build); -#endif - - var path = GetPath(PREFIX); - if (File.Exists(path)) - { - Debug.LogErrorFormat("{0} is already exists", path); - return; - } - - var files = EnumerateFiles("Assets/VRM") - .ToArray(); - - // 本体 - AssetDatabase.ExportPackage(files - .Where(x => !x.StartsWith("Assets/VRM/_RuntimeLoaderSample/")).ToArray() - , path, ExportPackageOptions.Interactive); - - // サンプル - AssetDatabase.ExportPackage(files - .Where(x => x.StartsWith("Assets/VRM/_RuntimeLoaderSample/")).ToArray() - , GetPath(PREFIX+"-RuntimeLoaderSample"), ExportPackageOptions.Interactive); - - Debug.LogFormat("exported: {0}", path); - } - } -} diff --git a/Scripts/Editor/VRMExportUnityPackage.cs.meta b/Scripts/Editor/VRMExportUnityPackage.cs.meta deleted file mode 100644 index ab6531f74..000000000 --- a/Scripts/Editor/VRMExportUnityPackage.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6895a43269f0daf4eab06931c9a7724c -timeCreated: 1521714822 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: