()
| 34 | |
| 35 | /// <inheritdoc /> |
| 36 | public override void Delete() |
| 37 | { |
| 38 | // Schedule terrain data files for automatic cleanup |
| 39 | if (_cleanupFiles == null) |
| 40 | { |
| 41 | _cleanupFiles = new List<RemovedTerrain>(); |
| 42 | Engine.RequestingExit += OnRequestingExit; |
| 43 | } |
| 44 | if (Actor is Terrain terrain) |
| 45 | { |
| 46 | var removed = new RemovedTerrain |
| 47 | { |
| 48 | SceneId = terrain.Scene?.ID ?? Guid.Empty, |
| 49 | TerrainId = terrain.ID, |
| 50 | Files = new string[4], |
| 51 | }; |
| 52 | for (int i = 0; i < terrain.PatchesCount; i++) |
| 53 | { |
| 54 | var patch = terrain.GetPatch(i); |
| 55 | if (patch.Heightmap) |
| 56 | removed.Files[0] = patch.Heightmap.Path; |
| 57 | if (patch.Heightfield) |
| 58 | removed.Files[1] = patch.Heightfield.Path; |
| 59 | if (patch.GetSplatmap(0)) |
| 60 | removed.Files[2] = patch.GetSplatmap(0).Path; |
| 61 | if (patch.GetSplatmap(1)) |
| 62 | removed.Files[3] = patch.GetSplatmap(1).Path; |
| 63 | } |
| 64 | _cleanupFiles.Add(removed); |
| 65 | } |
| 66 | |
| 67 | base.Delete(); |
| 68 | } |
| 69 | |
| 70 | void OnRequestingExit() |
| 71 | { |
no test coverage detected