MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Delete

Method Delete

Source/Editor/SceneGraph/Actors/TerrainNode.cs:36–68  ·  view source on GitHub ↗

()

Source from the content-addressed store, hash-verified

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 {

Callers 1

OnRequestingExitMethod · 0.45

Calls 2

GetPatchMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected