mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-10 12:59:17 -05:00
ビルドエラー(runtime への UnityEditor 漏れ出し)を修正
This commit is contained in:
@@ -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}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <param name="src">GameObject instance in scene or prefab</param>
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
/// <summary>
|
||||
/// go を root としたヒエラルキーから Renderer を集めて、統合された Mesh 作成する
|
||||
/// </summary>
|
||||
@@ -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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,9 @@ namespace VRM
|
||||
Values = src.Values.ToArray();
|
||||
Preset = src.Preset;
|
||||
name = src.name;
|
||||
#if UNITY_EDITOR
|
||||
Prefab = src.Prefab;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user