diff --git a/data/assets/util/default_keybindings.asset b/data/assets/util/default_keybindings.asset index 354567f430..c0a5d13ece 100644 --- a/data/assets/util/default_keybindings.asset +++ b/data/assets/util/default_keybindings.asset @@ -3,36 +3,10 @@ local propertyHelper = asset.require('./property_helper') local Keybindings = { { - Key = "F2", - Name = "Show Scene Menu", - Command = -[[local b = openspace.getPropertyValue('Modules.ImGUI.Main.SceneProperties.Enabled'); -local c = openspace.getPropertyValue('Modules.ImGUI.Main.IsHidden'); -openspace.setPropertyValue('Modules.ImGUI.*.Enabled', false); -if b and c then - -- This can happen if the main properties window is enabled, the main gui is enabled - -- and then closed again. So the main properties window is enabled, but also all - -- windows are hidden - openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', false); - openspace.setPropertyValueSingle('Modules.ImGUI.Main.SceneProperties.Enabled', true); - openspace.setPropertyValueSingle('Modules.ImGUI.Main.SpaceTime.Enabled', true); -else - openspace.setPropertyValueSingle('Modules.ImGUI.Main.SceneProperties.Enabled', not b); - openspace.setPropertyValueSingle('Modules.ImGUI.Main.SpaceTime.Enabled', not b); - openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', b); -end]], - Documentation = "Shows or hides the properties window", - GuiPath = "/Native GUI", - Local = true - }, - { - Key = "F3", - Name = "Show Global Menu", - Command = -[[local b = openspace.getPropertyValue('Modules.ImGUI.Main.Enabled'); -openspace.setPropertyValueSingle('Modules.ImGUI.Main.Enabled', not b); -openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', b);]], - Documentation = "Shows or hides the entire user interface", + Key = "F1", + Name = "Show Native GUI", + Command = propertyHelper.invert('Modules.ImGUI.Main.Enabled'), + Documentation = "Shows or hides the native UI", GuiPath = "/Native GUI", Local = true }, diff --git a/modules/imgui/include/gui.h b/modules/imgui/include/gui.h index f104f7e296..8fc344f152 100644 --- a/modules/imgui/include/gui.h +++ b/modules/imgui/include/gui.h @@ -94,8 +94,6 @@ public: uint32_t mouseButtonsPressed); void endFrame(); - void setHidden(bool isHidden); - void render() override; //protected: @@ -169,7 +167,6 @@ private: properties::Property::Visibility _currentVisibility = properties::Property::Visibility::Developer; - properties::BoolProperty _allHidden; std::vector _contexts; }; diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index 3c6321be20..a77a6b41cf 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -130,12 +130,10 @@ GUI::GUI() ) , _showHelpText(ShowHelpInfo, true) , _helpTextDelay(HelpTextDelayInfo, 1.0, 0.0, 10.0) - , _allHidden(HiddenInfo, true) { for (GuiComponent* comp : _components) { addPropertySubOwner(comp); } - _featuredProperties.setEnabled(true); _spaceTime.setEnabled(true); { @@ -159,8 +157,6 @@ GUI::GUI() _helpTextDelay.onChange(std::move(helpTextDelayFunc)); addProperty(_helpTextDelay); } - - addProperty(_allHidden); } GUI::~GUI() {} // NOLINT @@ -427,10 +423,8 @@ void GUI::endFrame() { _performance.render(); } - if (!_allHidden) { - if (_isEnabled) { - render(); - } + if (_isEnabled) { + render(); for (GuiComponent* comp : _components) { if (comp->isEnabled()) { @@ -441,6 +435,10 @@ void GUI::endFrame() { ImGui::Render(); + const bool shouldRender = _performance.isEnabled() || _isEnabled; + if (!shouldRender) { + return; + } // Drawing ImDrawData* drawData = ImGui::GetDrawData(); @@ -706,9 +704,4 @@ void GUI::renderAndUpdatePropertyVisibility() { _featuredProperties.setVisibility(_currentVisibility); } -void GUI::setHidden(bool isHidden) { - _allHidden = isHidden; -} - - } // namespace openspace::gui