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); }