public async Task SaveAsync(string path) { var editor = await TerrainEditor.OpenEmptyAsync(new TerrainSettings { Size = Size, DefaultHeight = DefaultHeight }); editor.Load(); var heightBrush = new HeightBrush(editor); if (Heights != default) { foreach (var height in Heights) { heightBrush.Size = height.Size; heightBrush.Power = height.Power; heightBrush.Apply(height.Position); } } if (Colors != default) { var colorBrush = new ColorBrush(editor); foreach (var color in Colors) { colorBrush.Size = color.Size; colorBrush.Color = color.Color; colorBrush.Apply(color.Position); } } editor.Apply(); if (File.Exists(LightMap)) { Console.WriteLine($"Applying light map."); var data = await File.ReadAllBytesAsync(LightMap); foreach (var chunk in editor.Source.Chunks) { chunk.Lightmap.Data = data; } } if (File.Exists(BlendMap)) { Console.WriteLine($"Applying blend map."); var data = await File.ReadAllBytesAsync(BlendMap); foreach (var chunk in editor.Source.Chunks) { chunk.Blendmap.Data = data; } } await editor.SaveAsync(Path.Combine(path, FileName)); }