mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 06:19:57 -05:00
Revert native ui back to F1 keybind for toggling
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
@@ -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<ImGuiContext*> _contexts;
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user