Skip to content

Commit

Permalink
Compile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Nov 30, 2023
1 parent 226862e commit 075b440
Show file tree
Hide file tree
Showing 22 changed files with 68 additions and 54 deletions.
12 changes: 6 additions & 6 deletions armorforge/Sources/arm/ui/TabObjects.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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");
Expand Down Expand Up @@ -253,7 +253,7 @@ class TabObjects {
}
}

ui.unindent();
// ui.unindent();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions armorlab/Sources/arm/logic/ImageTextureNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions armorlab/Sources/arm/logic/InpaintNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions armorlab/Sources/arm/logic/NodesBrush.hx
Original file line number Diff line number Diff line change
@@ -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<Array<TNode>> = [
public static var list: Array<Array<zui.Zui.TNode>> = [
[ // Input
ImageTextureNode.def,
RGBNode.def,
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions armorlab/Sources/arm/logic/PhotoToPBRNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions armorlab/Sources/arm/logic/RGBNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions armorlab/Sources/arm/logic/TextToPhotoNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions armorlab/Sources/arm/logic/TilingNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions armorlab/Sources/arm/logic/UpscaleNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions armorlab/Sources/arm/logic/VarianceNode.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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",
Expand Down
14 changes: 10 additions & 4 deletions armorlab/Sources/arm/render/RenderPathPaint.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion armorlab/Sources/arm/shader/MakeMaterial.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion armorlab/Sources/arm/shader/MakePaint.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion armorsculpt/Sources/arm/shader/MakeMaterial.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion armorsculpt/Sources/arm/shader/MakeSculpt.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 3 additions & 3 deletions armorsculpt/Sources/arm/ui/TabLayers.hx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions base/Sources/arm/App.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion base/Sources/arm/Context.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
3 changes: 2 additions & 1 deletion base/Sources/arm/logic/LogicParser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
2 changes: 1 addition & 1 deletion base/Sources/arm/ui/UIBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 075b440

Please sign in to comment.