Translation support for nodes

This commit is contained in:
luboslenco
2020-09-10 16:21:29 +02:00
parent 796c629e04
commit edf19ee4e2
5 changed files with 3 additions and 11 deletions
+1
View File
@@ -143,6 +143,7 @@ class App {
colorWheel = image;
Nodes.enumTexts = enumTexts;
Nodes.tr = tr;
uiBox = new Zui({ font: f, scaleFactor: Config.raw.window_scale, color_wheel: colorWheel });
uiMenu = new Zui({ font: f, scaleFactor: Config.raw.window_scale, color_wheel: colorWheel });
defaultElementH = uiMenu.t.ELEMENT_H;
-1
View File
@@ -30,6 +30,5 @@ class BrushSlot {
else {
canvas = c;
}
for (node in canvas.nodes) arm.ui.UINodes.translateNode(node);
}
}
-1
View File
@@ -49,7 +49,6 @@ class MaterialSlot {
else {
canvas = c;
}
for (node in canvas.nodes) arm.ui.UINodes.translateNode(node);
}
public function unload() {
+1 -9
View File
@@ -198,7 +198,7 @@ class UINodes {
var nodeList = canvasType == CanvasMaterial ? NodesMaterial.list : NodesBrush.list;
for (list in nodeList) {
for (n in list) {
if (n.name.toLowerCase().indexOf(search) >= 0) {
if (tr(n.name).toLowerCase().indexOf(search) >= 0) {
ui.t.BUTTON_COL = count == nodeSearchOffset ? ui.t.HIGHLIGHT_COL : ui.t.WINDOW_BG_COL;
if (ui.button(tr(n.name), Left) || (enter && count == nodeSearchOffset)) {
var nodes = getNodes();
@@ -516,7 +516,6 @@ class UINodes {
public static function makeNode(n: TNode, nodes: Nodes, canvas: TNodeCanvas): TNode {
var node: TNode = Json.parse(Json.stringify(n));
translateNode(node);
node.id = nodes.getNodeId(canvas.nodes);
node.x = UINodes.inst.getNodeX();
node.y = UINodes.inst.getNodeY();
@@ -530,11 +529,4 @@ class UINodes {
}
return node;
}
public static function translateNode(node: TNode) {
node.name = tr(node.name);
for (inp in node.inputs) inp.name = tr(inp.name);
for (out in node.outputs) out.name = tr(out.name);
for (but in node.buttons) but.name = tr(but.name);
}
}
+1
View File
@@ -30,6 +30,7 @@ project.addAssets("Assets/meshes/*", { notinlist: true, destination: "data/meshe
project.addDefine("arm_taa");
project.addDefine("arm_veloc");
project.addDefine("arm_particles");
project.addDefine("zui_translate");
if (!android) {
project.addDefine("arm_data_dir");