From d7bd68618fa30ccf6319460ace43e0e19ad9ccba Mon Sep 17 00:00:00 2001 From: Arnaud Jamin Date: Fri, 17 Jan 2025 11:27:17 -0500 Subject: [PATCH] CogAbility: Plot Window minor UI tweak --- .../Private/CogEngineWindow_Cheats.cpp | 132 +++++++++--------- .../Private/CogEngineWindow_Plots.cpp | 80 +++++------ .../Private/CogEngineWindow_Spawns.cpp | 14 +- .../CogWindow/Private/CogWindowWidgets.cpp | 28 ++-- .../CogWindow/Public/CogWindowWidgets.h | 6 +- .../Private/CogAbilityWindow_Attributes.cpp | 102 +++++++------- 6 files changed, 175 insertions(+), 187 deletions(-) diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp index 6eec55d..2f00585 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Cheats.cpp @@ -157,9 +157,9 @@ void FCogEngineWindow_Cheats::TryReapplyCheats() //-------------------------------------------------------------------------------------------------------------------------- bool FCogEngineWindow_Cheats::DrawTable() { - const bool Open = ImGui::BeginTable("Cheats", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize); - ImGui::TableSetupColumn("Toggle", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("Instant", ImGuiTableColumnFlags_WidthStretch); + const bool Open = ImGui::BeginTable("Cheats", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize); + ImGui::TableSetupColumn("Toggle", ImGuiTableColumnFlags_WidthStretch); + ImGui::TableSetupColumn("Instant", ImGuiTableColumnFlags_WidthStretch); return Open; } @@ -203,7 +203,7 @@ void FCogEngineWindow_Cheats::RenderContent() ImGui::BeginDisabled(); } - ImGui::Checkbox("Reapply Cheats Between Launches", &Config->bReapplyCheatsBetweenLaunches); + ImGui::Checkbox("Reapply Cheats Between Launches", &Config->bReapplyCheatsBetweenLaunches); if (Config->bReapplyCheatsBetweenPlays == false) { ImGui::EndDisabled(); @@ -232,7 +232,7 @@ void FCogEngineWindow_Cheats::RenderContent() { if (IsSelected) { - Config->SelectedCategories.Add(CheatCategory.Name); + Config->SelectedCategories.Add(CheatCategory.Name); } else { @@ -254,7 +254,7 @@ void FCogEngineWindow_Cheats::RenderContent() if (Config->bGroupByCategories == false && Config->bUseTwoColumns) { OpenTable = DrawTable(); - } + } for (const FCogEngineCheatCategory& CheatCategory : Asset->CheatCategories) { @@ -266,73 +266,67 @@ void FCogEngineWindow_Cheats::RenderContent() bool Open = true; if (Config->bGroupByCategories) { - ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255)); + Open = FCogWindowWidgets::DarkCollapsingHeader(CategoryStr.Get(), ImGuiTreeNodeFlags_DefaultOpen); - Open = ImGui::CollapsingHeader(CategoryStr.Get(), ImGuiTreeNodeFlags_DefaultOpen); - - ImGui::PopStyleColor(3); - - if (Open && Config->bUseTwoColumns) - { - DrawTable(); - } + if (Open && Config->bUseTwoColumns) + { + DrawTable(); + } } - if (Open) - { + if (Open) + { if (Config->bUseTwoColumns) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); } - int Index = 0; - for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) - { - AddCheat(Index, ControlledActor, SelectedActor, Cheat, true); - Index++; - } + int Index = 0; + for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) + { + AddCheat(Index, ControlledActor, SelectedActor, Cheat, true); + Index++; + } - //---------------------------------------------------------------------------- - // Update the config of applied cheat to reapply them on the next launch. - // We do not update them only when the user input is pressed because - // the state of the cheat is lagging when connected to a server. - // So we check if the array should be updated all the time. - //---------------------------------------------------------------------------- - if (SelectedActor == ControlledActor) - { - for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) - { - TArray Targets = { SelectedActor }; - if (ACogEngineReplicator::IsCheatActiveOnTargets(Targets, Cheat) == ECogEngineCheat_ActiveState::Active) - { - Config->AppliedCheats.AddUnique(Cheat.Name); - } - else - { - Config->AppliedCheats.Remove(Cheat.Name); - } - } - } + //---------------------------------------------------------------------------- + // Update the config of applied cheat to reapply them on the next launch. + // We do not update them only when the user input is pressed because + // the state of the cheat is lagging when connected to a server. + // So we check if the array should be updated all the time. + //---------------------------------------------------------------------------- + if (SelectedActor == ControlledActor) + { + for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) + { + TArray Targets = { SelectedActor }; + if (ACogEngineReplicator::IsCheatActiveOnTargets(Targets, Cheat) == ECogEngineCheat_ActiveState::Active) + { + Config->AppliedCheats.AddUnique(Cheat.Name); + } + else + { + Config->AppliedCheats.Remove(Cheat.Name); + } + } + } - ImGui::TableNextColumn(); + ImGui::TableNextColumn(); - Index = 0; - for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects) - { - AddCheat(Index, ControlledActor, SelectedActor, Cheat, false); - Index++; - } + Index = 0; + for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects) + { + AddCheat(Index, ControlledActor, SelectedActor, Cheat, false); + Index++; + } if (Config->bGroupByCategories && Config->bUseTwoColumns) { - ImGui::EndTable(); + ImGui::EndTable(); } - } - } + } + } if (OpenTable) { @@ -350,7 +344,7 @@ bool FCogEngineWindow_Cheats::AddCheat(const int32 Index, AActor* ControlledActo ImGui::PushID(Index); - FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Cheat.CustomColor)); + FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Cheat.CustomColor)); const bool IsShiftDown = (ImGui::GetCurrentContext()->IO.KeyMods & ImGuiMod_Shift) != 0; const bool IsAltDown = (ImGui::GetCurrentContext()->IO.KeyMods & ImGuiMod_Alt) != 0; @@ -386,7 +380,7 @@ bool FCogEngineWindow_Cheats::AddCheat(const int32 Index, AActor* ControlledActo ImGui::EndTooltip(); } - FCogWindowWidgets::PopBackColor(); + FCogWindowWidgets::PopBackColor(); ImGui::PopID(); @@ -455,19 +449,19 @@ const FCogEngineCheat* FCogEngineWindow_Cheats::FindCheatByName(const FString& C if (OnlyPersistentCheats) { - continue; + continue; } - for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects) - { - if (Cheat.Name == CheatName) - { - return &Cheat; - } - } + for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects) + { + if (Cheat.Name == CheatName) + { + return &Cheat; + } + } - } + } return nullptr; } diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Plots.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Plots.cpp index f274ec9..b0c6f28 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Plots.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Plots.cpp @@ -17,7 +17,7 @@ void FCogEngineWindow_Plots::Initialize() Config = GetConfig(); - FCogDebugPlot::Clear(); + FCogDebugPlot::Clear(); } //-------------------------------------------------------------------------------------------------------------------------- @@ -173,30 +173,30 @@ void FCogEngineWindow_Plots::RenderMenu() //-------------------------------------------------------------------------------------------------------------------------- void FCogEngineWindow_Plots::RenderEntryName(const int Index, FCogDebugPlotEntry& Entry) { - ImGui::PushID(Index); + ImGui::PushID(Index); - const bool IsAssignedToRow = Entry.GraphIndex != INDEX_NONE; - if (ImGui::Selectable(TCHAR_TO_ANSI(*Entry.Name.ToString()), IsAssignedToRow, ImGuiSelectableFlags_AllowDoubleClick)) - { - if (IsAssignedToRow) - { + const bool IsAssignedToRow = Entry.GraphIndex != INDEX_NONE; + if (ImGui::Selectable(TCHAR_TO_ANSI(*Entry.Name.ToString()), IsAssignedToRow, ImGuiSelectableFlags_AllowDoubleClick)) + { + if (IsAssignedToRow) + { Entry.ResetGraphAndAxis(); - } - else - { + } + else + { Entry.AssignGraphAndAxis(0, ImAxis_Y1); - } - } + } + } - if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) - { - const auto EntryName = StringCast(*Entry.Name.ToString()); - ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1); - ImGui::Text("%s", EntryName.Get()); - ImGui::EndDragDropSource(); - } + if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) + { + const auto EntryName = StringCast(*Entry.Name.ToString()); + ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1); + ImGui::Text("%s", EntryName.Get()); + ImGui::EndDragDropSource(); + } - ImGui::PopID(); + ImGui::PopID(); } //-------------------------------------------------------------------------------------------------------------------------- @@ -211,30 +211,23 @@ void FCogEngineWindow_Plots::RenderAllEntriesNames(const ImVec2& InSize) int Index = 0; - ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255)); - if (ImGui::CollapsingHeader("Events", ImGuiTreeNodeFlags_DefaultOpen)) + if (FCogWindowWidgets::DarkCollapsingHeader("Events", ImGuiTreeNodeFlags_DefaultOpen)) { - if (FCogDebugPlot::Events.IsEmpty()) - { - ImGui::TextDisabled("No event added yet"); - } + if (FCogDebugPlot::Events.IsEmpty()) + { + ImGui::TextDisabled("No event added yet"); + } else { - for (FCogDebugPlotEntry& Event : FCogDebugPlot::Events) - { - RenderEntryName(Index, Event); - Index++; - } + for (FCogDebugPlotEntry& Event : FCogDebugPlot::Events) + { + RenderEntryName(Index, Event); + Index++; + } } } - ImGui::PopStyleColor(3); - ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255)); - if (ImGui::CollapsingHeader("Plots", ImGuiTreeNodeFlags_DefaultOpen)) + if (FCogWindowWidgets::DarkCollapsingHeader("Plots", ImGuiTreeNodeFlags_DefaultOpen)) { if (FCogDebugPlot::Plots.IsEmpty()) { @@ -242,14 +235,13 @@ void FCogEngineWindow_Plots::RenderAllEntriesNames(const ImVec2& InSize) } else { - for (FCogDebugPlotEntry& Plot : FCogDebugPlot::Plots) - { - RenderEntryName(Index, Plot); - Index++; - } + for (FCogDebugPlotEntry& Plot : FCogDebugPlot::Plots) + { + RenderEntryName(Index, Plot); + Index++; + } } } - ImGui::PopStyleColor(3); if (Config->DockEntries) { diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Spawns.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Spawns.cpp index d318013..258d04f 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Spawns.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Spawns.cpp @@ -56,14 +56,10 @@ void FCogEngineWindow_Spawns::RenderContent() //-------------------------------------------------------------------------------------------------------------------------- void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup) { - ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255)); - - if (ImGui::CollapsingHeader(TCHAR_TO_ANSI(*SpawnGroup.Name), ImGuiTreeNodeFlags_DefaultOpen)) + if (FCogWindowWidgets::DarkCollapsingHeader(TCHAR_TO_ANSI(*SpawnGroup.Name), ImGuiTreeNodeFlags_DefaultOpen)) { - int32 GroupIndex = 0; - ImGui::PushID(GroupIndex); + int32 GroupIndex = 0; + ImGui::PushID(GroupIndex); const bool PushColor = (SpawnGroup.Color != FColor::Transparent); if (PushColor) @@ -92,8 +88,6 @@ void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, ImGui::PopID(); GroupIndex++; } - - ImGui::PopStyleColor(3); } //-------------------------------------------------------------------------------------------------------------------------- @@ -117,7 +111,7 @@ bool FCogEngineWindow_Spawns::RenderSpawnAsset(ACogEngineReplicator& Replicator, if (ImGui::Button(TCHAR_TO_ANSI(*EntryName), ImVec2(-1, 0))) { IsPressed = true; - Replicator.Server_Spawn(SpawnEntry); + Replicator.Server_Spawn(SpawnEntry); } ImGui::PopStyleVar(1); diff --git a/Plugins/Cog/Source/CogWindow/Private/CogWindowWidgets.cpp b/Plugins/Cog/Source/CogWindow/Private/CogWindowWidgets.cpp index a063124..991df58 100644 --- a/Plugins/Cog/Source/CogWindow/Private/CogWindowWidgets.cpp +++ b/Plugins/Cog/Source/CogWindow/Private/CogWindowWidgets.cpp @@ -67,6 +67,17 @@ void FCogWindowWidgets::ThinSeparatorText(const char* Label) ImGui::PopStyleVar(); } +//-------------------------------------------------------------------------------------------------------------------------- +bool FCogWindowWidgets::DarkCollapsingHeader(const char* InLabel, ImGuiTreeNodeFlags InFlags) +{ + ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); + ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204)); + ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255)); + const bool open = ImGui::CollapsingHeader(InLabel, InFlags); + ImGui::PopStyleColor(3); + return open; +} + //-------------------------------------------------------------------------------------------------------------------------- void FCogWindowWidgets::ProgressBarCentered(float Fraction, const ImVec2& Size, const char* Overlay) { @@ -1088,7 +1099,7 @@ bool FCogWindowWidgets::BeginRightAlign(const char* Id) //-------------------------------------------------------------------------------------------------------------------------- void FCogWindowWidgets::EndRightAlign() { - ImGui::EndTable(); + ImGui::EndTable(); } //-------------------------------------------------------------------------------------------------------------------------- @@ -1116,7 +1127,7 @@ bool FCogWindowWidgets::BrowseToAssetButton(const UObject* InAsset, const ImVec2 ImGui::BeginDisabled(); } - const bool result = ImGui::Button("Browse To Asset", InSize); + const bool result = ImGui::Button("Browse To Asset", InSize); if (result) { IAssetTools::Get().SyncBrowserToAssets({ InAsset }); @@ -1139,10 +1150,10 @@ bool FCogWindowWidgets::BrowseToObjectAssetButton(const UObject* InObject, const #if WITH_EDITOR const UObject* ObjectAsset = nullptr; - if (InObject != nullptr && InObject->GetClass() != nullptr) - { + if (InObject != nullptr && InObject->GetClass() != nullptr) + { ObjectAsset = InObject->GetClass()->ClassGeneratedBy; - } + } return BrowseToAssetButton(ObjectAsset, InSize); @@ -1163,12 +1174,12 @@ bool FCogWindowWidgets::OpenAssetButton(const UObject* InAsset, const ImVec2& In ImGui::BeginDisabled(); } - const bool result = ImGui::Button("Open Asset", InSize); + const bool result = ImGui::Button("Open Asset", InSize); if (result) { if (editorSubsystem != nullptr) { - editorSubsystem->OpenEditorForAsset(InAsset); + editorSubsystem->OpenEditorForAsset(InAsset); } } @@ -1204,4 +1215,5 @@ bool FCogWindowWidgets::OpenObjectAssetButton(const UObject* InObject, const ImV - \ No newline at end of file + + diff --git a/Plugins/Cog/Source/CogWindow/Public/CogWindowWidgets.h b/Plugins/Cog/Source/CogWindow/Public/CogWindowWidgets.h index 24b929e..408984b 100644 --- a/Plugins/Cog/Source/CogWindow/Public/CogWindowWidgets.h +++ b/Plugins/Cog/Source/CogWindow/Public/CogWindowWidgets.h @@ -33,6 +33,8 @@ public: static void ThinSeparatorText(const char* Label); + static bool DarkCollapsingHeader(const char* InLabel, ImGuiTreeNodeFlags InFlags); + static void ProgressBarCentered(float Fraction, const ImVec2& Size, const char* Overlay); static bool ToggleMenuButton(bool* Value, const char* Text, const ImVec4& TrueColor); @@ -101,7 +103,7 @@ public: static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, TSubclassOf ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr); - static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, const TArray>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr); + static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, const TArray>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr); static bool ActorsListWithFilters(AActor*& NewSelection, const UWorld& World, const TArray>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr); @@ -127,7 +129,7 @@ public: static bool OpenAssetButton(const UObject* InAsset, const ImVec2& InSize = ImVec2(0, 0)); - static bool OpenObjectAssetButton(const UObject* InObject, const ImVec2& InSize = ImVec2(0, 0)); + static bool OpenObjectAssetButton(const UObject* InObject, const ImVec2& InSize = ImVec2(0, 0)); }; diff --git a/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Attributes.cpp b/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Attributes.cpp index beb605d..69c00f7 100644 --- a/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Attributes.cpp +++ b/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Attributes.cpp @@ -54,19 +54,19 @@ void FCogAbilityWindow_Attributes::RenderTick(float DeltaTime) //-------------------------------------------------------------------------------------------------------------------------- void FCogAbilityWindow_Attributes::FormatAttributeSetName(FString& AttributeSetName) { - if (Config->AttributeSetPrefixes.IsEmpty() == false) - { - TArray Prefixes; - Config->AttributeSetPrefixes.ParseIntoArray(Prefixes, TEXT(";")); + if (Config->AttributeSetPrefixes.IsEmpty() == false) + { + TArray Prefixes; + Config->AttributeSetPrefixes.ParseIntoArray(Prefixes, TEXT(";")); - for (const FString& Prefix : Prefixes) - { - if (AttributeSetName.RemoveFromStart(Prefix, ESearchCase::IgnoreCase)) - { - break; - } - } - } + for (const FString& Prefix : Prefixes) + { + if (AttributeSetName.RemoveFromStart(Prefix, ESearchCase::IgnoreCase)) + { + break; + } + } + } } //-------------------------------------------------------------------------------------------------------------------------- @@ -143,13 +143,13 @@ void FCogAbilityWindow_Attributes::RenderContent() //------------------------------------------------------------------------------------------ for (const UAttributeSet* AttributeSet : AbilitySystemComponent->GetSpawnedAttributes()) { - if (AttributeSet == nullptr) - { continue; } + if (AttributeSet == nullptr) + { continue; } ImGui::PushID(TCHAR_TO_ANSI(*AttributeSet->GetName())); FString AttributeSetName = AttributeSet->GetName(); - FormatAttributeSetName(AttributeSetName); + FormatAttributeSetName(AttributeSetName); const auto AttributeSetNameStr = StringCast(*AttributeSetName); //------------------------------------------------------------------------------------------ @@ -161,7 +161,7 @@ void FCogAbilityWindow_Attributes::RenderContent() ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::PushStyleColor(ImGuiCol_Text, FCogImguiHelper::ToImVec4(Config->AttributeSetColor)); + ImGui::PushStyleColor(ImGuiCol_Text, FCogImguiHelper::ToImVec4(Config->AttributeSetColor)); bOpenAttributeSet = ImGui::TreeNodeEx(AttributeSetNameStr.Get(), ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_SpanAllColumns | ImGuiTreeNodeFlags_LabelSpanAllColumns); ImGui::PopStyleColor(); @@ -273,8 +273,8 @@ void FCogAbilityWindow_Attributes::RenderContent() ImGui::TableNextRow(); //------------------------ - // Selectable - //------------------------ + // Selectable + //------------------------ ImGui::TableNextColumn(); if (ImGui::Selectable("", Selected == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowDoubleClick)) { @@ -304,8 +304,8 @@ void FCogAbilityWindow_Attributes::RenderContent() ImGui::PushStyleColor(ImGuiCol_Text, Color); //------------------------ - // Attribute Set - //------------------------ + // Attribute Set + //------------------------ ImGui::TableNextColumn(); ImGui::Text("%s", AttributeSetNameStr.Get()); @@ -364,22 +364,22 @@ void FCogAbilityWindow_Attributes::RenderContent() void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemComponent& AbilitySystemComponent, const char* AttributeSetName, const FGameplayAttribute& Attribute, bool IsForTooltip) { ImGuiTableFlags TableFlags = IsForTooltip ? ImGuiTableFlags_Borders - : ImGuiTableFlags_Borders | ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_Resizable; + : ImGuiTableFlags_Borders | ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_Resizable; const float BaseValue = AbilitySystemComponent.GetNumericAttributeBase(Attribute); const float CurrentValue = AbilitySystemComponent.GetNumericAttribute(Attribute); if (ImGui::BeginTable("Details", 2, TableFlags)) { - constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f); + constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f); ImGui::TableSetupColumn("Property"); ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch); if (IsForTooltip == false) { - ImGui::TableHeadersRow(); - } + ImGui::TableHeadersRow(); + } //------------------------ // Attribute Set @@ -443,14 +443,10 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo if (ModInfo.Attribute == Attribute) { - ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255)); - char Buffer[128]; ImFormatString(Buffer, IM_ARRAYSIZE(Buffer), "Modifier %d", ModifierIndex); - if (ImGui::CollapsingHeader(Buffer, ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_DefaultOpen)) + if (FCogWindowWidgets::DarkCollapsingHeader(Buffer, ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::BeginTable("Details", 2, TableFlags)) { @@ -460,8 +456,8 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch); ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextColored(TextColor, "Effect"); + ImGui::TableNextColumn(); + ImGui::TextColored(TextColor, "Effect"); ImGui::TableNextColumn(); ImGui::Text("%s", TCHAR_TO_ANSI(*FCogAbilityHelper::CleanupName(GetNameSafe(ActiveEffect->Spec.Def)))); @@ -479,20 +475,20 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo if (ModInfo.SourceTags.RequireTags.IsEmpty() == false) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextColored(TextColor, "SourceTags - Require"); - ImGui::TableNextColumn(); - FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.RequireTags, false); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextColored(TextColor, "SourceTags - Require"); + ImGui::TableNextColumn(); + FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.RequireTags, false); } if (ModInfo.SourceTags.IgnoreTags.IsEmpty() == false) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextColored(TextColor, "SourceTags - Ignore"); - ImGui::TableNextColumn(); - FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.IgnoreTags, false); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextColored(TextColor, "SourceTags - Ignore"); + ImGui::TableNextColumn(); + FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.IgnoreTags, false); } if (ModInfo.SourceTags.TagQuery.IsEmpty() == false) @@ -507,20 +503,20 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo if (ModInfo.TargetTags.RequireTags.IsEmpty() == false) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextColored(TextColor, "TargetTags - Require"); - ImGui::TableNextColumn(); - FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.RequireTags, false); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextColored(TextColor, "TargetTags - Require"); + ImGui::TableNextColumn(); + FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.RequireTags, false); } if (ModInfo.TargetTags.IgnoreTags.IsEmpty() == false) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextColored(TextColor, "TargetTags - Ignore"); - ImGui::TableNextColumn(); - FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.IgnoreTags, false); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextColored(TextColor, "TargetTags - Ignore"); + ImGui::TableNextColumn(); + FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.IgnoreTags, false); } if (ModInfo.TargetTags.TagQuery.IsEmpty() == false) @@ -537,8 +533,6 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo } } - ImGui::PopStyleColor(3); - ModifierIndex++; } } @@ -564,7 +558,7 @@ void FCogAbilityWindow_Attributes::RenderOpenAttributes() { const FGameplayAttribute& Attribute = OpenedAttributes[i]; - FString AttributeSetName = Attribute.GetAttributeSetClass()->GetFName().ToString(); + FString AttributeSetName = Attribute.GetAttributeSetClass()->GetFName().ToString(); FormatAttributeSetName(AttributeSetName); const FString WindowName = AttributeSetName + FString(" - ") + Attribute.GetName();