From 3cf971e907100469a2b6e2e9e0ee56de9a4c0192 Mon Sep 17 00:00:00 2001 From: Matthias Brenner Date: Wed, 23 Mar 2022 16:39:21 +0100 Subject: [PATCH] Added ExportSetting to allow HideFlags --- Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs | 8 ++++++++ .../UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs index b29f85d82..b35cfe965 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfExportSettings.cs @@ -1,6 +1,7 @@ using System; +using UnityEngine; namespace UniGLTF { @@ -45,5 +46,12 @@ namespace UniGLTF /// Keep VertexColor /// public bool KeepVertexColor; + + /// + /// https://github.com/vrm-c/UniVRM/issues/1582 + /// + /// Allowed hide flags for MeshFilters to be exported + /// + public HideFlags MeshFilterAllowedHideFlags = HideFlags.None; } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs index be80eba52..952cb37f2 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshExportInfo.cs @@ -202,7 +202,7 @@ namespace UniGLTF else if (renderer is MeshRenderer mr) { var filter = mr.GetComponent(); - if (filter != null && filter.hideFlags == HideFlags.None) + if (filter != null && settings.MeshFilterAllowedHideFlags.HasFlag(filter.hideFlags)) { if (filter.sharedMesh != null && filter.sharedMesh.vertexCount > 0) {