From 5a3f7d7b1389946ce589cc6e325472491ef60828 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 22 Apr 2021 16:24:41 +0900 Subject: [PATCH] =?UTF-8?q?=E7=A8=AE=E9=A1=9E=E6=AF=8E=E3=81=AB=E5=88=A5?= =?UTF-8?q?=E3=81=AE=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=81=ABExtract?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/ScriptedImporter/EditorVrm.cs | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Assets/VRM10/Editor/ScriptedImporter/EditorVrm.cs b/Assets/VRM10/Editor/ScriptedImporter/EditorVrm.cs index 6d0ab9bfc..16ba0819f 100644 --- a/Assets/VRM10/Editor/ScriptedImporter/EditorVrm.cs +++ b/Assets/VRM10/Editor/ScriptedImporter/EditorVrm.cs @@ -3,7 +3,6 @@ using UnityEngine; using System.Linq; using System.IO; using UnityEditor; -using VRMShaders; #if UNITY_2020_2_OR_NEWER using UnityEditor.AssetImporters; #else @@ -55,6 +54,22 @@ namespace UniVRM10 } } + /// + /// $"{assetPath without extension}.{folderName}" + /// + /// + /// + /// + static string GetAndCreateFolder(string assetPath, string suffix) + { + var path = $"{Path.GetDirectoryName(assetPath)}/{Path.GetFileNameWithoutExtension(assetPath)}{suffix}"; + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + return path; + } + /// /// SubAssetを外部ファイルに展開する /// @@ -65,14 +80,9 @@ namespace UniVRM10 return; } - var path = $"{Path.GetDirectoryName(importer.assetPath)}/{Path.GetFileNameWithoutExtension(importer.assetPath)}.Extracted"; - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - // meta { + var path = GetAndCreateFolder(importer.assetPath, ".Meta"); foreach (var (key, asset) in importer.GetSubAssets(importer.assetPath)) { asset.ExtractSubAsset($"{path}/{asset.name}.asset", false); @@ -81,12 +91,15 @@ namespace UniVRM10 { // expressions + var path = GetAndCreateFolder(importer.assetPath, ".Expressions"); foreach (var (key, asset) in importer.GetSubAssets(importer.assetPath)) { asset.ExtractSubAsset($"{path}/{asset.name}.asset", false); } - + } + { // expressions + var path = GetAndCreateFolder(importer.assetPath, ".ExpressionAvatar"); foreach (var (key, asset) in importer.GetSubAssets(importer.assetPath)) { asset.ExtractSubAsset($"{path}/{asset.name}.asset", false);