From c5f37596641b197718c64607236c31c1a8bd72da Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 24 Nov 2018 19:54:01 +0000 Subject: [PATCH] Moved console variables and commands to wrapper objects: - Moved property variables to ImGui Module Properties. - Moved console command to ImGui Module Commands (one for now but more will be added). - ImGui Module Commands is created by ImGui Module Manager, what means that commands are registered after module is loaded and unregistered when it is unloaded. - Updated settings to allow more convenient use: Added global pointer to default object and event raised when it is loaded. --- Source/ImGui/Private/Editor/ImGuiEditor.cpp | 4 +- Source/ImGui/Private/ImGuiDemo.cpp | 13 +--- Source/ImGui/Private/ImGuiInputHandler.cpp | 7 +- .../Private/ImGuiInputHandlerFactory.cpp | 4 +- Source/ImGui/Private/ImGuiModule.cpp | 35 ++------- Source/ImGui/Private/ImGuiModuleCommands.cpp | 74 +++++++++++++++++++ Source/ImGui/Private/ImGuiModuleCommands.h | 35 +++++++++ Source/ImGui/Private/ImGuiModuleManager.h | 4 + .../ImGui/Private/ImGuiModuleProperties.cpp | 73 ++++++++++++++++++ Source/ImGui/Private/ImGuiModuleProperties.h | 57 ++++++++++++++ Source/ImGui/Private/ImGuiPrivatePCH.h | 1 + Source/ImGui/Private/ImGuiSettings.cpp | 36 ++++++--- Source/ImGui/Private/ImGuiSettings.h | 11 +++ Source/ImGui/Private/SImGuiWidget.cpp | 25 +------ 14 files changed, 299 insertions(+), 80 deletions(-) create mode 100644 Source/ImGui/Private/ImGuiModuleCommands.cpp create mode 100644 Source/ImGui/Private/ImGuiModuleCommands.h create mode 100644 Source/ImGui/Private/ImGuiModuleProperties.cpp create mode 100644 Source/ImGui/Private/ImGuiModuleProperties.h diff --git a/Source/ImGui/Private/Editor/ImGuiEditor.cpp b/Source/ImGui/Private/Editor/ImGuiEditor.cpp index 71c3605..026e8c8 100644 --- a/Source/ImGui/Private/Editor/ImGuiEditor.cpp +++ b/Source/ImGui/Private/Editor/ImGuiEditor.cpp @@ -50,7 +50,7 @@ FImGuiEditor::~FImGuiEditor() void FImGuiEditor::Register() { // Only register after UImGuiSettings class is initialized (necessary to check in early loading stages). - if (!bSettingsRegistered && UImGuiSettings::StaticClass()->IsValidLowLevelFast()) + if (!bSettingsRegistered && GImGuiSettings) { if (ISettingsModule* SettingsModule = GetSettingsModule()) { @@ -59,7 +59,7 @@ void FImGuiEditor::Register() SettingsModule->RegisterSettings(SETTINGS_CONTAINER, LOCTEXT("ImGuiSettingsName", "ImGui"), LOCTEXT("ImGuiSettingsDescription", "Configure the Unreal ImGui plugin."), - GetMutableDefault()); + GImGuiSettings); } } diff --git a/Source/ImGui/Private/ImGuiDemo.cpp b/Source/ImGui/Private/ImGuiDemo.cpp index c171738..7bc3fee 100644 --- a/Source/ImGui/Private/ImGuiDemo.cpp +++ b/Source/ImGui/Private/ImGuiDemo.cpp @@ -3,23 +3,12 @@ #include "ImGuiPrivatePCH.h" #include "ImGuiDemo.h" -#include "ImGuiModuleManager.h" -#include "Utilities/ScopeGuards.h" -namespace CVars -{ - TAutoConsoleVariable ShowDemo(TEXT("ImGui.ShowDemo"), 0, - TEXT("Show ImGui demo.\n") - TEXT("0: disabled (default)\n") - TEXT("1: enabled."), - ECVF_Default); -} - // Demo copied (with minor modifications) from ImGui examples. See https://github.com/ocornut/imgui. void FImGuiDemo::DrawControls(int32 ContextIndex) { - if (CVars::ShowDemo.GetValueOnGameThread() > 0) + if (FImGuiModuleProperties::Get().ShowDemo()) { const int32 ContextBit = ContextIndex < 0 ? 0 : 1 << ContextIndex; diff --git a/Source/ImGui/Private/ImGuiInputHandler.cpp b/Source/ImGui/Private/ImGuiInputHandler.cpp index 64fec4e..00a5217 100644 --- a/Source/ImGui/Private/ImGuiInputHandler.cpp +++ b/Source/ImGui/Private/ImGuiInputHandler.cpp @@ -26,7 +26,7 @@ FImGuiInputResponse UImGuiInputHandler::OnKeyDown(const FKeyEvent& KeyEvent) // If this is an input mode switch event then handle it here and consume. if (IsSwitchInputModeEvent(KeyEvent)) { - FImGuiModule::Get().ToggleInputMode(); + FImGuiModuleProperties::Get().ToggleInput(ECVF_SetByConsole); return FImGuiInputResponse().RequestConsume(); } @@ -91,8 +91,9 @@ namespace bool UImGuiInputHandler::IsSwitchInputModeEvent(const FKeyEvent& KeyEvent) const { - const FImGuiKeyInfo KeyInfo = GetDefault()->GetSwitchInputModeKey(); - return (KeyEvent.GetKey() == KeyInfo.Key) && AreModifiersMatching(KeyInfo, KeyEvent); + return GImGuiSettings + && (KeyEvent.GetKey() == GImGuiSettings->GetSwitchInputModeKey().Key) + && AreModifiersMatching(GImGuiSettings->GetSwitchInputModeKey(), KeyEvent); } bool UImGuiInputHandler::HasImGuiActiveItem() const diff --git a/Source/ImGui/Private/ImGuiInputHandlerFactory.cpp b/Source/ImGui/Private/ImGuiInputHandlerFactory.cpp index c6b13eb..3e599a5 100644 --- a/Source/ImGui/Private/ImGuiInputHandlerFactory.cpp +++ b/Source/ImGui/Private/ImGuiInputHandlerFactory.cpp @@ -11,9 +11,9 @@ UImGuiInputHandler* FImGuiInputHandlerFactory::NewHandler(FImGuiModuleManager* ModuleManager, UGameViewportClient* GameViewport, int32 ContextIndex) { UClass* HandlerClass = nullptr; - if (UImGuiSettings* Settings = GetMutableDefault()) + if (GImGuiSettings) { - const auto& HandlerClassReference = Settings->GetImGuiInputHandlerClass(); + const auto& HandlerClassReference = GImGuiSettings->GetImGuiInputHandlerClass(); if (HandlerClassReference.IsValid()) { HandlerClass = HandlerClassReference.TryLoadClass(); diff --git a/Source/ImGui/Private/ImGuiModule.cpp b/Source/ImGui/Private/ImGuiModule.cpp index b77b6f2..8f51c2f 100644 --- a/Source/ImGui/Private/ImGuiModule.cpp +++ b/Source/ImGui/Private/ImGuiModule.cpp @@ -20,27 +20,6 @@ #define LOCTEXT_NAMESPACE "FImGuiModule" -namespace CVars -{ - extern TAutoConsoleVariable InputEnabled; - extern TAutoConsoleVariable ShowDemo; -} - -namespace Commands -{ - const TCHAR* SwitchInputMode = TEXT("ImGui.SwitchInputMode"); -} - -void SwitchImGuiInputMode() -{ - FImGuiModule::Get().ToggleInputMode(); -} - -FAutoConsoleCommand SwitchInputModeCommand = FAutoConsoleCommand( - Commands::SwitchInputMode, - TEXT("Changes ImGui input mode."), - FConsoleCommandDelegate::CreateStatic(SwitchImGuiInputMode)); - struct EDelegateCategory { enum @@ -191,34 +170,32 @@ ImGuiContext** FImGuiModule::GetImGuiContextHandle() bool FImGuiModule::IsInputMode() const { - return CVars::InputEnabled.GetValueOnAnyThread() > 0; + return FImGuiModuleProperties::Get().IsInputEnabled(); } void FImGuiModule::SetInputMode(bool bEnabled) { - // This function is for supporting shortcut or subsitiute for console command, so we are using the same priority. - CVars::InputEnabled->Set(bEnabled ? 1 : 0, ECVF_SetByConsole); + return FImGuiModuleProperties::Get().SetInputEnabled(bEnabled); } void FImGuiModule::ToggleInputMode() { - SetInputMode(!IsInputMode()); + FImGuiModuleProperties::Get().ToggleInput(); } bool FImGuiModule::IsShowingDemo() const { - return CVars::ShowDemo.GetValueOnAnyThread() > 0; + return FImGuiModuleProperties::Get().ShowDemo(); } void FImGuiModule::SetShowDemo(bool bShow) { - // This function is for supporting shortcut or subsitiute for console command, so we are using the same priority. - CVars::ShowDemo->Set(bShow ? 1 : 0, ECVF_SetByConsole); + return FImGuiModuleProperties::Get().SetShowDemo(bShow); } void FImGuiModule::ToggleShowDemo() { - SetShowDemo(!IsShowingDemo()); + return FImGuiModuleProperties::Get().ToggleDemo(); } diff --git a/Source/ImGui/Private/ImGuiModuleCommands.cpp b/Source/ImGui/Private/ImGuiModuleCommands.cpp new file mode 100644 index 0000000..f8e2db6 --- /dev/null +++ b/Source/ImGui/Private/ImGuiModuleCommands.cpp @@ -0,0 +1,74 @@ +// Distributed under the MIT License (MIT) (see accompanying LICENSE file) + +#include "ImGuiPrivatePCH.h" + +#include "ImGuiModuleCommands.h" + +#include "ImGuiSettings.h" +#include "Utilities/DebugExecBindings.h" + + +namespace CommandNames +{ + namespace + { + const TCHAR* SwitchInputMode = TEXT("ImGui.SwitchInputMode"); + } +} + +FImGuiModuleCommands::FImGuiModuleCommands() + : ToggleInputCommand(CommandNames::SwitchInputMode, + TEXT("Switch ImGui input mode."), + FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleInput)) +{ + // Delegate initializer to support settings loaded after this object creation (in stand-alone builds) and potential + // reloading of settings. + UImGuiSettings::OnSettingsLoaded().AddRaw(this, &FImGuiModuleCommands::InitializeSettings); + + // Call initializer to support settings already loaded (editor). + InitializeSettings(); +} + +FImGuiModuleCommands::~FImGuiModuleCommands() +{ + UImGuiSettings::OnSettingsLoaded().RemoveAll(this); + UnregisterSettingsDelegates(); +} + +void FImGuiModuleCommands::InitializeSettings() +{ + RegisterSettingsDelegates(); + + // We manually update key bindings based on ImGui settings rather than using input configuration. This works out + // of the box in packed and staged builds and it helps to avoid ambiguities where ImGui settings are stored. + UpdateToggleInputKeyBinding(); +} + +void FImGuiModuleCommands::RegisterSettingsDelegates() +{ + if (GImGuiSettings && !GImGuiSettings->OnSwitchInputModeKeyChanged.IsBoundToObject(this)) + { + GImGuiSettings->OnSwitchInputModeKeyChanged.AddRaw(this, &FImGuiModuleCommands::UpdateToggleInputKeyBinding); + } +} + +void FImGuiModuleCommands::UnregisterSettingsDelegates() +{ + if (GImGuiSettings) + { + GImGuiSettings->OnSwitchInputModeKeyChanged.RemoveAll(this); + } +} + +void FImGuiModuleCommands::UpdateToggleInputKeyBinding() +{ + if (GImGuiSettings) + { + DebugExecBindings::UpdatePlayerInputs(GImGuiSettings->GetSwitchInputModeKey(), CommandNames::SwitchInputMode); + } +} + +void FImGuiModuleCommands::ToggleInput() +{ + FImGuiModuleProperties::Get().ToggleInput(ECVF_SetByConsole); +} diff --git a/Source/ImGui/Private/ImGuiModuleCommands.h b/Source/ImGui/Private/ImGuiModuleCommands.h new file mode 100644 index 0000000..b6077dc --- /dev/null +++ b/Source/ImGui/Private/ImGuiModuleCommands.h @@ -0,0 +1,35 @@ +// Distributed under the MIT License (MIT) (see accompanying LICENSE file) + +#pragma once + +#include + + +// Wrapper for ImGui console commands. +class FImGuiModuleCommands +{ + // Allow module manager to control life-cycle of this class. + friend class FImGuiModuleManager; + + FImGuiModuleCommands(); + ~FImGuiModuleCommands(); + + // Disable copy semantics. + FImGuiModuleCommands(const FImGuiModuleCommands&) = default; + FImGuiModuleCommands& operator=(const FImGuiModuleCommands&) = default; + + // Disable move semantics. + FImGuiModuleCommands(FImGuiModuleCommands&&) = default; + FImGuiModuleCommands& operator=(FImGuiModuleCommands&&) = default; + + void InitializeSettings(); + + void RegisterSettingsDelegates(); + void UnregisterSettingsDelegates(); + + void UpdateToggleInputKeyBinding(); + + void ToggleInput(); + + FAutoConsoleCommand ToggleInputCommand; +}; diff --git a/Source/ImGui/Private/ImGuiModuleManager.h b/Source/ImGui/Private/ImGuiModuleManager.h index ff87972..548560d 100644 --- a/Source/ImGui/Private/ImGuiModuleManager.h +++ b/Source/ImGui/Private/ImGuiModuleManager.h @@ -3,6 +3,7 @@ #pragma once #include "ImGuiContextManager.h" +#include "ImGuiModuleCommands.h" #include "SImGuiWidget.h" #include "TextureManager.h" @@ -56,6 +57,9 @@ private: // Event that we call after ImGui is updated. FSimpleMulticastDelegate PostImGuiUpdateEvent; + // Tying module console commands to life-cycle of this manager and module. + FImGuiModuleCommands Commands; + // Manager for ImGui contexts. FImGuiContextManager ContextManager; diff --git a/Source/ImGui/Private/ImGuiModuleProperties.cpp b/Source/ImGui/Private/ImGuiModuleProperties.cpp new file mode 100644 index 0000000..65fb730 --- /dev/null +++ b/Source/ImGui/Private/ImGuiModuleProperties.cpp @@ -0,0 +1,73 @@ +// Distributed under the MIT License (MIT) (see accompanying LICENSE file) + +#include "ImGuiPrivatePCH.h" + +#include "ImGuiModuleProperties.h" + + +FImGuiModuleProperties& FImGuiModuleProperties::Get() +{ + static FImGuiModuleProperties Instance; + return Instance; +} + +FImGuiModuleProperties::FImGuiModuleProperties() + : InputEnabledVariable(TEXT("ImGui.InputEnabled"), 0, + TEXT("Enable or disable ImGui input mode.\n") + TEXT("0: disabled (default)\n") + TEXT("1: enabled, input is routed to ImGui and with a few exceptions is consumed"), + ECVF_Default) + , InputNavigationVariable(TEXT("ImGui.InputNavigation"), 0, + TEXT("EXPERIMENTAL Set ImGui navigation mode.\n") + TEXT("0: navigation is disabled\n") + TEXT("1: keyboard navigation\n") + TEXT("2: gamepad navigation (gamepad input is consumed)\n") + TEXT("3: keyboard and gamepad navigation (gamepad input is consumed)"), + ECVF_Default) + , ShowDemoVariable(TEXT("ImGui.ShowDemo"), 0, + TEXT("Show ImGui demo.\n") + TEXT("0: disabled (default)\n") + TEXT("1: enabled."), + ECVF_Default) +{ +} + +bool FImGuiModuleProperties::IsInputEnabled() const +{ + return InputEnabledVariable->GetInt() > 0; +} + +void FImGuiModuleProperties::SetInputEnabled(bool bEnabled, EConsoleVariableFlags SetBy) +{ + InputEnabledVariable->Set(bEnabled ? 1 : 0, SetBy); +} + +void FImGuiModuleProperties::ToggleInput(EConsoleVariableFlags SetBy) +{ + SetInputEnabled(!IsInputEnabled(), SetBy); +} + +bool FImGuiModuleProperties::IsKeyboardNavigationEnabled() const +{ + return (InputNavigationVariable->GetInt() & 1) != 0; +} + +bool FImGuiModuleProperties::IsGamepadNavigationEnabled() const +{ + return (InputNavigationVariable->GetInt() & 2) != 0; +} + +bool FImGuiModuleProperties::ShowDemo() const +{ + return ShowDemoVariable->GetInt() > 0; +} + +void FImGuiModuleProperties::SetShowDemo(bool bEnabled, EConsoleVariableFlags SetBy) +{ + ShowDemoVariable->Set(bEnabled ? 1 : 0, SetBy); +} + +void FImGuiModuleProperties::ToggleDemo(EConsoleVariableFlags SetBy) +{ + SetShowDemo(!ShowDemo(), SetBy); +} diff --git a/Source/ImGui/Private/ImGuiModuleProperties.h b/Source/ImGui/Private/ImGuiModuleProperties.h new file mode 100644 index 0000000..b91ef11 --- /dev/null +++ b/Source/ImGui/Private/ImGuiModuleProperties.h @@ -0,0 +1,57 @@ +// Distributed under the MIT License (MIT) (see accompanying LICENSE file) + +#pragma once + +#include + + +// Collects and give access to module properties. +// TODO: For now singleton instance is initialized on the first use. Try to move it to the ImGui Manager. +class FImGuiModuleProperties +{ +public: + + // Get the instance of the ImGui properties. + static FImGuiModuleProperties& Get(); + + // Check whether input is enabled. + bool IsInputEnabled() const; + + // Set whether input should be enabled. + void SetInputEnabled(bool bEnabled, EConsoleVariableFlags SetBy = ECVF_SetByCode); + + // Toggle input state. + void ToggleInput(EConsoleVariableFlags SetBy = ECVF_SetByCode); + + // Check whether keyboard navigation is enabled. + bool IsKeyboardNavigationEnabled() const; + + // Check whether gamepad navigation is enabled. + bool IsGamepadNavigationEnabled() const; + + // Check whether demo should be visible. + bool ShowDemo() const; + + // Set whether demo should be visible. + void SetShowDemo(bool bEnabled, EConsoleVariableFlags SetBy = ECVF_SetByCode); + + // Toggle demo visibility. + void ToggleDemo(EConsoleVariableFlags SetBy = ECVF_SetByCode); + +private: + + FImGuiModuleProperties(); + + // Disable copy and move semantics. + FImGuiModuleProperties(const FImGuiModuleProperties&) = delete; + FImGuiModuleProperties& operator=(const FImGuiModuleProperties&) = delete; + + FImGuiModuleProperties(FImGuiModuleProperties&&) = delete; + FImGuiModuleProperties& operator=(FImGuiModuleProperties&&) = delete; + + TAutoConsoleVariable InputEnabledVariable; + + TAutoConsoleVariable InputNavigationVariable; + + TAutoConsoleVariable ShowDemoVariable; +}; diff --git a/Source/ImGui/Private/ImGuiPrivatePCH.h b/Source/ImGui/Private/ImGuiPrivatePCH.h index e193a86..531f105 100644 --- a/Source/ImGui/Private/ImGuiPrivatePCH.h +++ b/Source/ImGui/Private/ImGuiPrivatePCH.h @@ -3,6 +3,7 @@ // Module-wide macros #include "VersionCompatibility.h" #include "ImGuiModuleDebug.h" +#include "ImGuiModuleProperties.h" // Module #include "ImGuiModule.h" diff --git a/Source/ImGui/Private/ImGuiSettings.cpp b/Source/ImGui/Private/ImGuiSettings.cpp index a216200..34bb40a 100644 --- a/Source/ImGui/Private/ImGuiSettings.cpp +++ b/Source/ImGui/Private/ImGuiSettings.cpp @@ -3,7 +3,15 @@ #include "ImGuiPrivatePCH.h" #include "ImGuiSettings.h" -#include "Utilities/DebugExecBindings.h" + + +UImGuiSettings* GImGuiSettings = nullptr; + +FSimpleMulticastDelegate& UImGuiSettings::OnSettingsLoaded() +{ + static FSimpleMulticastDelegate Instance; + return Instance; +} UImGuiSettings::UImGuiSettings() @@ -20,19 +28,25 @@ UImGuiSettings::~UImGuiSettings() #endif } -namespace Commands -{ - extern const TCHAR* SwitchInputMode; -} - void UImGuiSettings::PostInitProperties() { Super::PostInitProperties(); - // Instead of saving binding to input config, we manually update DebugExecBindings from here. This has an advantage - // that there is no ambiguity where settings are stored and more importantly, it works out of the box in packed - // and staged builds. - DebugExecBindings::UpdatePlayerInputs(SwitchInputModeKey, Commands::SwitchInputMode); + if (IsTemplate()) + { + GImGuiSettings = this; + OnSettingsLoaded().Broadcast(); + } +} + +void UImGuiSettings::BeginDestroy() +{ + Super::BeginDestroy(); + + if (GImGuiSettings == this) + { + GImGuiSettings = nullptr; + } } #if WITH_EDITOR @@ -62,7 +76,7 @@ void UImGuiSettings::OnPropertyChanged(class UObject* ObjectBeingModified, struc } else if (UpdatedPropertyName == GET_MEMBER_NAME_CHECKED(UImGuiSettings, SwitchInputModeKey)) { - DebugExecBindings::UpdatePlayerInputs(SwitchInputModeKey, Commands::SwitchInputMode); + OnSwitchInputModeKeyChanged.Broadcast(); } else if (UpdatedPropertyName == GET_MEMBER_NAME_CHECKED(UImGuiSettings, bUseSoftwareCursor)) { diff --git a/Source/ImGui/Private/ImGuiSettings.h b/Source/ImGui/Private/ImGuiSettings.h index fe6ad0e..ad3137c 100644 --- a/Source/ImGui/Private/ImGuiSettings.h +++ b/Source/ImGui/Private/ImGuiSettings.h @@ -50,6 +50,9 @@ class UImGuiSettings : public UObject public: + // Delegate raised when settings instance is loaded. + static FSimpleMulticastDelegate& OnSettingsLoaded(); + UImGuiSettings(); ~UImGuiSettings(); @@ -65,10 +68,14 @@ public: // Delegate raised when ImGuiInputHandlerClass property has changed. FSimpleMulticastDelegate OnImGuiInputHandlerClassChanged; + // Delegate raised when SwitchInputModeKey property has changed. + FSimpleMulticastDelegate OnSwitchInputModeKeyChanged; + // Delegate raised when SoftwareCursorEnabled property has changed. FSimpleMulticastDelegate OnSoftwareCursorChanged; virtual void PostInitProperties() override; + virtual void BeginDestroy() override; protected: @@ -102,3 +109,7 @@ private: #endif // WITH_EDITOR }; + +// Pointer to the settings instance (default class object) assigned right after it is initialized and valid until +// it is destroyed. +extern UImGuiSettings* GImGuiSettings; diff --git a/Source/ImGui/Private/SImGuiWidget.cpp b/Source/ImGui/Private/SImGuiWidget.cpp index 5f009e8..4b46c13 100644 --- a/Source/ImGui/Private/SImGuiWidget.cpp +++ b/Source/ImGui/Private/SImGuiWidget.cpp @@ -54,24 +54,6 @@ namespace constexpr const char* FontAtlasTextureName = "ImGuiModule_FontAtlas"; } - -namespace CVars -{ - TAutoConsoleVariable InputEnabled(TEXT("ImGui.InputEnabled"), 0, - TEXT("Enable or disable ImGui input mode.\n") - TEXT("0: disabled (default)\n") - TEXT("1: enabled, input is routed to ImGui and with a few exceptions is consumed"), - ECVF_Default); - - TAutoConsoleVariable InputNavigation(TEXT("ImGui.InputNavigation"), 0, - TEXT("EXPERIMENTAL Set ImGui navigation mode.\n") - TEXT("0: navigation is disabled\n") - TEXT("1: keyboard navigation\n") - TEXT("2: gamepad navigation (gamepad input is consumed)\n") - TEXT("3: keyboard and gamepad navigation (gamepad input is consumed)"), - ECVF_Default); -} - #if IMGUI_WIDGET_DEBUG namespace CVars { @@ -521,7 +503,7 @@ void SImGuiWidget::SetVisibilityFromInputEnabled() void SImGuiWidget::UpdateInputEnabled() { - const bool bEnabled = CVars::InputEnabled.GetValueOnGameThread() > 0; + const bool bEnabled = FImGuiModuleProperties::Get().IsInputEnabled(); if (bInputEnabled != bEnabled) { bInputEnabled = bEnabled; @@ -570,8 +552,9 @@ void SImGuiWidget::UpdateInputEnabled() if (bInputEnabled) { - InputState.SetKeyboardNavigationEnabled((CVars::InputNavigation.GetValueOnGameThread() & 1) != 0); - InputState.SetGamepadNavigationEnabled((CVars::InputNavigation.GetValueOnGameThread() & 2) != 0); + const auto& Properties = FImGuiModuleProperties::Get(); + InputState.SetKeyboardNavigationEnabled(Properties.IsKeyboardNavigationEnabled()); + InputState.SetGamepadNavigationEnabled(Properties.IsGamepadNavigationEnabled()); const auto& Application = FSlateApplication::Get().GetPlatformApplication(); InputState.SetGamepad(Application.IsValid() && Application->IsGamepadAttached()); }