Include .arm converter
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1145,6 +1145,7 @@ class UITrait {
|
||||
}
|
||||
if (ui.window(hwnd2, tabx, tabh * 2, windowW, tabh)) {
|
||||
TabTextures.draw();
|
||||
TabMeshes.draw();
|
||||
TabViewport.draw();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user