public void StripPolyCache() { if (Attach is ChunkAttach attach && attach.Poly != null) { for (int i = 0; i < attach.Poly.Count; i++) { switch (attach.Poly[i].Type) { case ChunkType.Bits_CachePolygonList: PolyCache[((PolyChunkBitsCachePolygonList)attach.Poly[i]).List] = attach.Poly.Skip(i + 1).ToList(); attach.Poly = attach.Poly.Take(i).ToList(); break; case ChunkType.Bits_DrawPolygonList: int list = ((PolyChunkBitsDrawPolygonList)attach.Poly[i]).List; attach.Poly.RemoveAt(i); attach.Poly.InsertRange(i--, PolyCache[list]); break; } } if (attach.Poly.Count == 0) { attach.Poly = null; attach.PolyName = null; } } foreach (NJS_OBJECT child in Children) { child.StripPolyCache(); } if (Parent == null && Sibling != null) { Sibling.StripPolyCache(); } }