Include .arm converter

This commit is contained in:
unknown
2019-08-18 15:38:19 +02:00
parent cc691becec
commit 0b84ef2c75
2 changed files with 34 additions and 0 deletions
+33
View File
@@ -1,6 +1,10 @@
package arm.ui;
import haxe.io.Bytes;
import haxe.Json;
import zui.Id;
import iron.data.Data;
import iron.system.ArmPack;
class TabPlugins{
@@ -12,6 +16,35 @@ class TabPlugins{
}
ui.separator();
if (ui.panel(Id.handle({selected: false}), "Convert", 1)) {
ui.row([1/2, 1/2]);
if (ui.button(".arm to .json")) {
UIFiles.show = true;
UIFiles.isSave = false;
UIFiles.filters = "arm";
UIFiles.filesDone = function(path:String) {
Data.getBlob(path, function(b:kha.Blob) {
var parsed = ArmPack.decode(b.bytes);
var out = Bytes.ofString(Json.stringify(parsed, null, " ")).getData();
Krom.fileSaveBytes(path.substr(0, path.length - 3) + "json", out);
});
}
}
if (ui.button(".json to .arm")) {
UIFiles.show = true;
UIFiles.isSave = false;
UIFiles.filters = "json";
UIFiles.filesDone = function(path:String) {
Data.getBlob(path, function(b:kha.Blob) {
var parsed = Json.parse(b.toString());
var out = ArmPack.encode(parsed).getData();
Krom.fileSaveBytes(path.substr(0, path.length - 4) + "arm", out);
});
}
}
}
ui.separator();
// Draw plugins
for (p in Plugin.plugins) if (p.drawUI != null) p.drawUI(ui);
}
+1
View File
@@ -1145,6 +1145,7 @@ class UITrait {
}
if (ui.window(hwnd2, tabx, tabh * 2, windowW, tabh)) {
TabTextures.draw();
TabMeshes.draw();
TabViewport.draw();
}
}