Begin tab layout for 2d view and nodes

This commit is contained in:
luboslenco
2023-06-06 17:25:02 +02:00
parent e99e0dc6fa
commit 1cc0887ff7
5 changed files with 37 additions and 29 deletions
+1 -1
View File
@@ -933,7 +933,7 @@ class App {
#if krom_ios
show2d ? Std.int((iron.App.w() + raw.layout[LayoutNodesW]) * 0.6) : Std.int(iron.App.w() * 0.6),
#else
show2d ? Std.int((iron.App.w() + raw.layout[LayoutNodesW]) / 2) : Std.int(iron.App.w() / 2),
show2d ? Std.int((iron.App.w() + raw.layout[LayoutNodesW]) * 0.515) : Std.int(iron.App.w() * 0.515), // Align with ui header controls
#end
#if (is_paint || is_sculpt)
+4 -2
View File
@@ -38,9 +38,11 @@ class UIHeader {
#if is_paint
if (ui.window(headerHandle, panelx, headerh, System.windowWidth() - UIToolbar.inst.toolbarw - Config.raw.layout[LayoutSidebarW], Std.int(defaultHeaderH * ui.SCALE()))) {
ui._y += 2;
var nodesw = (UINodes.inst.show || UIView2D.inst.show) ? Config.raw.layout[LayoutNodesW] : 0;
var ww = System.windowWidth() - UIToolbar.inst.toolbarw - Config.raw.layout[LayoutSidebarW] - nodesw;
if (ui.window(headerHandle, panelx, headerh, ww, Std.int(defaultHeaderH * ui.SCALE()))) {
ui._y += 2;
if (Context.raw.tool == ToolColorId) {
ui.text(tr("Picked Color"));
+3 -1
View File
@@ -108,7 +108,9 @@ class UIMenubar {
#if is_paint
var panelx = (iron.App.x() - UIToolbar.inst.toolbarw) + menubarw;
if (ui.window(workspaceHandle, panelx, 0, System.windowWidth() - Config.raw.layout[LayoutSidebarW] - menubarw, Std.int(UIHeader.defaultHeaderH * ui.SCALE()))) {
var nodesw = (UINodes.inst.show || UIView2D.inst.show) ? Config.raw.layout[LayoutNodesW] : 0;
var ww = System.windowWidth() - Config.raw.layout[LayoutSidebarW] - menubarw - nodesw;
if (ui.window(workspaceHandle, panelx, 0, ww, Std.int(UIHeader.defaultHeaderH * ui.SCALE()))) {
ui.tab(UIHeader.inst.worktab, tr("Paint"));
ui.tab(UIHeader.inst.worktab, tr("Material"));
ui.tab(UIHeader.inst.worktab, tr("Bake"));
+14 -13
View File
@@ -624,8 +624,8 @@ class UINodes {
#end
var wh = iron.App.h();
var w = ww + 100 * 2;
var h = wh + 100 * 2;
var w = ww + 100 * 3;
var h = wh + 100 * 3;
if (w < 1) w = 1;
if (h < 1) h = 1;
grid = Image.createRenderTarget(w, h);
@@ -747,18 +747,16 @@ class UINodes {
wx = Std.int(iron.App.w());
#end
wy = UIHeader.inst.headerh * 2;
wy = 0;
if (!UIBase.inst.show) {
#if (is_paint || is_sculpt)
ww += Config.raw.layout[LayoutSidebarW] + UIToolbar.inst.toolbarw;
wx -= UIToolbar.inst.toolbarw;
#end
wy = 0;
}
var ew = Std.int(ui.ELEMENT_W() * 0.7);
wh = iron.App.h();
wh = iron.App.h() + UIHeader.inst.headerh * 2;
#if (is_paint || is_sculpt)
if (UIView2D.inst.show) {
@@ -772,6 +770,8 @@ class UINodes {
if (ui.window(hwnd, wx, wy, ww, wh)) {
ui.tab(Id.handle(), tr("Nodes"));
// Grid
ui.g.color = 0xffffffff;
ui.g.drawImage(grid, (nodes.panX * nodes.SCALE()) % 100 - 100, (nodes.panY * nodes.SCALE()) % 100 - 100);
@@ -931,12 +931,13 @@ class UINodes {
#end
// Menu
var startY = ui.ELEMENT_H() + ui.ELEMENT_OFFSET();
ui.g.color = ui.t.SEPARATOR_COL;
ui.g.fillRect(0, 0, ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET());
ui.g.fillRect(0, startY, ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET());
ui.g.color = 0xffffffff;
ui._x = 0;
ui._y = 0;
ui._y = 2 + startY;
ui._w = ew;
#if (is_paint || is_sculpt)
@@ -946,7 +947,7 @@ class UINodes {
ui._w = Std.int(Math.min(ui.ops.font.width(ui.fontSize, h.text) + 15 * ui.SCALE(), 100 * ui.SCALE()));
var newName = ui.textInput(h, "");
ui._x += ui._w + 3;
ui._y = 0;
ui._y = 2 + startY;
ui._w = ew;
if (h.changed) { // Check whether renaming is possible and update group links
@@ -1066,7 +1067,7 @@ class UINodes {
});
}
ui._x += ew + 3;
ui._y = 0;
ui._y = 2 + startY;
#if (krom_android || krom_ios)
ui.combo(App.resHandle, ["2K", "4K"], tr("Resolution"));
@@ -1077,7 +1078,7 @@ class UINodes {
App.onLayersResized();
}
ui._x += ew + 3;
ui._y = 0;
ui._y = 2 + startY;
#end
var _BUTTON_COL = ui.t.BUTTON_COL;
@@ -1103,7 +1104,7 @@ class UINodes {
UIMenu.menuCategoryH = Std.int(Ext.MENUBAR_H(ui));
}
ui._x += ui._w + 3;
ui._y = 0;
ui._y = 2 + startY;
}
if (Ext.menuButton(ui, tr("Search"))) {
@@ -1113,7 +1114,7 @@ class UINodes {
ui.tooltip(tr("Search for nodes") + ' (${Config.keymap.node_search})');
}
ui._x += ui._w + 3;
ui._y = 0;
ui._y = 2 + startY;
ui.t.BUTTON_COL = _BUTTON_COL;
+15 -12
View File
@@ -68,11 +68,10 @@ class UIView2D {
ww = Config.raw.layout[LayoutNodesW];
wx = Std.int(iron.App.w()) + UIToolbar.inst.toolbarw;
wy = UIHeader.inst.headerh * 2;
wy = 0;
if (!UIBase.inst.show) {
ww += Config.raw.layout[LayoutSidebarW] + UIToolbar.inst.toolbarw;
wx -= UIToolbar.inst.toolbarw;
wy = 0;
}
if (!show) return;
@@ -92,12 +91,15 @@ class UIView2D {
if (Context.raw.font.image == null) RenderUtil.makeFontPreview();
ui.begin(g);
wh = iron.App.h();
var apph = iron.App.h() + UIHeader.inst.headerh * 4;
wh = apph;
if (UINodes.inst.show) {
wh -= Config.raw.layout[LayoutNodesH];
}
if (ui.window(hwnd, wx, wy, ww, wh)) {
ui.tab(Id.handle(), tr("2D View"));
// Grid
ui.g.color = 0xffffffff;
ui.g.drawImage(UINodes.inst.grid, (panX * panScale) % 100 - 100, (panY * panScale) % 100 - 100);
@@ -109,7 +111,7 @@ class UIView2D {
var tw = ww * 0.95 * panScale;
var tx = ww / 2 - tw / 2 + panX;
var ty = iron.App.h() / 2 - tw / 2 + panY;
var ty = apph / 2 - tw / 2 + panY;
if (type == View2DLayer) {
var layer = l;
@@ -161,7 +163,7 @@ class UIView2D {
var th = tw;
if (tex != null) {
th = tw * (tex.height / tex.width);
ty = iron.App.h() / 2 - th / 2 + panY;
ty = apph / 2 - th / 2 + panY;
if (type == View2DLayer) {
ui.g.pipeline = pipe;
@@ -229,12 +231,13 @@ class UIView2D {
}
// Menu
var startY = ui.ELEMENT_H() + ui.ELEMENT_OFFSET();
var ew = Std.int(ui.ELEMENT_W());
ui.g.color = ui.t.SEPARATOR_COL;
ui.g.fillRect(0, 0, ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET());
ui.g.fillRect(0, startY, ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET());
ui.g.color = 0xffffffff;
ui._x = 2;
ui._y = 2;
ui._y = 2 + startY;
ui._w = ew;
// Editable layer name
@@ -265,7 +268,7 @@ class UIView2D {
}
if (h.changed) UIBase.inst.hwnds[0].redraws = 2;
ui._x += ui._w + 3;
ui._y = 2;
ui._y = 2 + startY;
ui._w = ew;
if (type == View2DLayer) {
@@ -274,7 +277,7 @@ class UIView2D {
tr("Selected"),
], tr("Layers"));
ui._x += ew + 3;
ui._y = 2;
ui._y = 2 + startY;
if (!Context.raw.layer.isMask()) {
texType = ui.combo(Id.handle({ position: texType }), [
@@ -287,17 +290,17 @@ class UIView2D {
tr("Height"),
], tr("Texture"));
ui._x += ew + 3;
ui._y = 2;
ui._y = 2 + startY;
}
uvmapShow = ui.check(Id.handle({ selected: uvmapShow }), tr("UV Map"));
ui._x += ew * 0.7 + 3;
ui._y = 2;
ui._y = 2 + startY;
}
tiledShow = ui.check(Id.handle({ selected: tiledShow }), tr("Tiled"));
ui._x += ew * 0.7 + 3;
ui._y = 2;
ui._y = 2 + startY;
if (type == View2DAsset && tex != null) { // Texture resolution
ui.text(tex.width + "x" + tex.height);