From 6c5e8c0f533f89faa702ea0ffbcfe7b477aaf8a5 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 May 2020 12:39:37 +0900 Subject: [PATCH 1/3] skip BlendShapeBind if render is not active #398 --- .../Scripts/Format/glTF_VRMExtensions.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs b/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs index da96c1ca3..28be28847 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs @@ -19,8 +19,22 @@ namespace VRM { var transform = UniGLTF.UnityExtensions.GetFromPath(root.transform, binding.RelativePath); var renderer = transform.GetComponent(); + if (renderer == null) + { + return null; + } + + if(!renderer.gameObject.activeInHierarchy) + { + return null; + } + var mesh = renderer.sharedMesh; var meshIndex = meshes.IndexOf(mesh); + if (meshIndex == -1) + { + return null; + } return new glTF_VRM_BlendShapeBind { @@ -36,7 +50,16 @@ namespace VRM var list = new List(); if (clip.Values != null) { - list.AddRange(clip.Values.Select(y => Create(transform, meshes.ToList(), y))); + foreach (var value in clip.Values) + { + var bind = Create(transform, meshes, value); + if (bind == null) + { + Debug.LogFormat("{0}: skip blendshapebind", clip.name); + continue; + } + list.Add(bind); + } } var materialList = new List(); From e7650d27811c7432c75b0d38e54b188a964814f9 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 May 2020 12:43:51 +0900 Subject: [PATCH 2/3] debug comment --- Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs b/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs index 28be28847..b708500f2 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs @@ -55,7 +55,7 @@ namespace VRM var bind = Create(transform, meshes, value); if (bind == null) { - Debug.LogFormat("{0}: skip blendshapebind", clip.name); + // Debug.LogFormat("{0}: skip blendshapebind", clip.name); continue; } list.Add(bind); From 5ab31ebc6cbdc82ea54cfff8a4adb28777523b27 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 May 2020 13:09:13 +0900 Subject: [PATCH 3/3] =?UTF-8?q?active=20=E3=81=AA=20mesh=20=E3=81=8C=200?= =?UTF-8?q?=20=E3=81=AE=E3=81=A8=E3=81=8D=E3=81=AB=20export=20=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs | 12 ++++++++++++ .../VRM/UniVRM/Scripts/Format/VRMExportSettings.cs | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs b/Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs index a172a48f9..eab7a87a1 100644 --- a/Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs +++ b/Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs @@ -25,6 +25,18 @@ namespace VRM wiz.OnWizardUpdate(); } + void OnEnable() + { + // Debug.Log("OnEnable"); + EditorApplication.hierarchyWindowChanged += OnWizardUpdate; + } + + void OnDisable() + { + // Debug.Log("OnDisable"); + EditorApplication.hierarchyWindowChanged -= OnWizardUpdate; + } + void OnWizardCreate() { // save dialog diff --git a/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs b/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs index cf3ec51c0..810569848 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs @@ -83,6 +83,11 @@ namespace VRM { yield return "ReduceBlendshapeSize is need VRMBlendShapeProxy, you need to convert to VRM once."; } + + if(Source.GetComponentsInChildren().All(x => !x.gameObject.activeInHierarchy)) + { + yield return "No active mesh"; + } } public void InitializeFrom(GameObject go)