Pārlūkot izejas kodu

Include .arm converter

unknown 6 gadi atpakaļ
vecāks
revīzija
0b84ef2c75
2 mainītis faili ar 34 papildinājumiem un 0 dzēšanām
  1. 33 0
      Sources/arm/ui/TabPlugins.hx
  2. 1 0
      Sources/arm/ui/UITrait.hx

+ 33 - 0
Sources/arm/ui/TabPlugins.hx

@@ -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 - 0
Sources/arm/ui/UITrait.hx

@@ -1145,6 +1145,7 @@ class UITrait {
 			}
 			if (ui.window(hwnd2, tabx, tabh * 2, windowW, tabh)) {
 				TabTextures.draw();
+				TabMeshes.draw();
 				TabViewport.draw();
 			}
 		}