CogAbility: Plot Window minor UI tweak

This commit is contained in:
Arnaud Jamin
2025-01-17 11:27:17 -05:00
parent 6d8f7cb975
commit d7bd68618f
6 changed files with 175 additions and 187 deletions
@@ -266,13 +266,7 @@ void FCogEngineWindow_Cheats::RenderContent()
bool Open = true; bool Open = true;
if (Config->bGroupByCategories) if (Config->bGroupByCategories)
{ {
ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); Open = FCogWindowWidgets::DarkCollapsingHeader(CategoryStr.Get(), ImGuiTreeNodeFlags_DefaultOpen);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204));
ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255));
Open = ImGui::CollapsingHeader(CategoryStr.Get(), ImGuiTreeNodeFlags_DefaultOpen);
ImGui::PopStyleColor(3);
if (Open && Config->bUseTwoColumns) if (Open && Config->bUseTwoColumns)
{ {
@@ -211,10 +211,7 @@ void FCogEngineWindow_Plots::RenderAllEntriesNames(const ImVec2& InSize)
int Index = 0; int Index = 0;
ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); if (FCogWindowWidgets::DarkCollapsingHeader("Events", ImGuiTreeNodeFlags_DefaultOpen))
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 (FCogDebugPlot::Events.IsEmpty()) if (FCogDebugPlot::Events.IsEmpty())
{ {
@@ -229,12 +226,8 @@ void FCogEngineWindow_Plots::RenderAllEntriesNames(const ImVec2& InSize)
} }
} }
} }
ImGui::PopStyleColor(3);
ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); if (FCogWindowWidgets::DarkCollapsingHeader("Plots", ImGuiTreeNodeFlags_DefaultOpen))
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 (FCogDebugPlot::Plots.IsEmpty()) if (FCogDebugPlot::Plots.IsEmpty())
{ {
@@ -249,7 +242,6 @@ void FCogEngineWindow_Plots::RenderAllEntriesNames(const ImVec2& InSize)
} }
} }
} }
ImGui::PopStyleColor(3);
if (Config->DockEntries) if (Config->DockEntries)
{ {
@@ -56,11 +56,7 @@ void FCogEngineWindow_Spawns::RenderContent()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup) void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup)
{ {
ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79)); if (FCogWindowWidgets::DarkCollapsingHeader(TCHAR_TO_ANSI(*SpawnGroup.Name), ImGuiTreeNodeFlags_DefaultOpen))
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))
{ {
int32 GroupIndex = 0; int32 GroupIndex = 0;
ImGui::PushID(GroupIndex); ImGui::PushID(GroupIndex);
@@ -92,8 +88,6 @@ void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator,
ImGui::PopID(); ImGui::PopID();
GroupIndex++; GroupIndex++;
} }
ImGui::PopStyleColor(3);
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -67,6 +67,17 @@ void FCogWindowWidgets::ThinSeparatorText(const char* Label)
ImGui::PopStyleVar(); 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) void FCogWindowWidgets::ProgressBarCentered(float Fraction, const ImVec2& Size, const char* Overlay)
{ {
@@ -1205,3 +1216,4 @@ bool FCogWindowWidgets::OpenObjectAssetButton(const UObject* InObject, const ImV
@@ -33,6 +33,8 @@ public:
static void ThinSeparatorText(const char* Label); 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 void ProgressBarCentered(float Fraction, const ImVec2& Size, const char* Overlay);
static bool ToggleMenuButton(bool* Value, const char* Text, const ImVec4& TrueColor); static bool ToggleMenuButton(bool* Value, const char* Text, const ImVec4& TrueColor);
@@ -443,14 +443,10 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo
if (ModInfo.Attribute == Attribute) 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]; char Buffer[128];
ImFormatString(Buffer, IM_ARRAYSIZE(Buffer), "Modifier %d", ModifierIndex); 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)) if (ImGui::BeginTable("Details", 2, TableFlags))
{ {
@@ -537,8 +533,6 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo
} }
} }
ImGui::PopStyleColor(3);
ModifierIndex++; ModifierIndex++;
} }
} }