From f6a005d6759e9de97434ef75d2da336c45931aad Mon Sep 17 00:00:00 2001 From: dkavolis <12998363+dkavolis@users.noreply.github.com> Date: Tue, 24 Nov 2020 18:33:22 +0000 Subject: [PATCH] always ignore meshes in transparent layer --- .../FARPartGeometry/GeometryPartModule.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs b/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs index 16a27ed46..6f586f9ec 100644 --- a/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs +++ b/FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs @@ -334,7 +334,18 @@ internal void RebuildAllMeshData() private bool IgnoredPredicate(Transform t) { - return ignoredTransforms.Contains(t.name); + if (ignoredTransforms.Contains(t.name)) + return true; + + if (t.gameObject.layer != ignoreLayer0) + { + Transform prefabTransform = part.partInfo.partPrefab.FindModelTransform(t.gameObject.name); + if (prefabTransform is null || prefabTransform.gameObject.layer != ignoreLayer0) + return false; + } + + FARLogger.DebugFormat("Ignoring {0}.{1} for voxelization: layer is ignored", part.name, t.gameObject.name); + return true; } private Bounds SetBoundsFromMeshes() @@ -735,9 +746,6 @@ private MeshData GetVisibleMeshData(Transform t, bool skipIfNoRenderer, bool onl if (part.Modules.Contains() || part.Modules.Contains()) return new MeshData(m.vertices, m.triangles, m.bounds); - Transform prefabTransform = part.partInfo.partPrefab.FindModelTransform(t.gameObject.name); - if (!(prefabTransform is null) && prefabTransform.gameObject.layer == ignoreLayer0) - return null; return new MeshData(m.vertices, m.triangles, m.bounds); }