diff --git a/Assets/UniGLTF/Editor/MeshUtility/TabMeshIntegrator.cs b/Assets/UniGLTF/Editor/MeshUtility/TabMeshIntegrator.cs index 7b8d8c8cf..95c19948b 100644 --- a/Assets/UniGLTF/Editor/MeshUtility/TabMeshIntegrator.cs +++ b/Assets/UniGLTF/Editor/MeshUtility/TabMeshIntegrator.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.IO; using UniGLTF.M17N; using UnityEditor; using UnityEngine; @@ -48,6 +49,21 @@ namespace UniGLTF.MeshUtility return false; } + const string ASSET_SUFFIX = ".mesh.asset"; + + static string GetMeshWritePath(Mesh mesh) + { + if (!string.IsNullOrEmpty((AssetDatabase.GetAssetPath(mesh)))) + { + var directory = Path.GetDirectoryName(AssetDatabase.GetAssetPath(mesh)).Replace("\\", "/"); + return $"{directory}/{Path.GetFileNameWithoutExtension(mesh.name)}{ASSET_SUFFIX}"; + } + else + { + return $"Assets/{Path.GetFileNameWithoutExtension(mesh.name)}{ASSET_SUFFIX}"; + } + } + /// GameObject instance in scene or prefab public static bool Execute(GameObject src, bool onlyBlendShapeRenderers) { @@ -75,7 +91,7 @@ namespace UniGLTF.MeshUtility foreach (var result in results) { var mesh = result.IntegratedRenderer.sharedMesh; - var assetPath = MeshIntegratorUtility.GetMeshWritePath(mesh); + var assetPath = GetMeshWritePath(mesh); Debug.LogFormat("CreateAsset: {0}", assetPath); AssetDatabase.CreateAsset(mesh, assetPath); } diff --git a/Assets/UniGLTF/Runtime/MeshUtility/MeshIntegratorUtility.cs b/Assets/UniGLTF/Runtime/MeshUtility/MeshIntegratorUtility.cs index 49958e176..7050bcb99 100644 --- a/Assets/UniGLTF/Runtime/MeshUtility/MeshIntegratorUtility.cs +++ b/Assets/UniGLTF/Runtime/MeshUtility/MeshIntegratorUtility.cs @@ -1,14 +1,11 @@ using System.Collections.Generic; using System.IO; -using UnityEditor; using UnityEngine; namespace UniGLTF.MeshUtility { public static class MeshIntegratorUtility { - const string ASSET_SUFFIX = ".mesh.asset"; - /// /// go を root としたヒエラルキーから Renderer を集めて、統合された Mesh 作成する /// @@ -183,18 +180,5 @@ namespace UniGLTF.MeshUtility result.IntegratedRenderer.transform.SetParent(copy.transform, false); } } - - public static string GetMeshWritePath(Mesh mesh) - { - if (!string.IsNullOrEmpty((AssetDatabase.GetAssetPath(mesh)))) - { - var directory = Path.GetDirectoryName(AssetDatabase.GetAssetPath(mesh)).Replace("\\", "/"); - return $"{directory}/{Path.GetFileNameWithoutExtension(mesh.name)}{ASSET_SUFFIX}"; - } - else - { - return $"Assets/{Path.GetFileNameWithoutExtension(mesh.name)}{ASSET_SUFFIX}"; - } - } } } \ No newline at end of file diff --git a/Assets/VRM/Runtime/BlendShape/BlendShapeClip.cs b/Assets/VRM/Runtime/BlendShape/BlendShapeClip.cs index 481383512..8eff7633f 100644 --- a/Assets/VRM/Runtime/BlendShape/BlendShapeClip.cs +++ b/Assets/VRM/Runtime/BlendShape/BlendShapeClip.cs @@ -183,7 +183,9 @@ namespace VRM Values = src.Values.ToArray(); Preset = src.Preset; name = src.name; +#if UNITY_EDITOR Prefab = src.Prefab; +#endif } } } diff --git a/Assets/VRM_Samples/BlendShapeMenu/BlendShapeMenu.cs b/Assets/VRM_Samples/BlendShapeMenu/BlendShapeMenu.cs index 7cbdc8ee4..096b9ccc0 100644 --- a/Assets/VRM_Samples/BlendShapeMenu/BlendShapeMenu.cs +++ b/Assets/VRM_Samples/BlendShapeMenu/BlendShapeMenu.cs @@ -78,6 +78,7 @@ namespace VRM.Sample.BlendShapeMenu return "Assets" + src.Substring(Application.dataPath.Length); } +#if UNITY_EDITOR [MenuItem("CONTEXT/BlendShapeAvatar/Add ARKit FaceTracking BlendShapes")] public static void AddARKitFaceTrackingBlendShapes(MenuCommand command) { @@ -176,5 +177,6 @@ namespace VRM.Sample.BlendShapeMenu Debug.Log($"Assign\n" + sb.ToString()); } +#endif } }