From 075b4409c4f523ac84a114ac5fb35381d53c5833 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 30 Nov 2023 13:55:29 +0100 Subject: [PATCH] Compile fixes --- armorforge/Sources/arm/ui/TabObjects.hx | 12 ++++++------ armorlab/Sources/arm/logic/ImageTextureNode.hx | 4 ++-- armorlab/Sources/arm/logic/InpaintNode.hx | 8 ++++---- armorlab/Sources/arm/logic/NodesBrush.hx | 6 +++--- armorlab/Sources/arm/logic/PhotoToPBRNode.hx | 4 ++-- armorlab/Sources/arm/logic/RGBNode.hx | 4 ++-- armorlab/Sources/arm/logic/TextToPhotoNode.hx | 8 ++++---- armorlab/Sources/arm/logic/TilingNode.hx | 8 ++++---- armorlab/Sources/arm/logic/UpscaleNode.hx | 4 ++-- armorlab/Sources/arm/logic/VarianceNode.hx | 8 ++++---- armorlab/Sources/arm/render/RenderPathPaint.hx | 14 ++++++++++---- armorlab/Sources/arm/shader/MakeMaterial.hx | 2 +- armorlab/Sources/arm/shader/MakePaint.hx | 2 +- armorsculpt/Sources/arm/shader/MakeMaterial.hx | 3 ++- armorsculpt/Sources/arm/shader/MakeSculpt.hx | 2 +- armorsculpt/Sources/arm/ui/TabLayers.hx | 6 +++--- base/Sources/arm/App.hx | 6 ++++-- base/Sources/arm/Context.hx | 4 +++- base/Sources/arm/logic/LogicParser.hx | 3 ++- base/Sources/arm/ui/UIBase.hx | 2 +- base/Sources/arm/ui/UIHeader.hx | 4 +++- base/Sources/arm/ui/UIView2D.hx | 8 ++++---- 22 files changed, 68 insertions(+), 54 deletions(-) diff --git a/armorforge/Sources/arm/ui/TabObjects.hx b/armorforge/Sources/arm/ui/TabObjects.hx index b2fd5c061..b6b7dd341 100644 --- a/armorforge/Sources/arm/ui/TabObjects.hx +++ b/armorforge/Sources/arm/ui/TabObjects.hx @@ -26,7 +26,7 @@ class TabObjects { ui.endSticky(); if (ui.panel(Zui.handle("tabobjects_0", {selected: true}), "Outliner")) { - ui.indent(); + // ui.indent(); ui._y -= ui.ELEMENT_OFFSET(); var listX = ui._x; @@ -112,9 +112,9 @@ class TabObjects { if (b) { var currentY = ui._y; for (child in currentObject.children) { - ui.indent(); + // ui.indent(); drawList(listHandle, child); - ui.unindent(); + // ui.unindent(); } // Draw line that shows parent relations @@ -127,11 +127,11 @@ class TabObjects { drawList(Zui.handle("tabobjects_1"), c); } - ui.unindent(); + // ui.unindent(); } if (ui.panel(Zui.handle("tabobjects_2", {selected: true}), 'Properties')) { - ui.indent(); + // ui.indent(); if (Context.raw.selectedObject != null) { var h = Zui.handle("tabobjects_3"); @@ -253,7 +253,7 @@ class TabObjects { } } - ui.unindent(); + // ui.unindent(); } } } diff --git a/armorlab/Sources/arm/logic/ImageTextureNode.hx b/armorlab/Sources/arm/logic/ImageTextureNode.hx index 6bcb4cbe8..d28fdd9ab 100644 --- a/armorlab/Sources/arm/logic/ImageTextureNode.hx +++ b/armorlab/Sources/arm/logic/ImageTextureNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -27,7 +27,7 @@ class ImageTextureNode extends LogicNode { return image; } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Image Texture"), type: "ImageTextureNode", diff --git a/armorlab/Sources/arm/logic/InpaintNode.hx b/armorlab/Sources/arm/logic/InpaintNode.hx index 442c5dd01..e7d1dc576 100644 --- a/armorlab/Sources/arm/logic/InpaintNode.hx +++ b/armorlab/Sources/arm/logic/InpaintNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -46,11 +46,11 @@ class InpaintNode extends LogicNode { } } - public static function buttons(ui: zui.Zui, nodes: zui.Nodes, node: zui.Nodes.TNode) { + public static function buttons(ui: zui.Zui, nodes: zui.Zui.Nodes, node: zui.Zui.TNode) { auto = node.buttons[0].default_value; if (!auto) { strength = ui.slider(zui.Zui.handle("inpaintnode_0", {value: strength}), tr("strength"), 0, 1, true); - prompt = zui.Ext.textArea(ui, zui.Zui.handle("inpaintnode_1"), true, tr("prompt"), true); + prompt = ui.textArea(zui.Zui.handle("inpaintnode_1"), true, tr("prompt"), true); node.buttons[1].height = 1 + prompt.split("\n").length; } else node.buttons[1].height = 0; @@ -181,7 +181,7 @@ class InpaintNode extends LogicNode { }); } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Inpaint"), type: "InpaintNode", diff --git a/armorlab/Sources/arm/logic/NodesBrush.hx b/armorlab/Sources/arm/logic/NodesBrush.hx index fe630063b..0b2909099 100644 --- a/armorlab/Sources/arm/logic/NodesBrush.hx +++ b/armorlab/Sources/arm/logic/NodesBrush.hx @@ -1,13 +1,13 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.Translator._tr; class NodesBrush { public static var categories = [_tr("Input"), _tr("Model")]; - public static var list: Array> = [ + public static var list: Array> = [ [ // Input ImageTextureNode.def, RGBNode.def, @@ -22,7 +22,7 @@ class NodesBrush { ] ]; - public static function createNode(nodeType: String): TNode { + public static function createNode(nodeType: String): zui.Zui.TNode { for (c in list) { for (n in c) { if (n.type == nodeType) { diff --git a/armorlab/Sources/arm/logic/PhotoToPBRNode.hx b/armorlab/Sources/arm/logic/PhotoToPBRNode.hx index 4428e35b6..8dbe90305 100644 --- a/armorlab/Sources/arm/logic/PhotoToPBRNode.hx +++ b/armorlab/Sources/arm/logic/PhotoToPBRNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -174,7 +174,7 @@ class PhotoToPBRNode extends LogicNode { } #end - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Photo to PBR"), type: "PhotoToPBRNode", diff --git a/armorlab/Sources/arm/logic/RGBNode.hx b/armorlab/Sources/arm/logic/RGBNode.hx index b7ad0c41a..46d07288c 100644 --- a/armorlab/Sources/arm/logic/RGBNode.hx +++ b/armorlab/Sources/arm/logic/RGBNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import iron.math.Vec4; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; @@ -38,7 +38,7 @@ class RGBNode extends LogicNode { return image; } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("RGB"), type: "RGBNode", diff --git a/armorlab/Sources/arm/logic/TextToPhotoNode.hx b/armorlab/Sources/arm/logic/TextToPhotoNode.hx index 572f9f0e1..d89b34ee2 100644 --- a/armorlab/Sources/arm/logic/TextToPhotoNode.hx +++ b/armorlab/Sources/arm/logic/TextToPhotoNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -30,9 +30,9 @@ class TextToPhotoNode extends LogicNode { return image; } - public static function buttons(ui: zui.Zui, nodes: zui.Nodes, node: zui.Nodes.TNode) { + public static function buttons(ui: zui.Zui, nodes: zui.Zui.Nodes, node: zui.Zui.TNode) { tiling = node.buttons[0].default_value; - prompt = zui.Ext.textArea(ui, zui.Zui.handle("texttophotonode_0"), true, tr("prompt"), true); + prompt = ui.textArea(zui.Zui.handle("texttophotonode_0"), true, tr("prompt"), true); node.buttons[1].height = prompt.split("\n").length; } @@ -248,7 +248,7 @@ class TextToPhotoNode extends LogicNode { }); } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Text to Photo"), type: "TextToPhotoNode", diff --git a/armorlab/Sources/arm/logic/TilingNode.hx b/armorlab/Sources/arm/logic/TilingNode.hx index 52863fc9d..cc81e3919 100644 --- a/armorlab/Sources/arm/logic/TilingNode.hx +++ b/armorlab/Sources/arm/logic/TilingNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -26,11 +26,11 @@ class TilingNode extends LogicNode { } } - public static function buttons(ui: zui.Zui, nodes: zui.Nodes, node: zui.Nodes.TNode) { + public static function buttons(ui: zui.Zui, nodes: zui.Zui.Nodes, node: zui.Zui.TNode) { auto = node.buttons[0].default_value; if (!auto) { strength = ui.slider(zui.Zui.handle("tilingnode_0", {value: strength}), tr("strength"), 0, 1, true); - prompt = zui.Ext.textArea(ui, zui.Zui.handle("tilingnode_1"), true, tr("prompt"), true); + prompt = ui.textArea(zui.Zui.handle("tilingnode_1"), true, tr("prompt"), true); node.buttons[1].height = 1 + prompt.split("\n").length; } else node.buttons[1].height = 0; @@ -93,7 +93,7 @@ class TilingNode extends LogicNode { InpaintNode.sdInpaint(tile, mask, done); } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Tiling"), type: "TilingNode", diff --git a/armorlab/Sources/arm/logic/UpscaleNode.hx b/armorlab/Sources/arm/logic/UpscaleNode.hx index 46e46bdc8..828603ca6 100644 --- a/armorlab/Sources/arm/logic/UpscaleNode.hx +++ b/armorlab/Sources/arm/logic/UpscaleNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -126,7 +126,7 @@ class UpscaleNode extends LogicNode { return result; } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Upscale"), type: "UpscaleNode", diff --git a/armorlab/Sources/arm/logic/VarianceNode.hx b/armorlab/Sources/arm/logic/VarianceNode.hx index f0d463ec5..5e34b012a 100644 --- a/armorlab/Sources/arm/logic/VarianceNode.hx +++ b/armorlab/Sources/arm/logic/VarianceNode.hx @@ -1,6 +1,6 @@ package arm.logic; -import zui.Nodes; +import zui.Zui.Nodes; import arm.logic.LogicNode; import arm.logic.LogicParser.f32; import arm.Translator._tr; @@ -27,8 +27,8 @@ class VarianceNode extends LogicNode { } } - public static function buttons(ui: zui.Zui, nodes: zui.Nodes, node: zui.Nodes.TNode) { - prompt = zui.Ext.textArea(ui, zui.Zui.handle("variancenode_0"), true, tr("prompt"), true); + public static function buttons(ui: zui.Zui, nodes: zui.Zui.Nodes, node: zui.Zui.TNode) { + prompt = ui.textArea(zui.Zui.handle("variancenode_0"), true, tr("prompt"), true); node.buttons[0].height = prompt.split("\n").length; } @@ -84,7 +84,7 @@ class VarianceNode extends LogicNode { return image; } - public static var def: TNode = { + public static var def: zui.Zui.TNode = { id: 0, name: _tr("Variance"), type: "VarianceNode", diff --git a/armorlab/Sources/arm/render/RenderPathPaint.hx b/armorlab/Sources/arm/render/RenderPathPaint.hx index 5425352a4..6442a1904 100644 --- a/armorlab/Sources/arm/render/RenderPathPaint.hx +++ b/armorlab/Sources/arm/render/RenderPathPaint.hx @@ -175,7 +175,9 @@ class RenderPathPaint { return; } - var inpaint = UINodes.inst.getNodes().nodesSelected.length > 0 && UINodes.inst.getNodes().nodesSelected[0].type == "InpaintNode"; + var nodes = UINodes.inst.getNodes(); + var canvas = UINodes.inst.getCanvas(true); + var inpaint = nodes.nodesSelectedId.length > 0 && nodes.getNode(canvas.nodes, nodes.nodesSelectedId[0]).type == "InpaintNode"; if (!App.uiEnabled || App.isDragging || !inpaint) { return; @@ -265,8 +267,10 @@ class RenderPathPaint { public static function bindLayers() { var image: kha.Image = null; - if (UINodes.inst.getNodes().nodesSelected.length > 0) { - var node = UINodes.inst.getNodes().nodesSelected[0]; + var nodes = UINodes.inst.getNodes(); + var canvas = UINodes.inst.getCanvas(true); + if (nodes.nodesSelectedId.length > 0) { + var node = nodes.getNode(canvas.nodes, nodes.nodesSelectedId[0]); var brushNode = arm.logic.LogicParser.getLogicNode(node); if (brushNode != null) { image = brushNode.getCachedImage(); @@ -296,7 +300,9 @@ class RenderPathPaint { path.bindTarget("texpaint_nor_empty", "texpaint_nor"); path.bindTarget("texpaint_pack_empty", "texpaint_pack"); - var node = UINodes.inst.getNodes().nodesSelected[0]; + var nodes = UINodes.inst.getNodes(); + var canvas = UINodes.inst.getCanvas(true); + var node = nodes.getNode(canvas.nodes, nodes.nodesSelectedId[0]); var inpaint = node.type == "InpaintNode"; if (inpaint) { var brushNode = arm.logic.LogicParser.getLogicNode(node); diff --git a/armorlab/Sources/arm/shader/MakeMaterial.hx b/armorlab/Sources/arm/shader/MakeMaterial.hx index 4b928d2bb..73798b3b1 100644 --- a/armorlab/Sources/arm/shader/MakeMaterial.hx +++ b/armorlab/Sources/arm/shader/MakeMaterial.hx @@ -1,6 +1,6 @@ package arm.shader; -import zui.Nodes; +import zui.Zui.Nodes; import iron.data.SceneFormat; import iron.data.ShaderData; import iron.data.MaterialData; diff --git a/armorlab/Sources/arm/shader/MakePaint.hx b/armorlab/Sources/arm/shader/MakePaint.hx index f293de777..ee291beeb 100644 --- a/armorlab/Sources/arm/shader/MakePaint.hx +++ b/armorlab/Sources/arm/shader/MakePaint.hx @@ -1,7 +1,7 @@ package arm.shader; import iron.data.SceneFormat; -import zui.Nodes; +import zui.Zui.Nodes; import arm.shader.MaterialParser; import arm.shader.NodeShaderContext; import arm.shader.NodeShaderData; diff --git a/armorsculpt/Sources/arm/shader/MakeMaterial.hx b/armorsculpt/Sources/arm/shader/MakeMaterial.hx index b870f83e0..be5f901b9 100644 --- a/armorsculpt/Sources/arm/shader/MakeMaterial.hx +++ b/armorsculpt/Sources/arm/shader/MakeMaterial.hx @@ -1,6 +1,7 @@ package arm.shader; -import zui.Nodes; +import zui.Zui; +import zui.Zui.Nodes; import iron.data.SceneFormat; import iron.data.ShaderData; import iron.data.MaterialData; diff --git a/armorsculpt/Sources/arm/shader/MakeSculpt.hx b/armorsculpt/Sources/arm/shader/MakeSculpt.hx index 4341ef461..7d53abc00 100644 --- a/armorsculpt/Sources/arm/shader/MakeSculpt.hx +++ b/armorsculpt/Sources/arm/shader/MakeSculpt.hx @@ -1,7 +1,7 @@ package arm.shader; import iron.data.SceneFormat; -import zui.Nodes; +import zui.Zui.Nodes; import arm.ui.UINodes; import arm.shader.MaterialParser; import arm.shader.NodeShaderContext; diff --git a/armorsculpt/Sources/arm/ui/TabLayers.hx b/armorsculpt/Sources/arm/ui/TabLayers.hx index d665f63b4..3a4339a20 100644 --- a/armorsculpt/Sources/arm/ui/TabLayers.hx +++ b/armorsculpt/Sources/arm/ui/TabLayers.hx @@ -1,7 +1,7 @@ package arm.ui; import zui.Zui; -import zui.Nodes; +import zui.Zui.Nodes; import iron.system.Time; import iron.system.Input; import iron.object.MeshObject; @@ -252,10 +252,10 @@ class TabLayers { if (layerNameEdit == l.id) { layerNameHandle.text = l.name; l.name = ui.textInput(layerNameHandle); - if (ui.textSelectedHandle != layerNameHandle) layerNameEdit = -1; + if (ui.textSelectedHandle_ptr != layerNameHandle.ptr) layerNameEdit = -1; } else { - if (ui.enabled && ui.inputEnabled && ui.comboSelectedHandle == null && + if (ui.enabled && ui.inputEnabled && ui.comboSelectedHandle_ptr == null && ui.inputX > ui._windowX + ui._x && ui.inputX < ui._windowX + ui._windowW && ui.inputY > ui._windowY + ui._y - center && ui.inputY < ui._windowY + ui._y - center + (step * ui.SCALE()) * 2) { if (ui.inputStarted) { diff --git a/base/Sources/arm/App.hx b/base/Sources/arm/App.hx index 08876c001..caff7be08 100644 --- a/base/Sources/arm/App.hx +++ b/base/Sources/arm/App.hx @@ -2146,8 +2146,10 @@ class App { var texpaint_nor = arm.logic.BrushOutputNode.inst.texpaint_nor; var texpaint_pack = arm.logic.BrushOutputNode.inst.texpaint_pack; - if (UINodes.inst.getNodes().nodesSelected.length > 0) { - var node = UINodes.inst.getNodes().nodesSelected[0]; + var nodes = UINodes.inst.getNodes(); + var canvas = UINodes.inst.getCanvas(true); + if (nodes.nodesSelectedId.length > 0) { + var node = nodes.getNode(canvas.nodes, nodes.nodesSelectedId[0]); var brushNode = arm.logic.LogicParser.getLogicNode(node); if (brushNode != null && brushNode.getCachedImage() != null) { texpaint = brushNode.getCachedImage(); diff --git a/base/Sources/arm/Context.hx b/base/Sources/arm/Context.hx index c38bc1801..f83173289 100644 --- a/base/Sources/arm/Context.hx +++ b/base/Sources/arm/Context.hx @@ -367,7 +367,9 @@ class Context { raw.lastPaintVecY = raw.paintVec.y; } - var inpaint = UINodes.inst.getNodes().nodesSelected.length > 0 && UINodes.inst.getNodes().nodesSelected[0].type == "InpaintNode"; + var nodes = UINodes.inst.getNodes(); + var canvas = UINodes.inst.getCanvas(true); + var inpaint = nodes.nodesSelectedId.length > 0 && nodes.getNode(canvas.nodes, nodes.nodesSelectedId[0]).type == "InpaintNode"; // Paint bounds if (inpaint && diff --git a/base/Sources/arm/logic/LogicParser.hx b/base/Sources/arm/logic/LogicParser.hx index 69b8545fc..dc861995b 100644 --- a/base/Sources/arm/logic/LogicParser.hx +++ b/base/Sources/arm/logic/LogicParser.hx @@ -111,7 +111,8 @@ class LogicParser { // Expose button values in node class for (b in node.buttons) { if (b.type == "ENUM") { - var arrayData = Std.isOfType(b.data, Array); + // var arrayData = Std.isOfType(b.data, Array); + var arrayData = b.data.length > 1; var texts = arrayData ? b.data : Nodes.enumTextsHaxe(node.type); Reflect.setProperty(v, b.name, texts[b.default_value]); } diff --git a/base/Sources/arm/ui/UIBase.hx b/base/Sources/arm/ui/UIBase.hx index 239d4bd07..96edb15c7 100644 --- a/base/Sources/arm/ui/UIBase.hx +++ b/base/Sources/arm/ui/UIBase.hx @@ -28,7 +28,7 @@ import arm.data.MaterialSlot; #end #if is_lab import kha.Blob; -import zui.Nodes; +import zui.Zui.Nodes; #end @:access(zui.Zui) diff --git a/base/Sources/arm/ui/UIHeader.hx b/base/Sources/arm/ui/UIHeader.hx index fac0e8dfc..311564d4f 100644 --- a/base/Sources/arm/ui/UIHeader.hx +++ b/base/Sources/arm/ui/UIHeader.hx @@ -505,7 +505,9 @@ class UIHeader { Context.raw.tool == ToolBlur || Context.raw.tool == ToolSmudge) { - var inpaint = UINodes.inst.getNodes().nodesSelected.length > 0 && UINodes.inst.getNodes().nodesSelected[0].type == "InpaintNode"; + var nodes = UINodes.inst.getNodes(); + var canvas = UINodes.inst.getCanvas(true); + var inpaint = nodes.nodesSelectedId.length > 0 && nodes.getNode(canvas.nodes, nodes.nodesSelectedId[0]).type == "InpaintNode"; if (inpaint) { Context.raw.brushRadius = ui.slider(Context.raw.brushRadiusHandle, tr("Radius"), 0.01, 2.0, true); if (ui.isHovered) ui.tooltip(tr("Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius", ["brush_radius" => Config.keymap.brush_radius, "brush_radius_decrease" => Config.keymap.brush_radius_decrease, "brush_radius_increase" => Config.keymap.brush_radius_increase])); diff --git a/base/Sources/arm/ui/UIView2D.hx b/base/Sources/arm/ui/UIView2D.hx index 7fd5ab96f..0c04e5952 100644 --- a/base/Sources/arm/ui/UIView2D.hx +++ b/base/Sources/arm/ui/UIView2D.hx @@ -152,8 +152,8 @@ class UIView2D { #else var nodes = UINodes.inst.getNodes(); - if (nodes.nodesSelected.length > 0) { - var sel = nodes.nodesSelected[0]; + if (nodes.nodesSelectedId.length > 0) { + var sel = nodes.getNode(UINodes.inst.getCanvas(true).nodes, nodes.nodesSelectedId[0]); var brushNode = arm.logic.LogicParser.getLogicNode(sel); if (brushNode != null) { tex = brushNode.getCachedImage(); @@ -323,8 +323,8 @@ class UIView2D { #else var nodes = UINodes.inst.getNodes(); - if (nodes.nodesSelected.length > 0) { - ui.text(nodes.nodesSelected[0].name); + if (nodes.nodesSelectedId.length > 0) { + ui.text(nodes.getNode(UINodes.inst.getCanvas(true).nodes, nodes.nodesSelectedId[0]).name); } #end