Skip to content

Commit

Permalink
VOXEDIT: show normal panel in c&c mode only
Browse files Browse the repository at this point in the history
see issue #536
  • Loading branch information
mgerhardy committed Oct 22, 2024
1 parent 3e6d37b commit 2af7c05
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/tools/voxedit/modules/voxedit-ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "WindowTitles.h"
#include "command/Command.h"
#include "core/ArrayLength.h"
#include "core/ConfigVar.h"
#include "core/Log.h"
#include "core/String.h"
#include "core/StringUtil.h"
Expand Down Expand Up @@ -254,6 +255,7 @@ bool MainWindow::init() {
_assetPanel.init();
_animationTimeline.init();
_animationPanel.init();
_menuBar.init();

for (int i = 0; i < lengthof(TEMPLATEMODELS); ++i) {
_texturePool->load(TEMPLATEMODELS[i].name, (const uint8_t *)TEMPLATEMODELS[i].imageData,
Expand Down Expand Up @@ -386,7 +388,9 @@ void MainWindow::configureLeftBottomWidgetDock(ImGuiID dockId) {
void MainWindow::leftWidget() {
command::CommandExecutionListener &listener = _app->commandListener();
_palettePanel.update(TITLE_PALETTE, listener);
_normalPalettePanel.update(TITLE_NORMALPALETTE, listener);
if (_viewMode->intVal() == (int)ViewMode::CommandAndConquer) {
_normalPalettePanel.update(TITLE_NORMALPALETTE, listener);
}
if (_lastSceneMode) {
_nodeInspectorPanel.update(TITLE_NODE_INSPECTOR, true, listener);
} else {
Expand Down Expand Up @@ -959,6 +963,9 @@ void MainWindow::update() {
if (!initScenes()) {
Log::error("Failed to update scenes");
}
if (_viewMode->intVal() != (int)ViewMode::CommandAndConquer) {
core::Var::getSafe(cfg::RenderNormals)->setVal(false);
}
}

ImGuiViewport *viewport = ImGui::GetMainViewport();
Expand Down
7 changes: 6 additions & 1 deletion src/tools/voxedit/modules/voxedit-ui/MenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ void MenuBar::viewportOptions() {
ImGui::IconCheckboxVar(ICON_LC_BONE, _("Bones"), cfg::VoxEditShowBones);
ImGui::BeginDisabled(core::Var::get(cfg::VoxelMeshMode)->intVal() != (int)voxel::SurfaceExtractionType::Cubic);
ImGui::IconCheckboxVar(ICON_LC_BOX, _("Outlines"), cfg::RenderOutline);
ImGui::IconCheckboxVar(ICON_LC_BOX, _("Normals"), cfg::RenderNormals);
if (core::Var::getSafe(cfg::VoxEditViewMode)->intVal() == (int)ViewMode::CommandAndConquer) {
ImGui::IconCheckboxVar(ICON_LC_BOX, _("Normals"), cfg::RenderNormals);
}
ImGui::IconCheckboxVar(ICON_LC_BRICK_WALL, _("Checkerboard"), cfg::RenderCheckerBoard);
ImGui::EndDisabled();
ImGui::IconCheckboxVar(ICON_LC_SUNSET, _("Shadow"), cfg::VoxEditRendershadow);
ImGui::IconCheckboxVar(ICON_LC_SUN, _("Bloom"), cfg::ClientBloom);
ImGui::IconSliderVarInt(ICON_LC_ECLIPSE, _("Tone mapping"), cfg::ToneMapping, 0, 3);
}

void MenuBar::init() {
}

bool MenuBar::update(ui::IMGUIApp *app, command::CommandExecutionListener &listener) {
core_trace_scoped(MenuBar);
bool resetDockLayout = false;
Expand Down
1 change: 1 addition & 0 deletions src/tools/voxedit/modules/voxedit-ui/MenuBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MenuBar : public ui::Panel {
*/
void colorReductionOptions();
static void viewportOptions();
void init();
bool update(ui::IMGUIApp *app, command::CommandExecutionListener &listener);
#ifdef IMGUI_ENABLE_TEST_ENGINE
void registerUITests(ImGuiTestEngine *engine, const char *id) override {
Expand Down

0 comments on commit 2af7c05

Please sign in to comment.