From 67b2676c1522a64e9f41ebe1f63c6daa7b052b8b Mon Sep 17 00:00:00 2001 From: Arnaud Jamin Date: Sat, 22 Mar 2025 21:24:43 -0400 Subject: [PATCH] Move back toggle selection shortcut in selection window --- Plugins/Cog/Source/Cog/Private/CogSubsystem.cpp | 1 - Plugins/Cog/Source/Cog/Public/CogWindow_Settings.h | 4 ---- .../CogEngine/Private/CogEngineWindow_Selection.cpp | 10 +++++++--- .../CogEngine/Private/CogEngineWindow_TimeScale.cpp | 4 ++-- .../CogEngine/Public/CogEngineWindow_Selection.h | 4 ++++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Plugins/Cog/Source/Cog/Private/CogSubsystem.cpp b/Plugins/Cog/Source/Cog/Private/CogSubsystem.cpp index bead50a..8c37cc4 100644 --- a/Plugins/Cog/Source/Cog/Private/CogSubsystem.cpp +++ b/Plugins/Cog/Source/Cog/Private/CogSubsystem.cpp @@ -81,7 +81,6 @@ void UCogSubsystem::TryInitialize(UWorld& World) UCogWindowConfig_Settings* SettingsPtr = Settings.Get(); AddShortcut(SettingsPtr, &UCogWindowConfig_Settings::Shortcut_ToggleImguiInput).BindLambda([this] () { ToggleInputMode(); }); - AddShortcut(SettingsPtr, &UCogWindowConfig_Settings::Shortcut_ToggleSelection).BindLambda([this] (){ SetActivateSelectionMode(!GetActivateSelectionMode()); }); AddShortcut(SettingsPtr, &UCogWindowConfig_Settings::Shortcut_LoadLayout1).BindLambda([this] (){ LoadLayout(1); }); AddShortcut(SettingsPtr, &UCogWindowConfig_Settings::Shortcut_LoadLayout2).BindLambda([this] (){ LoadLayout(2); }); AddShortcut(SettingsPtr, &UCogWindowConfig_Settings::Shortcut_LoadLayout3).BindLambda([this] (){ LoadLayout(3); }); diff --git a/Plugins/Cog/Source/Cog/Public/CogWindow_Settings.h b/Plugins/Cog/Source/Cog/Public/CogWindow_Settings.h index 4743530..e287f13 100644 --- a/Plugins/Cog/Source/Cog/Public/CogWindow_Settings.h +++ b/Plugins/Cog/Source/Cog/Public/CogWindow_Settings.h @@ -99,9 +99,6 @@ public: UPROPERTY(Config) FInputChord Shortcut_ToggleImguiInput = FInputChord(EKeys::F1); - UPROPERTY(Config) - FInputChord Shortcut_ToggleSelection = FInputChord(EKeys::F5); - UPROPERTY(Config) FInputChord Shortcut_LoadLayout1 = FInputChord(EKeys::F2); @@ -155,7 +152,6 @@ public: WidgetAlignment = ECogWidgetAlignment::Right; ShowWidgetBorders = false; Shortcut_ToggleImguiInput = FInputChord(EKeys::F1); - Shortcut_ToggleSelection = FInputChord(EKeys::F5); Shortcut_LoadLayout1 = FInputChord(EKeys::F2); Shortcut_LoadLayout2 = FInputChord(EKeys::F3); Shortcut_LoadLayout3 = FInputChord(EKeys::F4); diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp index 13becb5..1fdc994 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp @@ -30,6 +30,8 @@ void FCogEngineWindow_Selection::Initialize() Config = GetConfig(); + GetOwner()->AddShortcut(Config.Get(), &UCogEngineConfig_Selection::Shortcut_ToggleSelection).BindLambda([this] (){ GetOwner()->SetActivateSelectionMode(!GetOwner()->GetActivateSelectionMode()); }); + Asset = GetAsset(); FCogConsoleCommandManager::RegisterWorldConsoleCommand( @@ -339,9 +341,11 @@ void FCogEngineWindow_Selection::RenderPickButtonTooltip() { if (FCogWidgets::BeginItemTooltipWrappedText()) { - const FString Shortcut = FCogImguiInputHelper::InputChordToString(GetOwner()->GetSettings()->Shortcut_ToggleSelection); - ImGui::Text("Enter selection mode to select an actor on screen. Change which actor type is selectable by clicking the selection combobox\n" - "%s", TCHAR_TO_ANSI(*Shortcut)); + ImGui::Text("Enter selection mode to select an actor on screen. Change which actor type is selectable by clicking the selection combobox\n"); + ImGui::Spacing(); + ImGui::Separator(); + FCogWidgets::TextOfAllInputChordsOfConfig(*Config.Get()); + FCogWidgets::EndItemTooltipWrappedText(); } } diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_TimeScale.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_TimeScale.cpp index 4fa9ac8..e4469b6 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_TimeScale.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_TimeScale.cpp @@ -129,13 +129,13 @@ void FCogEngineWindow_TimeScale::RenderMainMenuWidget() } else { - if (ImGui::BeginItemTooltip()) + if (FCogWidgets::BeginItemTooltipWrappedText()) { ImGui::Text("Time Scale: x%g", TimeDilation); ImGui::Spacing(); ImGui::Separator(); FCogWidgets::TextOfAllInputChordsOfConfig(*Config.Get()); - ImGui::EndTooltip(); + FCogWidgets::EndItemTooltipWrappedText(); } } } diff --git a/Plugins/Cog/Source/CogEngine/Public/CogEngineWindow_Selection.h b/Plugins/Cog/Source/CogEngine/Public/CogEngineWindow_Selection.h index 81430e7..8502017 100644 --- a/Plugins/Cog/Source/CogEngine/Public/CogEngineWindow_Selection.h +++ b/Plugins/Cog/Source/CogEngine/Public/CogEngineWindow_Selection.h @@ -86,6 +86,9 @@ public: UPROPERTY(Config) int32 SelectedClassIndex = 0; + UPROPERTY(Config) + FInputChord Shortcut_ToggleSelection = FInputChord(EKeys::F5); + virtual void Reset() override { Super::Reset(); @@ -93,5 +96,6 @@ public: bReapplySelection = true; SelectionName.Reset(); SelectedClassIndex = 0; + Shortcut_ToggleSelection = FInputChord(EKeys::F5); } }; \ No newline at end of file