Move viewport mode to menu bar
This commit is contained in:
+3
-2
@@ -167,8 +167,9 @@ package arm;
|
||||
var MenuFile = 0;
|
||||
var MenuEdit = 1;
|
||||
var MenuViewport = 2;
|
||||
var MenuCamera = 3;
|
||||
var MenuHelp = 4;
|
||||
var MenuMode = 3;
|
||||
var MenuCamera = 4;
|
||||
var MenuHelp = 5;
|
||||
}
|
||||
|
||||
@:enum abstract CanvasType(Int) from Int to Int {
|
||||
|
||||
@@ -8,6 +8,7 @@ import zui.Zui;
|
||||
import zui.Id;
|
||||
import zui.Ext;
|
||||
import iron.Scene;
|
||||
import iron.RenderPath;
|
||||
import iron.system.Input;
|
||||
import arm.util.ViewportUtil;
|
||||
import arm.util.UVUtil;
|
||||
@@ -16,6 +17,8 @@ import arm.sys.Path;
|
||||
import arm.sys.File;
|
||||
import arm.node.MaterialParser;
|
||||
import arm.io.ImportAsset;
|
||||
import arm.render.RenderPathDeferred;
|
||||
import arm.render.RenderPathForward;
|
||||
import arm.Tool;
|
||||
using StringTools;
|
||||
|
||||
@@ -50,7 +53,7 @@ class UIMenu {
|
||||
menuCommands(ui);
|
||||
}
|
||||
else {
|
||||
var menuItems = [12, 3, 14, 19, 5];
|
||||
var menuItems = [12, 3, 14, 12, 19, 5];
|
||||
if (viewportColorHandle.selected) menuItems[2] += 6;
|
||||
var sepw = menuW / ui.SCALE();
|
||||
g.color = ui.t.SEPARATOR_COL;
|
||||
@@ -245,6 +248,29 @@ class UIMenu {
|
||||
|
||||
if (ui.changed) keepOpen = true;
|
||||
}
|
||||
else if (menuCategory == MenuMode) {
|
||||
var modeHandle = Id.handle();
|
||||
var modes = ["Render", "Base Color", "Normal", "Occlusion", "Roughness", "Metallic", "TexCoord", "Normal (Object)", "Material ID", "Object ID", "Mask"];
|
||||
#if kha_direct3d12
|
||||
modes.push("Path-Trace");
|
||||
#end
|
||||
for (i in 0...modes.length) {
|
||||
ui.radio(modeHandle, i, modes[i]);
|
||||
}
|
||||
|
||||
UITrait.inst.viewportMode = modeHandle.position;
|
||||
if (modeHandle.changed) {
|
||||
var deferred = UITrait.inst.viewportMode == ViewRender || UITrait.inst.viewportMode == ViewPathTrace;
|
||||
if (deferred) {
|
||||
RenderPath.active.commands = RenderPathDeferred.commands;
|
||||
}
|
||||
else {
|
||||
if (RenderPathForward.path == null) RenderPathForward.init(RenderPath.active);
|
||||
RenderPath.active.commands = RenderPathForward.commands;
|
||||
}
|
||||
MaterialParser.parseMeshMaterial();
|
||||
}
|
||||
}
|
||||
else if (menuCategory == MenuCamera) {
|
||||
if (ui.button(" Reset", Left, Config.keymap.view_reset)) { ViewportUtil.resetViewport(); ViewportUtil.scaleToBounds(); }
|
||||
ui.fill(0, 0, sepw, 1, ui.t.ACCENT_SELECT_COL);
|
||||
|
||||
@@ -24,8 +24,6 @@ import arm.data.BrushSlot;
|
||||
import arm.data.MaterialSlot;
|
||||
import arm.io.ImportFont;
|
||||
import arm.io.ExportTexture;
|
||||
import arm.render.RenderPathDeferred;
|
||||
import arm.render.RenderPathForward;
|
||||
import arm.Tool;
|
||||
import arm.Project;
|
||||
|
||||
@@ -36,7 +34,7 @@ class UITrait {
|
||||
public static var defaultWindowW = 280;
|
||||
public static inline var defaultToolbarW = 54;
|
||||
public static inline var defaultHeaderH = 28;
|
||||
public static inline var defaultMenubarW = 280;
|
||||
public static inline var defaultMenubarW = 330;
|
||||
public static var penPressureRadius = true;
|
||||
public static var penPressureHardness = true;
|
||||
public static var penPressureOpacity = false;
|
||||
@@ -917,6 +915,7 @@ class UITrait {
|
||||
menuButton("File", MenuFile);
|
||||
menuButton("Edit", MenuEdit);
|
||||
menuButton("Viewport", MenuViewport);
|
||||
menuButton("Mode", MenuMode);
|
||||
menuButton("Camera", MenuCamera);
|
||||
menuButton("Help", MenuHelp);
|
||||
|
||||
@@ -1161,24 +1160,6 @@ class UITrait {
|
||||
if (ui.window(statusHandle, iron.App.x(), System.windowHeight() - headerh, System.windowWidth() - toolbarw - windowW, headerh)) {
|
||||
ui._y += 2;
|
||||
|
||||
var modeHandle = Id.handle();
|
||||
var modes = ["Render", "Base Color", "Normal", "Occlusion", "Roughness", "Metallic", "TexCoord", "Normal (Object)", "Material ID", "Object ID", "Mask"];
|
||||
#if kha_direct3d12
|
||||
modes.push("Path-Trace");
|
||||
#end
|
||||
UITrait.inst.viewportMode = ui.combo(modeHandle, modes, "Mode");
|
||||
if (modeHandle.changed) {
|
||||
var deferred = UITrait.inst.viewportMode == ViewRender || UITrait.inst.viewportMode == ViewPathTrace;
|
||||
if (deferred) {
|
||||
RenderPath.active.commands = RenderPathDeferred.commands;
|
||||
}
|
||||
else {
|
||||
if (RenderPathForward.path == null) RenderPathForward.init(RenderPath.active);
|
||||
RenderPath.active.commands = RenderPathForward.commands;
|
||||
}
|
||||
MaterialParser.parseMeshMaterial();
|
||||
}
|
||||
|
||||
if (Log.messageTimer > 0) {
|
||||
var _w = ui._w;
|
||||
ui._w = Std.int(ui.ops.font.width(ui.fontSize, Log.message) + 65 * ui.SCALE());
|
||||
|
||||
Reference in New Issue
Block a user