From a57e787bcb5ad4f3a17f6c439b48f32fd95638ea Mon Sep 17 00:00:00 2001 From: luboslenco Date: Wed, 13 Dec 2023 09:28:06 +0100 Subject: [PATCH] Cleanup --- armorlab/Sources/arm/logic/TextToPhotoNode.hx | 4 +- .../Sources/arm/render/RenderPathPaint.hx | 4 +- armorlab/Sources/arm/ui/UINodesExt.hx | 4 +- armorpaint/Sources/arm/logic/InputNode.hx | 27 ++++----- .../Sources/arm/render/RenderPathPaint.hx | 15 ++--- armorpaint/Sources/arm/ui/TabLayers.hx | 35 ++++++------ armorsculpt/Sources/arm/io/ImportMesh.hx | 4 +- armorsculpt/Sources/arm/ui/TabLayers.hx | 2 +- base/Sources/Main.hx | 13 +++-- base/Sources/arm/Args.hx | 5 +- base/Sources/arm/Base.hx | 55 ++++++++++--------- base/Sources/arm/Camera.hx | 17 +++--- base/Sources/arm/Console.hx | 9 +-- base/Sources/arm/Context.hx | 25 +++++---- base/Sources/arm/History.hx | 9 +-- base/Sources/arm/Project.hx | 9 +-- base/Sources/arm/Translator.hx | 3 +- base/Sources/arm/Viewport.hx | 5 +- base/Sources/arm/io/ImportArm.hx | 7 ++- base/Sources/arm/io/ImportBlendMaterial.hx | 3 +- base/Sources/arm/io/ImportFont.hx | 3 +- base/Sources/arm/io/ImportMesh.hx | 5 +- base/Sources/arm/render/RenderPathBase.hx | 3 +- base/Sources/arm/render/UniformsExt.hx | 7 ++- base/Sources/arm/ui/BoxExport.hx | 11 ++-- base/Sources/arm/ui/BoxPreferences.hx | 5 +- base/Sources/arm/ui/BoxProjects.hx | 5 +- base/Sources/arm/ui/TabBrowser.hx | 3 +- base/Sources/arm/ui/TabBrushes.hx | 5 +- base/Sources/arm/ui/TabFonts.hx | 7 ++- base/Sources/arm/ui/TabMaterials.hx | 5 +- base/Sources/arm/ui/UIBase.hx | 27 ++++----- base/Sources/arm/ui/UIFiles.hx | 5 +- base/Sources/arm/ui/UIHeader.hx | 3 +- base/Sources/arm/ui/UIMenubar.hx | 9 +-- base/Sources/arm/ui/UINodes.hx | 17 +++--- base/Sources/arm/ui/UIStatus.hx | 5 +- base/Sources/arm/ui/UIView2D.hx | 7 ++- base/Sources/arm/util/RenderUtil.hx | 11 ++-- 39 files changed, 216 insertions(+), 182 deletions(-) diff --git a/armorlab/Sources/arm/logic/TextToPhotoNode.hx b/armorlab/Sources/arm/logic/TextToPhotoNode.hx index 26c67124..4c27b80c 100644 --- a/armorlab/Sources/arm/logic/TextToPhotoNode.hx +++ b/armorlab/Sources/arm/logic/TextToPhotoNode.hx @@ -197,11 +197,11 @@ class TextToPhotoNode extends LogicNode { } if (counter == (51 - offset)) { - iron.App.removeRender2D(processing); + App.removeRender2D(processing); done(latents); } } - iron.App.notifyOnRender2D(processing); + App.notifyOnRender2D(processing); } static function vaeDecoder(latents: js.lib.Float32Array, upscale: Bool, done: Image->Void) { diff --git a/armorlab/Sources/arm/render/RenderPathPaint.hx b/armorlab/Sources/arm/render/RenderPathPaint.hx index 73811b89..58f7cc2f 100644 --- a/armorlab/Sources/arm/render/RenderPathPaint.hx +++ b/armorlab/Sources/arm/render/RenderPathPaint.hx @@ -186,8 +186,8 @@ class RenderPathPaint { var mx = Context.raw.paintVec.x; var my = 1.0 - Context.raw.paintVec.y; if (Context.raw.brushLocked) { - mx = (Context.raw.lockStartedX - iron.App.x()) / iron.App.w(); - my = 1.0 - (Context.raw.lockStartedY - iron.App.y()) / iron.App.h(); + mx = (Context.raw.lockStartedX - App.x()) / App.w(); + my = 1.0 - (Context.raw.lockStartedY - App.y()) / App.h(); } var radius = Context.raw.brushRadius; drawCursor(mx, my, radius / 3.4); diff --git a/armorlab/Sources/arm/ui/UINodesExt.hx b/armorlab/Sources/arm/ui/UINodesExt.hx index 91a1b9a1..da0ff5d1 100644 --- a/armorlab/Sources/arm/ui/UINodesExt.hx +++ b/armorlab/Sources/arm/ui/UINodesExt.hx @@ -20,7 +20,7 @@ class UINodesExt { function delayIdleSleep(_) { Krom.delayIdleSleep(); } - iron.App.notifyOnRender2D(delayIdleSleep); + App.notifyOnRender2D(delayIdleSleep); var tasks = 1; @@ -29,7 +29,7 @@ class UINodesExt { if (tasks == 0) { Console.progress(null); Context.raw.ddirty = 2; - iron.App.removeRender2D(delayIdleSleep); + App.removeRender2D(delayIdleSleep); #if (krom_direct3d12 || krom_vulkan || krom_metal) arm.render.RenderPathRaytrace.ready = false; diff --git a/armorpaint/Sources/arm/logic/InputNode.hx b/armorpaint/Sources/arm/logic/InputNode.hx index ef6d1eab..dfdac531 100644 --- a/armorpaint/Sources/arm/logic/InputNode.hx +++ b/armorpaint/Sources/arm/logic/InputNode.hx @@ -1,5 +1,6 @@ package arm.logic; +import iron.App; import iron.Input; import iron.Vec4; import zui.Zui.Nodes; @@ -29,7 +30,7 @@ class InputNode extends LogicNode { if (!registered) { registered = true; - iron.App.notifyOnUpdate(update); + App.notifyOnUpdate(update); } } @@ -47,21 +48,21 @@ class InputNode extends LogicNode { decalMask); var mouse = Input.getMouse(); - var paintX = mouse.viewX / iron.App.w(); - var paintY = mouse.viewY / iron.App.h(); + var paintX = mouse.viewX / App.w(); + var paintY = mouse.viewY / App.h(); if (mouse.started()) { - startX = mouse.viewX / iron.App.w(); - startY = mouse.viewY / iron.App.h(); + startX = mouse.viewX / App.w(); + startY = mouse.viewY / App.h(); } var pen = Input.getPen(); if (pen.down()) { - paintX = pen.viewX / iron.App.w(); - paintY = pen.viewY / iron.App.h(); + paintX = pen.viewX / App.w(); + paintY = pen.viewY / App.h(); } if (pen.started()) { - startX = pen.viewX / iron.App.w(); - startY = pen.viewY / iron.App.h(); + startX = pen.viewX / App.w(); + startY = pen.viewY / App.h(); } if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown)) { @@ -102,8 +103,8 @@ class InputNode extends LogicNode { } if (Context.raw.brushLazyRadius > 0) { - var v1 = new Vec4(Context.raw.brushLazyX * iron.App.w(), Context.raw.brushLazyY * iron.App.h(), 0.0); - var v2 = new Vec4(coords.x * iron.App.w(), coords.y * iron.App.h(), 0.0); + var v1 = new Vec4(Context.raw.brushLazyX * App.w(), Context.raw.brushLazyY * App.h(), 0.0); + var v2 = new Vec4(coords.x * App.w(), coords.y * App.h(), 0.0); var d = Vec4.distance(v1, v2); var r = Context.raw.brushLazyRadius * 85; if (d > r) { @@ -113,8 +114,8 @@ class InputNode extends LogicNode { v3.mult(1.0 - Context.raw.brushLazyStep); v3.mult(r); v2.addvecs(v1, v3); - coords.x = v2.x / iron.App.w(); - coords.y = v2.y / iron.App.h(); + coords.x = v2.x / App.w(); + coords.y = v2.y / App.h(); // Parse brush inputs once on next draw Context.raw.painted = -1; } diff --git a/armorpaint/Sources/arm/render/RenderPathPaint.hx b/armorpaint/Sources/arm/render/RenderPathPaint.hx index 7b8599a4..4bc8a901 100644 --- a/armorpaint/Sources/arm/render/RenderPathPaint.hx +++ b/armorpaint/Sources/arm/render/RenderPathPaint.hx @@ -1,5 +1,6 @@ package arm.render; +import iron.App; import iron.Mat4; import iron.Vec4; import iron.MeshObject; @@ -460,8 +461,8 @@ class RenderPathPaint { var _x = Context.raw.paintVec.x; var _y = Context.raw.paintVec.y; if (Context.raw.brushLocked) { - Context.raw.paintVec.x = (Context.raw.lockStartedX - iron.App.x()) / iron.App.w(); - Context.raw.paintVec.y = (Context.raw.lockStartedY - iron.App.y()) / iron.App.h(); + Context.raw.paintVec.x = (Context.raw.lockStartedX - App.x()) / App.w(); + Context.raw.paintVec.y = (Context.raw.lockStartedY - App.y()) / App.h(); } var _lastX = Context.raw.lastPaintVecX; var _lastY = Context.raw.lastPaintVecY; @@ -511,8 +512,8 @@ class RenderPathPaint { var mx = Context.raw.paintVec.x; var my = 1.0 - Context.raw.paintVec.y; if (Context.raw.brushLocked) { - mx = (Context.raw.lockStartedX - iron.App.x()) / iron.App.w(); - my = 1.0 - (Context.raw.lockStartedY - iron.App.y()) / iron.App.h(); + mx = (Context.raw.lockStartedX - App.x()) / App.w(); + my = 1.0 - (Context.raw.lockStartedY - App.y()) / App.h(); } var radius = decalMask ? Context.raw.brushDecalMaskRadius : Context.raw.brushRadius; drawCursor(mx, my, Context.raw.brushNodesRadius * radius / 3.4); @@ -741,9 +742,9 @@ class RenderPathPaint { commandsPaint(); Context.raw.pdirty = 0; if (pushUndoLast) History.paint(); - iron.App.notifyOnInit(_renderFinal); + App.notifyOnInit(_renderFinal); } - iron.App.notifyOnInit(Context.raw.bakeType == BakeDerivative ? _renderDeriv : _renderFinal); + App.notifyOnInit(Context.raw.bakeType == BakeDerivative ? _renderDeriv : _renderFinal); } } else if (Context.raw.bakeType == BakeObjectID) { @@ -830,7 +831,7 @@ class RenderPathPaint { var tw = 0.95 * UIView2D.inst.panScale; var tx = UIView2D.inst.panX / UIView2D.inst.ww; - var ty = UIView2D.inst.panY / iron.App.h(); + var ty = UIView2D.inst.panY / App.h(); m.setIdentity(); m.scale(new Vec4(tw, tw, 1)); m.setLoc(new Vec4(tx, ty, 0)); diff --git a/armorpaint/Sources/arm/ui/TabLayers.hx b/armorpaint/Sources/arm/ui/TabLayers.hx index 5b0004d3..2932cf43 100644 --- a/armorpaint/Sources/arm/ui/TabLayers.hx +++ b/armorpaint/Sources/arm/ui/TabLayers.hx @@ -2,6 +2,7 @@ package arm.ui; import zui.Zui; import zui.Zui.Nodes; +import iron.App; import iron.System; import iron.Time; import iron.Input; @@ -142,7 +143,7 @@ class TabLayers { function _init() { m.toFillLayer(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); Context.raw.layerPreviewDirty = true; History.newFillMask(); Base.updateFillLayers(); @@ -406,7 +407,7 @@ class TabLayers { function _init() { deleteLayer(Context.raw.layer); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } } ui._y -= center; @@ -479,7 +480,7 @@ class TabLayers { l.clear(); Base.updateFillLayers(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } else { Base.setObjectMask(); @@ -747,14 +748,14 @@ class TabLayers { l.isLayer() ? History.toFillLayer() : History.toFillMask(); l.toFillLayer(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (l.fill_layer != null && UIMenu.menuButton(ui, toPaintString)) { function _init() { l.isLayer() ? History.toPaintLayer() : History.toPaintMask(); l.toPaintLayer(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } } @@ -763,7 +764,7 @@ class TabLayers { function _init() { deleteLayer(Context.raw.layer); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } ui.enabled = true; @@ -784,7 +785,7 @@ class TabLayers { Context.raw.layer = l; } } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (l.isMask() && l.fill_layer == null && UIMenu.menuButton(ui, tr("Invert"))) { function _init() { @@ -792,7 +793,7 @@ class TabLayers { History.invertMask(); l.invertMask(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (l.isMask() && UIMenu.menuButton(ui, tr("Apply"))) { function _init() { @@ -803,13 +804,13 @@ class TabLayers { MakeMaterial.parseMeshMaterial(); Context.raw.layersPreviewDirty = true; } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (l.isGroup() && UIMenu.menuButton(ui, tr("Merge Group"))) { function _init() { Base.mergeGroup(l); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } ui.enabled = canMergeDown(l); if (UIMenu.menuButton(ui, tr("Merge Down"))) { @@ -819,7 +820,7 @@ class TabLayers { Base.mergeDown(); if (Context.raw.layer.fill_layer != null) Context.raw.layer.toPaintLayer(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } ui.enabled = true; if (UIMenu.menuButton(ui, tr("Duplicate"))) { @@ -828,7 +829,7 @@ class TabLayers { History.duplicateLayer(); Base.duplicateLayer(l); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } UIMenu.menuFill(ui); @@ -873,7 +874,7 @@ class TabLayers { ui.inlineRadio(Base.bitsHandle, ["8bit", "16bit", "32bit"]); #end if (Base.bitsHandle.changed) { - iron.App.notifyOnInit(Base.setLayerBits); + App.notifyOnInit(Base.setLayerBits); UIMenu.keepOpen = true; } } @@ -890,7 +891,7 @@ class TabLayers { function _init() { Base.updateFillLayers(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIMenu.keepOpen = true; } @@ -906,7 +907,7 @@ class TabLayers { function _init() { Base.updateFillLayers(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIMenu.keepOpen = true; } @@ -922,7 +923,7 @@ class TabLayers { function _init() { Base.updateFillLayers(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIMenu.keepOpen = true; } } @@ -998,7 +999,7 @@ class TabLayers { // Convert from R8 to RGBA32 for tooltip display if (Context.raw.maskPreviewLast != l) { Context.raw.maskPreviewLast = l; - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { Context.raw.maskPreviewRgba32.g2.begin(); Context.raw.maskPreviewRgba32.g2.pipeline = UIView2D.pipe; Context.raw.maskPreviewRgba32.g4.setInt(UIView2D.channelLocation, 1); diff --git a/armorsculpt/Sources/arm/io/ImportMesh.hx b/armorsculpt/Sources/arm/io/ImportMesh.hx index 8c45a7fa..0881d6e1 100644 --- a/armorsculpt/Sources/arm/io/ImportMesh.hx +++ b/armorsculpt/Sources/arm/io/ImportMesh.hx @@ -114,7 +114,7 @@ class ImportMesh { l.unload(); } Base.newLayer(false); - iron.App.notifyOnInit(Base.initLayers); + App.notifyOnInit(Base.initLayers); History.reset(); } @@ -130,7 +130,7 @@ class ImportMesh { UIBase.inst.hwnds[TabSidebar1].redraws = 2; // Wait for addMesh calls to finish - iron.App.notifyOnInit(finishImport); + App.notifyOnInit(finishImport); Base.notifyOnNextFrame(function() { var f32 = new js.lib.Float32Array(Config.getTextureResX() * Config.getTextureResY() * 4); diff --git a/armorsculpt/Sources/arm/ui/TabLayers.hx b/armorsculpt/Sources/arm/ui/TabLayers.hx index 80025c48..b42d39db 100644 --- a/armorsculpt/Sources/arm/ui/TabLayers.hx +++ b/armorsculpt/Sources/arm/ui/TabLayers.hx @@ -290,7 +290,7 @@ class TabLayers { // function _init() { // deleteLayer(Context.raw.layer); // } - // iron.App.notifyOnInit(_init); + // App.notifyOnInit(_init); // } } ui._y -= center; diff --git a/base/Sources/Main.hx b/base/Sources/Main.hx index bae1fbce..9c326773 100644 --- a/base/Sources/Main.hx +++ b/base/Sources/Main.hx @@ -1,5 +1,6 @@ package; +import iron.App; import iron.System; import iron.Object; import iron.Scene; @@ -56,17 +57,17 @@ class Main { public static function start() { if (tasks > 0) return; - iron.App.onResize = Base.onResize; - iron.App.w = Base.w; - iron.App.h = Base.h; - iron.App.x = Base.x; - iron.App.y = Base.y; + App.onResize = Base.onResize; + App.w = Base.w; + App.h = Base.h; + App.x = Base.x; + App.y = Base.y; Config.init(); System.start(Config.getOptions(), function() { if (Config.raw.layout == null) Base.initLayout(); Krom.setApplicationName(Manifest.title); - iron.App.init(function() { + App.init(function() { Scene.setActive("Scene", function(o: Object) { UniformsExt.init(); var path = new RenderPath(); diff --git a/base/Sources/arm/Args.hx b/base/Sources/arm/Args.hx index bdecd99b..c69c683a 100644 --- a/base/Sources/arm/Args.hx +++ b/base/Sources/arm/Args.hx @@ -1,6 +1,7 @@ package arm; import haxe.Json; +import iron.App; import iron.System; import iron.Data; import arm.sys.Path; @@ -101,7 +102,7 @@ class Args { public static function run() { if (useArgs) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { if (Project.filepath != "") { ImportArm.runProject(Project.filepath); } @@ -174,7 +175,7 @@ class Args { function _init() { ExportTexture.run(exportTexturesPath); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } else { Krom.log(tr("Invalid export directory")); diff --git a/base/Sources/arm/Base.hx b/base/Sources/arm/Base.hx index 5c14666e..6f298456 100644 --- a/base/Sources/arm/Base.hx +++ b/base/Sources/arm/Base.hx @@ -3,6 +3,7 @@ package arm; import zui.Zui; import zui.Zui.Theme; import zui.Zui.Nodes; +import iron.App; import iron.System; import iron.Input; import iron.Scene; @@ -211,18 +212,18 @@ class Base { arm.logic.RandomNode.setSeed(Std.int(Time.time() * 4294967295)); #end - iron.App.notifyOnUpdate(update); - iron.App.notifyOnRender2D(UIView2D.inst.render); - iron.App.notifyOnUpdate(UIView2D.inst.update); + App.notifyOnUpdate(update); + App.notifyOnRender2D(UIView2D.inst.render); + App.notifyOnUpdate(UIView2D.inst.update); #if (is_paint || is_sculpt) - iron.App.notifyOnRender2D(UIBase.inst.renderCursor); + App.notifyOnRender2D(UIBase.inst.renderCursor); #end - iron.App.notifyOnUpdate(UINodes.inst.update); - iron.App.notifyOnRender2D(UINodes.inst.render); - iron.App.notifyOnUpdate(UIBase.inst.update); - iron.App.notifyOnRender2D(UIBase.inst.render); - iron.App.notifyOnUpdate(Camera.inst.update); - iron.App.notifyOnRender2D(render); + App.notifyOnUpdate(UINodes.inst.update); + App.notifyOnRender2D(UINodes.inst.render); + App.notifyOnUpdate(UIBase.inst.update); + App.notifyOnRender2D(UIBase.inst.render); + App.notifyOnUpdate(Camera.inst.update); + App.notifyOnRender2D(render); #if (is_paint || is_sculpt) appx = UIToolbar.inst.toolbarw; @@ -412,8 +413,8 @@ class Base { var cam = Scene.active.camera; if (cam.data.raw.ortho != null) { - cam.data.raw.ortho[2] = -2 * (iron.App.h() / iron.App.w()); - cam.data.raw.ortho[3] = 2 * (iron.App.h() / iron.App.w()); + cam.data.raw.ortho[2] = -2 * (App.h() / App.w()); + cam.data.raw.ortho[3] = 2 * (App.h() / App.w()); } cam.buildProjection(); @@ -857,16 +858,16 @@ class Base { public static function notifyOnNextFrame(f: Void->Void) { function _render(_) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { function _update() { - iron.App.notifyOnInit(f); - iron.App.removeUpdate(_update); + App.notifyOnInit(f); + App.removeUpdate(_update); } - iron.App.notifyOnUpdate(_update); + App.notifyOnUpdate(_update); }); - iron.App.removeRender(_render); + App.removeRender(_render); } - iron.App.notifyOnRender(_render); + App.notifyOnRender(_render); } public static function toggleFullscreen() { @@ -936,14 +937,14 @@ class Base { #end #if krom_ios - show2d ? Std.int((iron.App.w() + raw.layout[LayoutNodesW]) * 0.473) : Std.int(iron.App.w() * 0.473), // LayoutNodesW + show2d ? Std.int((App.w() + raw.layout[LayoutNodesW]) * 0.473) : Std.int(App.w() * 0.473), // LayoutNodesW #elseif krom_android - show2d ? Std.int((iron.App.w() + raw.layout[LayoutNodesW]) * 0.473) : Std.int(iron.App.w() * 0.473), + show2d ? Std.int((App.w() + raw.layout[LayoutNodesW]) * 0.473) : Std.int(App.w() * 0.473), #else - show2d ? Std.int((iron.App.w() + raw.layout[LayoutNodesW]) * 0.515) : Std.int(iron.App.w() * 0.515), // Align with ui header controls + show2d ? Std.int((App.w() + raw.layout[LayoutNodesW]) * 0.515) : Std.int(App.w() * 0.515), // Align with ui header controls #end - Std.int(iron.App.h() / 2), // LayoutNodesH + Std.int(App.h() / 2), // LayoutNodesH Std.int(UIStatus.defaultStatusH * raw.window_scale), // LayoutStatusH #if (krom_android || krom_ios) @@ -2047,7 +2048,7 @@ class Base { Context.raw.layer.parent = below.parent; } } - if (clear) iron.App.notifyOnInit(function() { l.clear(); }); + if (clear) App.notifyOnInit(function() { l.clear(); }); Context.raw.layerPreviewDirty = true; return l; } @@ -2058,7 +2059,7 @@ class Base { if (position == -1) position = Project.layers.indexOf(parent); Project.layers.insert(position, l); Context.setLayer(l); - if (clear) iron.App.notifyOnInit(function() { l.clear(); }); + if (clear) App.notifyOnInit(function() { l.clear(); }); Context.raw.layerPreviewDirty = true; return l; } @@ -2081,7 +2082,7 @@ class Base { History.toFillLayer(); l.toFillLayer(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } public static function createImageMask(asset: TAsset) { @@ -2104,11 +2105,11 @@ class Base { l.objectMask = Context.raw.layerFilter; l.clear(baseColor, occlusion, roughness, metallic); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } public static function onLayersResized() { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { Base.resizeLayers(); var _layer = Context.raw.layer; var _material = Context.raw.material; diff --git a/base/Sources/arm/Camera.hx b/base/Sources/arm/Camera.hx index d2eb41ec..58c34490 100644 --- a/base/Sources/arm/Camera.hx +++ b/base/Sources/arm/Camera.hx @@ -1,5 +1,6 @@ package arm; +import iron.App; import iron.Input; import iron.Time; import iron.Vec4; @@ -33,25 +34,25 @@ class Camera { } if (mouse.viewX < 0 || - mouse.viewX > iron.App.w() || + mouse.viewX > App.w() || mouse.viewY < 0 || - mouse.viewY > iron.App.h()) { + mouse.viewY > App.h()) { if (Config.raw.wrap_mouse && controlsDown) { if (mouse.viewX < 0) { - mouse.x = mouse.lastX = iron.App.x() + iron.App.w(); + mouse.x = mouse.lastX = App.x() + App.w(); Krom.setMousePosition(Std.int(mouse.x), Std.int(mouse.y)); } - else if (mouse.viewX > iron.App.w()) { - mouse.x = mouse.lastX = iron.App.x(); + else if (mouse.viewX > App.w()) { + mouse.x = mouse.lastX = App.x(); Krom.setMousePosition(Std.int(mouse.x), Std.int(mouse.y)); } else if (mouse.viewY < 0) { - mouse.y = mouse.lastY = iron.App.y() + iron.App.h(); + mouse.y = mouse.lastY = App.y() + App.h(); Krom.setMousePosition(Std.int(mouse.x), Std.int(mouse.y)); } - else if (mouse.viewY > iron.App.h()) { - mouse.y = mouse.lastY = iron.App.y(); + else if (mouse.viewY > App.h()) { + mouse.y = mouse.lastY = App.y(); Krom.setMousePosition(Std.int(mouse.x), Std.int(mouse.y)); } } diff --git a/base/Sources/arm/Console.hx b/base/Sources/arm/Console.hx index e1603612..b1870cec 100644 --- a/base/Sources/arm/Console.hx +++ b/base/Sources/arm/Console.hx @@ -1,5 +1,6 @@ package arm; +import iron.App; import iron.System; import arm.Base; @@ -31,11 +32,11 @@ class Console { drawToast(s, g); if (g2 == null) { Base.notifyOnNextFrame(function() { - iron.App.removeRender2D(_render); + App.removeRender2D(_render); }); } } - g2 != null ? _render(g2) : iron.App.notifyOnRender2D(_render); + g2 != null ? _render(g2) : App.notifyOnRender2D(_render); consoleTrace(s); } @@ -46,10 +47,10 @@ class Console { public static function progress(s: String) { // Keep popup message displayed until s == null if (s == null) { - iron.App.removeRender2D(drawProgress); + App.removeRender2D(drawProgress); } else if (progressText == null) { - iron.App.notifyOnRender2D(drawProgress); + App.notifyOnRender2D(drawProgress); } if (s != null) consoleTrace(s); progressText = s; diff --git a/base/Sources/arm/Context.hx b/base/Sources/arm/Context.hx index 421ba677..817eb4cf 100644 --- a/base/Sources/arm/Context.hx +++ b/base/Sources/arm/Context.hx @@ -1,5 +1,6 @@ package arm; +import iron.App; import iron.System; import iron.RenderPath; import iron.Scene; @@ -224,10 +225,10 @@ class Context { public static function inPaintArea(): Bool { #if (is_paint || is_sculpt) var mouse = Input.getMouse(); - var right = iron.App.w(); + var right = App.w(); if (UIView2D.inst.show) right += UIView2D.inst.ww; return mouse.viewX > 0 && mouse.viewX < right && - mouse.viewY > 0 && mouse.viewY < iron.App.h(); + mouse.viewY > 0 && mouse.viewY < App.h(); #end #if is_lab @@ -333,7 +334,7 @@ class Context { else { RenderPath.active.commands = RenderPathDeferred.commands; } - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { MakeMaterial.parseMeshMaterial(); }); } @@ -411,7 +412,7 @@ class Context { public static function parseBrushInputs() { if (!raw.registered) { raw.registered = true; - iron.App.notifyOnUpdate(update); + App.notifyOnUpdate(update); } raw.paintVec = raw.coords; @@ -419,21 +420,21 @@ class Context { static function update() { var mouse = Input.getMouse(); - var paintX = mouse.viewX / iron.App.w(); - var paintY = mouse.viewY / iron.App.h(); + var paintX = mouse.viewX / App.w(); + var paintY = mouse.viewY / App.h(); if (mouse.started()) { - raw.startX = mouse.viewX / iron.App.w(); - raw.startY = mouse.viewY / iron.App.h(); + raw.startX = mouse.viewX / App.w(); + raw.startY = mouse.viewY / App.h(); } var pen = Input.getPen(); if (pen.down()) { - paintX = pen.viewX / iron.App.w(); - paintY = pen.viewY / iron.App.h(); + paintX = pen.viewX / App.w(); + paintY = pen.viewY / App.h(); } if (pen.started()) { - raw.startX = pen.viewX / iron.App.w(); - raw.startY = pen.viewY / iron.App.h(); + raw.startX = pen.viewX / App.w(); + raw.startY = pen.viewY / App.h(); } if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown)) { diff --git a/base/Sources/arm/History.hx b/base/Sources/arm/History.hx index df2bebb1..27570f52 100644 --- a/base/Sources/arm/History.hx +++ b/base/Sources/arm/History.hx @@ -3,6 +3,7 @@ package arm; import haxe.Json; import zui.Zui.Nodes; import zui.Zui.TNodeCanvas; +import iron.App; import iron.System; import iron.RenderPath; import arm.sys.Path; @@ -162,7 +163,7 @@ class History { Context.raw.layer = Project.layers[step.layer]; Context.raw.layer.invertMask(); } - iron.App.notifyOnInit(_next); + App.notifyOnInit(_next); } else if (step.name == "Apply Filter") { undoI = undoI - 1 < 0 ? Config.raw.undo_steps - 1 : undoI - 1; @@ -328,8 +329,8 @@ class History { } else if (step.name == tr("Merge Layers")) { Context.raw.layer = Project.layers[step.layer + 1]; - iron.App.notifyOnInit(redoMergeLayers); - iron.App.notifyOnInit(Base.mergeDown); + App.notifyOnInit(redoMergeLayers); + App.notifyOnInit(Base.mergeDown); } else if (step.name == tr("Apply Mask")) { Context.raw.layer = Project.layers[step.layer]; @@ -353,7 +354,7 @@ class History { Context.raw.layer = Project.layers[step.layer]; Context.raw.layer.invertMask(); } - iron.App.notifyOnInit(_next); + App.notifyOnInit(_next); } else if (step.name == tr("Apply Filter")) { var lay = undoLayers[undoI]; diff --git a/base/Sources/arm/Project.hx b/base/Sources/arm/Project.hx index cc988068..da32b01b 100644 --- a/base/Sources/arm/Project.hx +++ b/base/Sources/arm/Project.hx @@ -2,6 +2,7 @@ package arm; import zui.Zui; import zui.Zui.Nodes; +import iron.App; import iron.ArmPack; import iron.MaterialData; import iron.System; @@ -105,7 +106,7 @@ class Project { ExportArm.runProject(); if (saveAndQuit) System.stop(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } public static function projectSaveAs(saveAndQuit = false) { @@ -317,11 +318,11 @@ class Project { layers.push(layer); Context.setLayer(layer); if (aspectRatioChanged) { - iron.App.notifyOnInit(Base.resizeLayers); + App.notifyOnInit(Base.resizeLayers); } #end - iron.App.notifyOnInit(Base.initLayers); + App.notifyOnInit(Base.initLayers); } if (current != null) current.begin(false); @@ -393,7 +394,7 @@ class Project { function _init() { RenderUtil.makeBrushPreview(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } // Import from project file else { diff --git a/base/Sources/arm/Translator.hx b/base/Sources/arm/Translator.hx index 5334e597..88d48c92 100644 --- a/base/Sources/arm/Translator.hx +++ b/base/Sources/arm/Translator.hx @@ -1,6 +1,7 @@ package arm; import haxe.Json; +import iron.App; import iron.System; import iron.Data; import arm.sys.File; @@ -118,7 +119,7 @@ class Translator { static function initFont(cjk: Bool, fontPath: String, fontScale: Float) { Graphics2.fontGlyphs.sort(Reflect.compare); // Load and assign font with cjk characters - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { Data.getFont(fontPath, function(f: Font) { if (cjk) { var fontIndex = cjkFontIndices.exists(Config.raw.locale) ? cjkFontIndices[Config.raw.locale] : 0; diff --git a/base/Sources/arm/Viewport.hx b/base/Sources/arm/Viewport.hx index 220f8c36..058ceba6 100644 --- a/base/Sources/arm/Viewport.hx +++ b/base/Sources/arm/Viewport.hx @@ -1,6 +1,7 @@ package arm; import js.lib.Float32Array; +import iron.App; import iron.Vec4; import iron.Scene; import arm.Camera; @@ -90,8 +91,8 @@ class Viewport { var f = cam.data.raw.fov * cam.transform.world.getLoc().length() / 2.5; f32[0] = -2 * f; f32[1] = 2 * f; - f32[2] = -2 * f * (iron.App.h() / iron.App.w()); - f32[3] = 2 * f * (iron.App.h() / iron.App.w()); + f32[2] = -2 * f * (App.h() / App.w()); + f32[3] = 2 * f * (App.h() / App.w()); cam.data.raw.ortho = f32; light.visible = false; } diff --git a/base/Sources/arm/io/ImportArm.hx b/base/Sources/arm/io/ImportArm.hx index 0afe3c67..00a8fc26 100644 --- a/base/Sources/arm/io/ImportArm.hx +++ b/base/Sources/arm/io/ImportArm.hx @@ -3,6 +3,7 @@ package arm.io; import zui.Zui.Nodes; import zui.Zui.TNodeCanvas; import zui.Zui.TNode; +import iron.App; import iron.System; import iron.MeshData; import iron.Data; @@ -416,7 +417,7 @@ class ImportArm { Viewport.scaleToBounds(); }); } - iron.App.notifyOnInit(Base.initLayers); + App.notifyOnInit(Base.initLayers); History.reset(); } @@ -478,7 +479,7 @@ class ImportArm { RenderUtil.makeMaterialPreview(); } } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); arm.ui.UINodes.inst.groupStack = []; UIBase.inst.hwnds[TabSidebar1].redraws = 2; @@ -549,7 +550,7 @@ class ImportArm { RenderUtil.makeBrushPreview(); } } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIBase.inst.hwnds[TabSidebar1].redraws = 2; Data.deleteBlob(path); diff --git a/base/Sources/arm/io/ImportBlendMaterial.hx b/base/Sources/arm/io/ImportBlendMaterial.hx index af6c18f7..5afc27ad 100644 --- a/base/Sources/arm/io/ImportBlendMaterial.hx +++ b/base/Sources/arm/io/ImportBlendMaterial.hx @@ -1,5 +1,6 @@ package arm.io; +import iron.App; import iron.Data; import zui.Zui.Nodes; import zui.Zui.TNode; @@ -262,7 +263,7 @@ class ImportBlendMaterial { RenderUtil.makeMaterialPreview(); } } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIBase.inst.hwnds[TabSidebar1].redraws = 2; Data.deleteBlob(path); diff --git a/base/Sources/arm/io/ImportFont.hx b/base/Sources/arm/io/ImportFont.hx index 9f4be963..50821284 100644 --- a/base/Sources/arm/io/ImportFont.hx +++ b/base/Sources/arm/io/ImportFont.hx @@ -1,5 +1,6 @@ package arm.io; +import iron.App; import iron.System; import iron.Data; import arm.sys.Path; @@ -36,7 +37,7 @@ class ImportFont { RenderUtil.makeFontPreview(); } } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIBase.inst.hwnds[TabStatus].redraws = 2; }); diff --git a/base/Sources/arm/io/ImportMesh.hx b/base/Sources/arm/io/ImportMesh.hx index c1d22a30..7393c066 100644 --- a/base/Sources/arm/io/ImportMesh.hx +++ b/base/Sources/arm/io/ImportMesh.hx @@ -1,5 +1,6 @@ package arm.io; +import iron.App; import iron.SceneFormat; import iron.MeshData; import iron.Data; @@ -132,7 +133,7 @@ class ImportMesh { l.unload(); } Base.newLayer(false); - iron.App.notifyOnInit(Base.initLayers); + App.notifyOnInit(Base.initLayers); History.reset(); } #end @@ -159,7 +160,7 @@ class ImportMesh { Base.notifyOnNextFrame(finishImport); } else { - iron.App.notifyOnInit(finishImport); + App.notifyOnInit(finishImport); } }); } diff --git a/base/Sources/arm/render/RenderPathBase.hx b/base/Sources/arm/render/RenderPathBase.hx index d96b2fd7..47b4e656 100644 --- a/base/Sources/arm/render/RenderPathBase.hx +++ b/base/Sources/arm/render/RenderPathBase.hx @@ -1,5 +1,6 @@ package arm.render; +import iron.App; import iron.System; import iron.Vec4; import iron.Mat4; @@ -80,7 +81,7 @@ class RenderPathBase { var _loc = compass.transform.loc; var _rot = compass.transform.rot; var crot = cam.transform.rot; - var ratio = iron.App.w() / iron.App.h(); + var ratio = App.w() / App.h(); var _P = cam.P; cam.P = Mat4.ortho(-8 * ratio, 8 * ratio, -8, 8, -2, 2); compass.visible = true; diff --git a/base/Sources/arm/render/UniformsExt.hx b/base/Sources/arm/render/UniformsExt.hx index d5278661..afc8e59d 100644 --- a/base/Sources/arm/render/UniformsExt.hx +++ b/base/Sources/arm/render/UniformsExt.hx @@ -1,5 +1,6 @@ package arm.render; +import iron.App; import iron.System; import iron.MaterialData; import iron.Object; @@ -414,7 +415,7 @@ class UniformsExt { function _init() { UVUtil.cacheUVMap(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } return UVUtil.uvmap; } @@ -423,7 +424,7 @@ class UniformsExt { function _init() { UVUtil.cacheTriangleMap(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } return UVUtil.trianglemap; } @@ -431,7 +432,7 @@ class UniformsExt { function _init() { UVUtil.cacheUVIslandMap(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); return UVUtil.uvislandmapCached ? UVUtil.uvislandmap : RenderPath.active.renderTargets.get("empty_black").image; } case "_texdilatemap": { diff --git a/base/Sources/arm/ui/BoxExport.hx b/base/Sources/arm/ui/BoxExport.hx index dc1e7fd4..b90a441e 100644 --- a/base/Sources/arm/ui/BoxExport.hx +++ b/base/Sources/arm/ui/BoxExport.hx @@ -2,6 +2,7 @@ package arm.ui; import haxe.Json; import zui.Zui; +import iron.App; import iron.System; import iron.Data; import arm.io.ExportMesh; @@ -109,7 +110,7 @@ class BoxExport { #if is_paint if (Base.bitsHandle.changed) { - iron.App.notifyOnInit(Base.setLayerBits); + App.notifyOnInit(Base.setLayerBits); } #end @@ -159,7 +160,7 @@ class BoxExport { ExportTexture.run(Context.raw.textureExportPath); #end } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } else { var filters = Base.bitsHandle.position != Bits8 ? "exr" : Context.raw.formatType == FormatPng ? "png" : "jpg"; @@ -174,7 +175,7 @@ class BoxExport { ExportTexture.run(Context.raw.textureExportPath); #end } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } #if (krom_android || krom_ios) Base.notifyOnNextFrame(function() { @@ -408,7 +409,7 @@ class BoxExport { UIFiles.show("arm", true, false, function(path: String) { var f = UIFiles.filename; if (f == "") f = tr("untitled"); - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { ExportArm.runMaterial(path + Path.sep + f); }); }); @@ -437,7 +438,7 @@ class BoxExport { UIFiles.show("arm", true, false, function(path: String) { var f = UIFiles.filename; if (f == "") f = tr("untitled"); - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { ExportArm.runBrush(path + Path.sep + f); }); }); diff --git a/base/Sources/arm/ui/BoxPreferences.hx b/base/Sources/arm/ui/BoxPreferences.hx index 0ac09e4b..c25fc3be 100644 --- a/base/Sources/arm/ui/BoxPreferences.hx +++ b/base/Sources/arm/ui/BoxPreferences.hx @@ -2,6 +2,7 @@ package arm.ui; import haxe.Json; import zui.Zui; +import iron.App; import iron.System; import iron.Data; import iron.Scene; @@ -101,7 +102,7 @@ class BoxPreferences { if (ui.button(tr("Restore")) && !UIMenu.show) { UIMenu.draw(function(ui: Zui) { if (UIMenu.menuButton(ui, tr("Confirm"))) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { ui.t.ELEMENT_H = Base.defaultElementH; Config.restore(); setScale(); @@ -116,7 +117,7 @@ class BoxPreferences { UIFiles.show("json", false, false, function(path: String) { Data.getBlob(path, function(b: js.lib.ArrayBuffer) { var raw = Json.parse(System.bufferToString(b)); - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { ui.t.ELEMENT_H = Base.defaultElementH; Config.importFrom(raw); setScale(); diff --git a/base/Sources/arm/ui/BoxProjects.hx b/base/Sources/arm/ui/BoxProjects.hx index b6d2bc5a..e294059e 100644 --- a/base/Sources/arm/ui/BoxProjects.hx +++ b/base/Sources/arm/ui/BoxProjects.hx @@ -1,5 +1,6 @@ package arm.ui; +import iron.App; import iron.System; import iron.Data; import zui.Zui; @@ -122,7 +123,7 @@ class BoxProjects { ui.fill(0, 0, 128, 128, 0x66000000); ui._x = _uix; function doImport() { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { UIBox.hide(); ImportArm.runProject(path); }); @@ -143,7 +144,7 @@ class BoxProjects { UIMenu.draw(function(ui: Zui) { // if (UIMenu.menuButton(ui, tr("Duplicate"))) {} if (UIMenu.menuButton(ui, tr("Delete"))) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { arm.sys.File.delete(path); arm.sys.File.delete(iconPath); var dataPath = path.substr(0, path.length - 4); diff --git a/base/Sources/arm/ui/TabBrowser.hx b/base/Sources/arm/ui/TabBrowser.hx index 5efc8173..1c842e06 100644 --- a/base/Sources/arm/ui/TabBrowser.hx +++ b/base/Sources/arm/ui/TabBrowser.hx @@ -1,5 +1,6 @@ package arm.ui; +import iron.App; import iron.Input; import zui.Zui; import arm.sys.File; @@ -168,7 +169,7 @@ class TabBrowser { if (known) { var path = hpath.text; - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { ImportAsset.run(path); }); hpath.text = hpath.text.substr(0, hpath.text.lastIndexOf(Path.sep)); diff --git a/base/Sources/arm/ui/TabBrushes.hx b/base/Sources/arm/ui/TabBrushes.hx index 90e36c8c..9e161692 100644 --- a/base/Sources/arm/ui/TabBrushes.hx +++ b/base/Sources/arm/ui/TabBrushes.hx @@ -3,6 +3,7 @@ package arm.ui; #if (is_paint || is_sculpt) import haxe.Json; +import iron.App; import iron.Time; import zui.Zui; import arm.data.BrushSlot; @@ -97,7 +98,7 @@ class TabBrushes { Context.setBrush(Context.raw.brush); RenderUtil.makeBrushPreview(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (Project.brushes.length > 1 && UIMenu.menuButton(ui, tr("Delete"), "delete")) { @@ -108,7 +109,7 @@ class TabBrushes { if (ui.isHovered) { if (imgFull == null) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { var _brush = Context.raw.brush; Context.raw.brush = Project.brushes[i]; MakeMaterial.parseBrush(); diff --git a/base/Sources/arm/ui/TabFonts.hx b/base/Sources/arm/ui/TabFonts.hx index 68947578..759e32b2 100644 --- a/base/Sources/arm/ui/TabFonts.hx +++ b/base/Sources/arm/ui/TabFonts.hx @@ -3,6 +3,7 @@ package arm.ui; #if (is_paint || is_sculpt) import zui.Zui; +import iron.App; import iron.System; import iron.Time; import iron.Data; @@ -87,7 +88,7 @@ class TabFonts { function _init() { Context.selectFont(i); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (Time.time() - Context.raw.selectTime < 0.25) UIBase.inst.show2DView(View2DFont); Context.raw.selectTime = Time.time(); @@ -104,7 +105,7 @@ class TabFonts { } if (ui.isHovered) { if (img == null) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { var _font = Context.raw.font; Context.raw.font = Project.fonts[i]; RenderUtil.makeFontPreview(); @@ -148,7 +149,7 @@ class TabFonts { Data.deleteFont(Project.fonts[i].file); Project.fonts.splice(i, 1); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); UIBase.inst.hwnds[2].redraws = 2; } } diff --git a/base/Sources/arm/ui/TabMaterials.hx b/base/Sources/arm/ui/TabMaterials.hx index b80fa073..e74c6b17 100644 --- a/base/Sources/arm/ui/TabMaterials.hx +++ b/base/Sources/arm/ui/TabMaterials.hx @@ -5,6 +5,7 @@ package arm.ui; import haxe.Json; import zui.Zui; import zui.Zui.Nodes; +import iron.App; import iron.Time; import iron.Input; import arm.shader.MakeMaterial; @@ -137,7 +138,7 @@ class TabMaterials { function _init() { Base.updateFillLayers(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } #end } @@ -188,7 +189,7 @@ class TabMaterials { updateMaterial(); History.duplicateMaterial(); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } if (Project.materials.length > 1 && UIMenu.menuButton(ui, tr("Delete"), "delete")) { diff --git a/base/Sources/arm/ui/UIBase.hx b/base/Sources/arm/ui/UIBase.hx index 5b96990e..30fa66ed 100644 --- a/base/Sources/arm/ui/UIBase.hx +++ b/base/Sources/arm/ui/UIBase.hx @@ -1,6 +1,7 @@ package arm.ui; import zui.Zui; +import iron.App; import iron.Input; import iron.System; import iron.Data; @@ -218,7 +219,7 @@ class UIBase { Project.paintObjects = [Context.raw.paintObject]; if (Project.filepath == "") { - iron.App.notifyOnInit(Base.initLayers); + App.notifyOnInit(Base.initLayers); } Context.raw.projectObjects = []; @@ -276,7 +277,7 @@ class UIBase { function _init() { ExportTexture.run(Context.raw.textureExportPath); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); } } else if (Operator.shortcut(Config.keymap.file_export_textures_as)) { @@ -484,7 +485,7 @@ class UIBase { #end // Viewpoint - if (mouse.viewX < iron.App.w()) { + if (mouse.viewX < App.w()) { if (Operator.shortcut(Config.keymap.view_reset)) { Viewport.reset(); Viewport.scaleToBounds(); @@ -611,7 +612,7 @@ class UIBase { else { // UINodes / UIView2D ratio Config.raw.layout[LayoutNodesH] -= Std.int(mouse.movementY); if (Config.raw.layout[LayoutNodesH] < 32) Config.raw.layout[LayoutNodesH] = 32; - else if (Config.raw.layout[LayoutNodesH] > iron.App.h() * 0.95) Config.raw.layout[LayoutNodesH] = Std.int(iron.App.h() * 0.95); + else if (Config.raw.layout[LayoutNodesH] > App.h() * 0.95) Config.raw.layout[LayoutNodesH] = Std.int(App.h() * 0.95); } } else if (borderHandle_ptr == hwnds[TabStatus].ptr) { @@ -650,7 +651,7 @@ class UIBase { else { // UINodes / UIView2D ratio Config.raw.layout[LayoutNodesH] -= Std.int(mouse.movementY); if (Config.raw.layout[LayoutNodesH] < 32) Config.raw.layout[LayoutNodesH] = 32; - else if (Config.raw.layout[LayoutNodesH] > iron.App.h() * 0.95) Config.raw.layout[LayoutNodesH] = Std.int(iron.App.h() * 0.95); + else if (Config.raw.layout[LayoutNodesH] > App.h() * 0.95) Config.raw.layout[LayoutNodesH] = Std.int(App.h() * 0.95); } } else if (borderHandle_ptr == hwnds[TabStatus].ptr) { @@ -734,7 +735,7 @@ class UIBase { var mouse = Input.getMouse(); if (Context.inPaintArea() && !isTyping) { - if (mouse.viewX < iron.App.w()) { + if (mouse.viewX < App.w()) { Viewport.setView(0, 0, 1, 0, 0, 0); } } @@ -955,19 +956,19 @@ class UIBase { if (down) { var mx = mouse.viewX; var my = mouse.viewY; - var ww = iron.App.w(); + var ww = App.w(); #if (is_paint || is_sculpt) if (Context.raw.paint2d) { - mx -= iron.App.w(); + mx -= App.w(); ww = UIView2D.inst.ww; } #end if (mx < ww && - mx > iron.App.x() && - my < iron.App.h() && - my > iron.App.y()) { + mx > App.x() && + my < App.h() && + my > App.y()) { if (setCloneSource) { Context.raw.cloneStartX = mx; @@ -990,7 +991,7 @@ class UIBase { if (Context.raw.tool == ToolClone && Context.raw.cloneStartX >= 0.0) { // Clone delta Context.raw.cloneDeltaX = (Context.raw.cloneStartX - mx) / ww; - Context.raw.cloneDeltaY = (Context.raw.cloneStartY - my) / iron.App.h(); + Context.raw.cloneDeltaY = (Context.raw.cloneStartY - my) / App.h(); Context.raw.cloneStartX = -1; } else if (Context.raw.tool == ToolParticle) { @@ -1300,7 +1301,7 @@ class UIBase { var kb = Input.getKeyboard(); if (Context.raw.tool == ToolClone && !kb.down("alt") && (mouse.down() || pen.down())) { g.color = 0x66ffffff; - g.drawScaledImage(cursorImg, mx + Context.raw.cloneDeltaX * iron.App.w() - psize / 2, my + Context.raw.cloneDeltaY * iron.App.h() - psize / 2, psize, psize); + g.drawScaledImage(cursorImg, mx + Context.raw.cloneDeltaX * App.w() - psize / 2, my + Context.raw.cloneDeltaY * App.h() - psize / 2, psize, psize); g.color = 0xffffffff; } diff --git a/base/Sources/arm/ui/UIFiles.hx b/base/Sources/arm/ui/UIFiles.hx index f72f248d..e7278412 100644 --- a/base/Sources/arm/ui/UIFiles.hx +++ b/base/Sources/arm/ui/UIFiles.hx @@ -4,6 +4,7 @@ import zui.Zui; import iron.System; import iron.Input; import iron.Input; +import iron.App; import iron.Time; import iron.ArmPack; import iron.Lz4; @@ -173,7 +174,7 @@ class UIFiles { File.cacheCloud(handle.text + Path.sep + iconFile, function(abs: String) { if (abs != null) { Data.getImage(abs, function(image: Image) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { if (Base.pipeCopyRGB == null) Base.makePipeCopyRGB(); icon = Image.createRenderTarget(image.width, image.height); if (f.endsWith(".arm")) { // Used for material sphere alpha cutout @@ -281,7 +282,7 @@ class UIFiles { var empty = RenderPath.active.renderTargets.get("empty_black").image; iconMap.set(handle, empty); Data.getImage(handle, function(image: Image) { - iron.App.notifyOnInit(function() { + App.notifyOnInit(function() { if (Base.pipeCopyRGB == null) Base.makePipeCopyRGB(); var sw = image.width > image.height ? w : Std.int(1.0 * image.width / image.height * w); var sh = image.width > image.height ? Std.int(1.0 * image.height / image.width * w) : w; diff --git a/base/Sources/arm/ui/UIHeader.hx b/base/Sources/arm/ui/UIHeader.hx index a187b4f3..3aa197a7 100644 --- a/base/Sources/arm/ui/UIHeader.hx +++ b/base/Sources/arm/ui/UIHeader.hx @@ -1,6 +1,7 @@ package arm.ui; import zui.Zui; +import iron.App; import iron.System; import iron.Input; import iron.ConstData; @@ -45,7 +46,7 @@ class UIHeader { var ww = System.width - UIToolbar.inst.toolbarw - Config.raw.layout[LayoutSidebarW] - nodesw; #end - if (ui.window(headerHandle, iron.App.x(), headerh, ww, headerh)) { + if (ui.window(headerHandle, App.x(), headerh, ww, headerh)) { ui._y += 2; drawToolProperties(ui); } diff --git a/base/Sources/arm/ui/UIMenubar.hx b/base/Sources/arm/ui/UIMenubar.hx index 60d63818..6862532f 100644 --- a/base/Sources/arm/ui/UIMenubar.hx +++ b/base/Sources/arm/ui/UIMenubar.hx @@ -1,6 +1,7 @@ package arm.ui; import zui.Zui; +import iron.App; import iron.System; import iron.Mat4; import iron.Scene; @@ -28,10 +29,10 @@ class UIMenubar { var ui = UIBase.inst.ui; #if (is_paint || is_sculpt) - var panelx = iron.App.x() - UIToolbar.inst.toolbarw; + var panelx = App.x() - UIToolbar.inst.toolbarw; #end #if is_lab - var panelx = iron.App.x(); + var panelx = App.x(); #end if (ui.window(menuHandle, panelx, 0, menubarw, UIHeader.headerh)) { @@ -100,10 +101,10 @@ class UIMenubar { var nodesw = (UINodes.inst.show || UIView2D.inst.show) ? Config.raw.layout[LayoutNodesW] : 0; #if (is_paint || is_sculpt) var ww = System.width - Config.raw.layout[LayoutSidebarW] - menubarw - nodesw; - var panelx = (iron.App.x() - UIToolbar.inst.toolbarw) + menubarw; + var panelx = (App.x() - UIToolbar.inst.toolbarw) + menubarw; #else var ww = System.width - menubarw - nodesw; - var panelx = (iron.App.x()) + menubarw; + var panelx = (App.x()) + menubarw; #end if (ui.window(workspaceHandle, panelx, 0, ww, UIHeader.headerh)) { diff --git a/base/Sources/arm/ui/UINodes.hx b/base/Sources/arm/ui/UINodes.hx index af1eb3d2..7ff1c44c 100644 --- a/base/Sources/arm/ui/UINodes.hx +++ b/base/Sources/arm/ui/UINodes.hx @@ -3,6 +3,7 @@ package arm.ui; import haxe.Json; import zui.Zui; import zui.Zui.Nodes; +import iron.App; import iron.Input; import iron.System; import iron.Input; @@ -474,15 +475,15 @@ class UINodes { var kb = Input.getKeyboard(); #if (is_paint || is_sculpt) - wx = Std.int(iron.App.w()) + UIToolbar.inst.toolbarw; + wx = Std.int(App.w()) + UIToolbar.inst.toolbarw; #end #if is_lab - wx = Std.int(iron.App.w()); + wx = Std.int(App.w()); #end wy = UIHeader.headerh * 2; if (UIView2D.inst.show) { - wy += iron.App.h() - Config.raw.layout[LayoutNodesH]; + wy += App.h() - Config.raw.layout[LayoutNodesH]; } var ww = Config.raw.layout[LayoutNodesW]; @@ -617,7 +618,7 @@ class UINodes { } #end - var wh = iron.App.h(); + var wh = App.h(); var step = 100 * ui.SCALE(); var w = Std.int(ww + step * 3); var h = Std.int(wh + step * 3); @@ -735,10 +736,10 @@ class UINodes { ww = Config.raw.layout[LayoutNodesW]; #if (is_paint || is_sculpt) - wx = Std.int(iron.App.w()) + UIToolbar.inst.toolbarw; + wx = Std.int(App.w()) + UIToolbar.inst.toolbarw; #end #if is_lab - wx = Std.int(iron.App.w()); + wx = Std.int(App.w()); #end wy = 0; @@ -751,12 +752,12 @@ class UINodes { #end var ew = Std.int(ui.ELEMENT_W() * 0.7); - wh = iron.App.h() + UIHeader.headerh; + wh = App.h() + UIHeader.headerh; if (Config.raw.layout[LayoutHeader] == 1) wh += UIHeader.headerh; if (UIView2D.inst.show) { wh = Config.raw.layout[LayoutNodesH]; - wy = iron.App.h() - Config.raw.layout[LayoutNodesH] + UIHeader.headerh; + wy = App.h() - Config.raw.layout[LayoutNodesH] + UIHeader.headerh; if (Config.raw.layout[LayoutHeader] == 1) wy += UIHeader.headerh; if (!UIBase.inst.show) { wy -= UIHeader.headerh * 2; diff --git a/base/Sources/arm/ui/UIStatus.hx b/base/Sources/arm/ui/UIStatus.hx index 3ba05098..2fe0572a 100644 --- a/base/Sources/arm/ui/UIStatus.hx +++ b/base/Sources/arm/ui/UIStatus.hx @@ -1,5 +1,6 @@ package arm.ui; +import iron.App; import iron.System; import zui.Zui; @@ -18,11 +19,11 @@ class UIStatus { var statush = Config.raw.layout[LayoutStatusH]; #if (is_paint || is_sculpt) - if (ui.window(UIBase.inst.hwnds[TabStatus], iron.App.x(), System.height - statush, System.width - UIToolbar.inst.toolbarw - Config.raw.layout[LayoutSidebarW], statush)) { + if (ui.window(UIBase.inst.hwnds[TabStatus], App.x(), System.height - statush, System.width - UIToolbar.inst.toolbarw - Config.raw.layout[LayoutSidebarW], statush)) { #end #if is_lab - if (ui.window(UIBase.inst.hwnds[TabStatus], iron.App.x(), System.height - statush, System.width, statush)) { + if (ui.window(UIBase.inst.hwnds[TabStatus], App.x(), System.height - statush, System.width, statush)) { #end ui._y += 2; diff --git a/base/Sources/arm/ui/UIView2D.hx b/base/Sources/arm/ui/UIView2D.hx index e9267028..2498fd50 100644 --- a/base/Sources/arm/ui/UIView2D.hx +++ b/base/Sources/arm/ui/UIView2D.hx @@ -1,6 +1,7 @@ package arm.ui; import zui.Zui; +import iron.App; import iron.System; import iron.Input; import iron.RenderPath; @@ -70,9 +71,9 @@ class UIView2D { ww = Config.raw.layout[LayoutNodesW]; #if (is_paint || is_sculpt) - wx = Std.int(iron.App.w()) + UIToolbar.inst.toolbarw; + wx = Std.int(App.w()) + UIToolbar.inst.toolbarw; #else - wx = Std.int(iron.App.w()); + wx = Std.int(App.w()); #end wy = 0; @@ -461,7 +462,7 @@ class UIView2D { var border = 32; var tw = ww * 0.95 * panScale; var tx = ww / 2 - tw / 2 + panX; - var hh = iron.App.h(); + var hh = App.h(); var ty = hh / 2 - tw / 2 + panY; if (tx + border > ww) panX = ww / 2 + tw / 2 - border; diff --git a/base/Sources/arm/util/RenderUtil.hx b/base/Sources/arm/util/RenderUtil.hx index 2b3c426d..1d895227 100644 --- a/base/Sources/arm/util/RenderUtil.hx +++ b/base/Sources/arm/util/RenderUtil.hx @@ -3,6 +3,7 @@ package arm.util; import zui.Zui.Nodes; import zui.Zui.TNode; import zui.Zui.TNodeCanvas; +import iron.App; import iron.System; import iron.MeshObject; import iron.Mat4; @@ -70,8 +71,8 @@ class RenderUtil { RenderPath.active.commands = _commands; Context.raw.materialPreview = false; - RenderPath.active.lastW = iron.App.w(); - RenderPath.active.lastH = iron.App.h(); + RenderPath.active.lastW = App.w(); + RenderPath.active.lastH = App.h(); // Restore sphere.visible = false; @@ -136,8 +137,8 @@ class RenderUtil { RenderPath.active.commands = _commands; Context.raw.decalPreview = false; - RenderPath.active.lastW = iron.App.w(); - RenderPath.active.lastH = iron.App.h(); + RenderPath.active.lastW = App.w(); + RenderPath.active.lastH = App.h(); // Restore plane.visible = false; @@ -337,7 +338,7 @@ class RenderUtil { function _init() { MakeMaterial.parsePaintMaterial(false); } - iron.App.notifyOnInit(_init); + App.notifyOnInit(_init); // Restore paint mesh Context.raw.materialPreview = false;