mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-11 05:19:14 -05:00
Merge pull request #529 from ousttrue/fix/fix_export_meta
初回Export時のmeta受け渡し方法を修正
This commit is contained in:
@@ -16,12 +16,12 @@ namespace VRM
|
||||
/// </summary>
|
||||
/// <param name="path">出力先</param>
|
||||
/// <param name="settings">エクスポート設定</param>
|
||||
public static void Export(string path, GameObject exportRoot, VRMExportSettings settings)
|
||||
public static void Export(string path, GameObject exportRoot, VRMMetaObject meta, VRMExportSettings settings)
|
||||
{
|
||||
List<GameObject> destroy = new List<GameObject>();
|
||||
try
|
||||
{
|
||||
Export(path, exportRoot, settings, destroy);
|
||||
Export(path, exportRoot, meta, settings, destroy);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -136,7 +136,7 @@ namespace VRM
|
||||
/// <param name="path"></param>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="destroy">作業が終わったらDestoryするべき一時オブジェクト</param>
|
||||
static void Export(string path, GameObject exportRoot, VRMExportSettings settings, List<GameObject> destroy)
|
||||
static void Export(string path, GameObject exportRoot, VRMMetaObject meta, VRMExportSettings settings, List<GameObject> destroy)
|
||||
{
|
||||
var target = exportRoot;
|
||||
|
||||
@@ -144,6 +144,18 @@ namespace VRM
|
||||
target = GameObject.Instantiate(target);
|
||||
destroy.Add(target);
|
||||
|
||||
var metaBehaviour = target.GetComponent<VRMMeta>();
|
||||
if (metaBehaviour == null)
|
||||
{
|
||||
metaBehaviour = target.AddComponent<VRMMeta>();
|
||||
metaBehaviour.Meta = meta;
|
||||
}
|
||||
if (metaBehaviour.Meta == null)
|
||||
{
|
||||
// 来ないはず
|
||||
throw new Exception("meta required");
|
||||
}
|
||||
|
||||
{
|
||||
// copy元
|
||||
var animator = exportRoot.GetComponent<Animator>();
|
||||
|
||||
@@ -695,20 +695,7 @@ namespace VRM
|
||||
m_lastExportDir = Path.GetDirectoryName(path).Replace("\\", "/");
|
||||
|
||||
// export
|
||||
if (Meta == null)
|
||||
{
|
||||
var metaB = ExportRoot.GetComponent<VRMMeta>();
|
||||
if (metaB == null)
|
||||
{
|
||||
metaB = ExportRoot.AddComponent<VRMMeta>();
|
||||
}
|
||||
metaB.Meta = m_tmpMeta;
|
||||
}
|
||||
VRMEditorExporter.Export(path, ExportRoot, m_settings);
|
||||
if (Meta == null)
|
||||
{
|
||||
UnityEngine.GameObject.DestroyImmediate(ExportRoot.GetComponent<VRMMeta>());
|
||||
}
|
||||
VRMEditorExporter.Export(path, ExportRoot, Meta != null ? Meta : m_tmpMeta, m_settings);
|
||||
}
|
||||
|
||||
void OnWizardUpdate()
|
||||
|
||||
Reference in New Issue
Block a user