From 5a2ed85b3d3111bc9502e0bc66a969d6a25d8bab Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 17 Aug 2020 16:00:36 +0900 Subject: [PATCH] =?UTF-8?q?NO=5FACTIVE=5FMESH=20=E3=81=AE=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniVRM/Editor/Format/VRMExporterWizard.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs b/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs index d1c74ef03..b498f9463 100644 --- a/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs +++ b/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs @@ -181,11 +181,6 @@ namespace VRM } var renderers = ExportRoot.GetComponentsInChildren(); - if (renderers.All(x => !EnableRenderer(x))) - { - yield return Validation.Error(Msg.NO_ACTIVE_MESH); - } - var materials = renderers.SelectMany(x => x.sharedMaterials).Distinct(); foreach (var material in materials) { @@ -373,8 +368,10 @@ namespace VRM } EditorGUILayout.LabelField("ExportRoot"); - var root = (GameObject)EditorGUILayout.ObjectField(ExportRoot, typeof(GameObject), true); - UpdateRoot(root); + { + var root = (GameObject)EditorGUILayout.ObjectField(ExportRoot, typeof(GameObject), true); + UpdateRoot(root); + } // // ここでも validate している。ここで失敗して return した場合は Export UI を表示しない @@ -383,21 +380,29 @@ namespace VRM // // root // - if (root == null) + if (ExportRoot == null) { Validation.Error(Msg.ROOT_EXISTS).DrawGUI(); return; } - if (root.transform.parent != null) + if (ExportRoot.transform.parent != null) { Validation.Error(Msg.NO_PARENT).DrawGUI(); return; } - if (root.transform.localRotation != Quaternion.identity || root.transform.localScale != Vector3.one) + if (ExportRoot.transform.localRotation != Quaternion.identity || ExportRoot.transform.localScale != Vector3.one) { Validation.Error(Msg.ROOT_WITHOUT_ROTATION_AND_SCALING_CHANGED).DrawGUI(); return; } + + var renderers = ExportRoot.GetComponentsInChildren(); + if (renderers.All(x => !EnableRenderer(x))) + { + Validation.Error(Msg.NO_ACTIVE_MESH).DrawGUI(); + return; + } + if (HasRotationOrScale(ExportRoot)) { if (m_settings.PoseFreeze) @@ -424,7 +429,7 @@ namespace VRM // // animator // - var animator = root.GetComponent(); + var animator = ExportRoot.GetComponent(); if (animator == null) { Validation.Error(Msg.NO_ANIMATOR).DrawGUI();