Skip to content

Commit c8015d5

Browse files
committed
Allow to save assets as text.
1 parent d843dec commit c8015d5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Murder.Editor/EditorScene_Editors.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Murder.Serialization;
1111
using Murder.Utilities;
1212
using System.Collections.Immutable;
13+
using System.IO;
1314
using System.Numerics;
1415

1516
namespace Murder.Editor
@@ -237,6 +238,21 @@ private void DrawSelectedAsset(GameAsset asset)
237238
}
238239
}
239240

241+
if (asset.IsSavePacked)
242+
{
243+
ImGui.SameLine();
244+
if (ImGui.Button("Save as Text"))
245+
{
246+
string outputPath = Path.GetTempPath();
247+
string outputFile = Path.Combine(Path.GetTempPath(), "save.json");
248+
249+
_ = Game.Data.FileManager.SaveSerializedAsync(asset, outputFile);
250+
251+
GameLogger.Log($"Saved asset at {outputFile}.");
252+
EditorFileManager.OpenFolder(outputPath);
253+
}
254+
}
255+
240256
ImGui.SameLine();
241257
if (ImGui.Button("Discard Changes"))
242258
{

0 commit comments

Comments
 (0)