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
@@ -157,9 +157,9 @@ void FCogEngineWindow_Cheats::TryReapplyCheats()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
bool FCogEngineWindow_Cheats::DrawTable() bool FCogEngineWindow_Cheats::DrawTable()
{ {
const bool Open = ImGui::BeginTable("Cheats", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize); const bool Open = ImGui::BeginTable("Cheats", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize);
ImGui::TableSetupColumn("Toggle", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Toggle", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("Instant", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Instant", ImGuiTableColumnFlags_WidthStretch);
return Open; return Open;
} }
@@ -203,7 +203,7 @@ void FCogEngineWindow_Cheats::RenderContent()
ImGui::BeginDisabled(); ImGui::BeginDisabled();
} }
ImGui::Checkbox("Reapply Cheats Between Launches", &Config->bReapplyCheatsBetweenLaunches); ImGui::Checkbox("Reapply Cheats Between Launches", &Config->bReapplyCheatsBetweenLaunches);
if (Config->bReapplyCheatsBetweenPlays == false) if (Config->bReapplyCheatsBetweenPlays == false)
{ {
ImGui::EndDisabled(); ImGui::EndDisabled();
@@ -232,7 +232,7 @@ void FCogEngineWindow_Cheats::RenderContent()
{ {
if (IsSelected) if (IsSelected)
{ {
Config->SelectedCategories.Add(CheatCategory.Name); Config->SelectedCategories.Add(CheatCategory.Name);
} }
else else
{ {
@@ -254,7 +254,7 @@ void FCogEngineWindow_Cheats::RenderContent()
if (Config->bGroupByCategories == false && Config->bUseTwoColumns) if (Config->bGroupByCategories == false && Config->bUseTwoColumns)
{ {
OpenTable = DrawTable(); OpenTable = DrawTable();
} }
for (const FCogEngineCheatCategory& CheatCategory : Asset->CheatCategories) for (const FCogEngineCheatCategory& CheatCategory : Asset->CheatCategories)
{ {
@@ -266,73 +266,67 @@ 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); if (Open && Config->bUseTwoColumns)
{
ImGui::PopStyleColor(3); DrawTable();
}
if (Open && Config->bUseTwoColumns)
{
DrawTable();
}
} }
if (Open) if (Open)
{ {
if (Config->bUseTwoColumns) if (Config->bUseTwoColumns)
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
} }
int Index = 0; int Index = 0;
for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects)
{ {
AddCheat(Index, ControlledActor, SelectedActor, Cheat, true); AddCheat(Index, ControlledActor, SelectedActor, Cheat, true);
Index++; Index++;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Update the config of applied cheat to reapply them on the next launch. // 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 // 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. // the state of the cheat is lagging when connected to a server.
// So we check if the array should be updated all the time. // So we check if the array should be updated all the time.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
if (SelectedActor == ControlledActor) if (SelectedActor == ControlledActor)
{ {
for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects) for (const FCogEngineCheat& Cheat : CheatCategory.PersistentEffects)
{ {
TArray<AActor*> Targets = { SelectedActor }; TArray<AActor*> Targets = { SelectedActor };
if (ACogEngineReplicator::IsCheatActiveOnTargets(Targets, Cheat) == ECogEngineCheat_ActiveState::Active) if (ACogEngineReplicator::IsCheatActiveOnTargets(Targets, Cheat) == ECogEngineCheat_ActiveState::Active)
{ {
Config->AppliedCheats.AddUnique(Cheat.Name); Config->AppliedCheats.AddUnique(Cheat.Name);
} }
else else
{ {
Config->AppliedCheats.Remove(Cheat.Name); Config->AppliedCheats.Remove(Cheat.Name);
} }
} }
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
Index = 0; Index = 0;
for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects) for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects)
{ {
AddCheat(Index, ControlledActor, SelectedActor, Cheat, false); AddCheat(Index, ControlledActor, SelectedActor, Cheat, false);
Index++; Index++;
} }
if (Config->bGroupByCategories && Config->bUseTwoColumns) if (Config->bGroupByCategories && Config->bUseTwoColumns)
{ {
ImGui::EndTable(); ImGui::EndTable();
} }
} }
} }
if (OpenTable) if (OpenTable)
{ {
@@ -350,7 +344,7 @@ bool FCogEngineWindow_Cheats::AddCheat(const int32 Index, AActor* ControlledActo
ImGui::PushID(Index); 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 IsShiftDown = (ImGui::GetCurrentContext()->IO.KeyMods & ImGuiMod_Shift) != 0;
const bool IsAltDown = (ImGui::GetCurrentContext()->IO.KeyMods & ImGuiMod_Alt) != 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(); ImGui::EndTooltip();
} }
FCogWindowWidgets::PopBackColor(); FCogWindowWidgets::PopBackColor();
ImGui::PopID(); ImGui::PopID();
@@ -455,19 +449,19 @@ const FCogEngineCheat* FCogEngineWindow_Cheats::FindCheatByName(const FString& C
if (OnlyPersistentCheats) if (OnlyPersistentCheats)
{ {
continue; continue;
} }
for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects) for (const FCogEngineCheat& Cheat : CheatCategory.InstantEffects)
{ {
if (Cheat.Name == CheatName) if (Cheat.Name == CheatName)
{ {
return &Cheat; return &Cheat;
} }
} }
} }
return nullptr; return nullptr;
} }
@@ -17,7 +17,7 @@ void FCogEngineWindow_Plots::Initialize()
Config = GetConfig<UCogEngineConfig_Plots>(); Config = GetConfig<UCogEngineConfig_Plots>();
FCogDebugPlot::Clear(); FCogDebugPlot::Clear();
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -173,30 +173,30 @@ void FCogEngineWindow_Plots::RenderMenu()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_Plots::RenderEntryName(const int Index, FCogDebugPlotEntry& Entry) void FCogEngineWindow_Plots::RenderEntryName(const int Index, FCogDebugPlotEntry& Entry)
{ {
ImGui::PushID(Index); ImGui::PushID(Index);
const bool IsAssignedToRow = Entry.GraphIndex != INDEX_NONE; const bool IsAssignedToRow = Entry.GraphIndex != INDEX_NONE;
if (ImGui::Selectable(TCHAR_TO_ANSI(*Entry.Name.ToString()), IsAssignedToRow, ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::Selectable(TCHAR_TO_ANSI(*Entry.Name.ToString()), IsAssignedToRow, ImGuiSelectableFlags_AllowDoubleClick))
{ {
if (IsAssignedToRow) if (IsAssignedToRow)
{ {
Entry.ResetGraphAndAxis(); Entry.ResetGraphAndAxis();
} }
else else
{ {
Entry.AssignGraphAndAxis(0, ImAxis_Y1); Entry.AssignGraphAndAxis(0, ImAxis_Y1);
} }
} }
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))
{ {
const auto EntryName = StringCast<ANSICHAR>(*Entry.Name.ToString()); const auto EntryName = StringCast<ANSICHAR>(*Entry.Name.ToString());
ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1); ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1);
ImGui::Text("%s", EntryName.Get()); ImGui::Text("%s", EntryName.Get());
ImGui::EndDragDropSource(); ImGui::EndDragDropSource();
} }
ImGui::PopID(); ImGui::PopID();
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -211,30 +211,23 @@ 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())
{ {
ImGui::TextDisabled("No event added yet"); ImGui::TextDisabled("No event added yet");
} }
else else
{ {
for (FCogDebugPlotEntry& Event : FCogDebugPlot::Events) for (FCogDebugPlotEntry& Event : FCogDebugPlot::Events)
{ {
RenderEntryName(Index, Event); RenderEntryName(Index, Event);
Index++; Index++;
} }
} }
} }
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())
{ {
@@ -242,14 +235,13 @@ void FCogEngineWindow_Plots::RenderAllEntriesNames(const ImVec2& InSize)
} }
else else
{ {
for (FCogDebugPlotEntry& Plot : FCogDebugPlot::Plots) for (FCogDebugPlotEntry& Plot : FCogDebugPlot::Plots)
{ {
RenderEntryName(Index, Plot); RenderEntryName(Index, Plot);
Index++; Index++;
} }
} }
} }
ImGui::PopStyleColor(3);
if (Config->DockEntries) if (Config->DockEntries)
{ {
@@ -56,14 +56,10 @@ 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);
const bool PushColor = (SpawnGroup.Color != FColor::Transparent); const bool PushColor = (SpawnGroup.Color != FColor::Transparent);
if (PushColor) if (PushColor)
@@ -92,8 +88,6 @@ void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator,
ImGui::PopID(); ImGui::PopID();
GroupIndex++; GroupIndex++;
} }
ImGui::PopStyleColor(3);
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -117,7 +111,7 @@ bool FCogEngineWindow_Spawns::RenderSpawnAsset(ACogEngineReplicator& Replicator,
if (ImGui::Button(TCHAR_TO_ANSI(*EntryName), ImVec2(-1, 0))) if (ImGui::Button(TCHAR_TO_ANSI(*EntryName), ImVec2(-1, 0)))
{ {
IsPressed = true; IsPressed = true;
Replicator.Server_Spawn(SpawnEntry); Replicator.Server_Spawn(SpawnEntry);
} }
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
@@ -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)
{ {
@@ -1088,7 +1099,7 @@ bool FCogWindowWidgets::BeginRightAlign(const char* Id)
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogWindowWidgets::EndRightAlign() void FCogWindowWidgets::EndRightAlign()
{ {
ImGui::EndTable(); ImGui::EndTable();
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -1116,7 +1127,7 @@ bool FCogWindowWidgets::BrowseToAssetButton(const UObject* InAsset, const ImVec2
ImGui::BeginDisabled(); ImGui::BeginDisabled();
} }
const bool result = ImGui::Button("Browse To Asset", InSize); const bool result = ImGui::Button("Browse To Asset", InSize);
if (result) if (result)
{ {
IAssetTools::Get().SyncBrowserToAssets({ InAsset }); IAssetTools::Get().SyncBrowserToAssets({ InAsset });
@@ -1139,10 +1150,10 @@ bool FCogWindowWidgets::BrowseToObjectAssetButton(const UObject* InObject, const
#if WITH_EDITOR #if WITH_EDITOR
const UObject* ObjectAsset = nullptr; const UObject* ObjectAsset = nullptr;
if (InObject != nullptr && InObject->GetClass() != nullptr) if (InObject != nullptr && InObject->GetClass() != nullptr)
{ {
ObjectAsset = InObject->GetClass()->ClassGeneratedBy; ObjectAsset = InObject->GetClass()->ClassGeneratedBy;
} }
return BrowseToAssetButton(ObjectAsset, InSize); return BrowseToAssetButton(ObjectAsset, InSize);
@@ -1163,12 +1174,12 @@ bool FCogWindowWidgets::OpenAssetButton(const UObject* InAsset, const ImVec2& In
ImGui::BeginDisabled(); ImGui::BeginDisabled();
} }
const bool result = ImGui::Button("Open Asset", InSize); const bool result = ImGui::Button("Open Asset", InSize);
if (result) if (result)
{ {
if (editorSubsystem != nullptr) if (editorSubsystem != nullptr)
{ {
editorSubsystem->OpenEditorForAsset(InAsset); editorSubsystem->OpenEditorForAsset(InAsset);
} }
} }
@@ -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);
@@ -101,7 +103,7 @@ public:
static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, TSubclassOf<AActor> ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr); static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, TSubclassOf<AActor> ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, const TArray<TSubclassOf<AActor>>& 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<TSubclassOf<AActor>>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
static bool ActorsListWithFilters(AActor*& NewSelection, const UWorld& World, const TArray<TSubclassOf<AActor>>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr); static bool ActorsListWithFilters(AActor*& NewSelection, const UWorld& World, const TArray<TSubclassOf<AActor>>& 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 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));
}; };
@@ -54,19 +54,19 @@ void FCogAbilityWindow_Attributes::RenderTick(float DeltaTime)
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Attributes::FormatAttributeSetName(FString& AttributeSetName) void FCogAbilityWindow_Attributes::FormatAttributeSetName(FString& AttributeSetName)
{ {
if (Config->AttributeSetPrefixes.IsEmpty() == false) if (Config->AttributeSetPrefixes.IsEmpty() == false)
{ {
TArray<FString> Prefixes; TArray<FString> Prefixes;
Config->AttributeSetPrefixes.ParseIntoArray(Prefixes, TEXT(";")); Config->AttributeSetPrefixes.ParseIntoArray(Prefixes, TEXT(";"));
for (const FString& Prefix : Prefixes) for (const FString& Prefix : Prefixes)
{ {
if (AttributeSetName.RemoveFromStart(Prefix, ESearchCase::IgnoreCase)) if (AttributeSetName.RemoveFromStart(Prefix, ESearchCase::IgnoreCase))
{ {
break; break;
} }
} }
} }
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -143,13 +143,13 @@ void FCogAbilityWindow_Attributes::RenderContent()
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
for (const UAttributeSet* AttributeSet : AbilitySystemComponent->GetSpawnedAttributes()) for (const UAttributeSet* AttributeSet : AbilitySystemComponent->GetSpawnedAttributes())
{ {
if (AttributeSet == nullptr) if (AttributeSet == nullptr)
{ continue; } { continue; }
ImGui::PushID(TCHAR_TO_ANSI(*AttributeSet->GetName())); ImGui::PushID(TCHAR_TO_ANSI(*AttributeSet->GetName()));
FString AttributeSetName = AttributeSet->GetName(); FString AttributeSetName = AttributeSet->GetName();
FormatAttributeSetName(AttributeSetName); FormatAttributeSetName(AttributeSetName);
const auto AttributeSetNameStr = StringCast<ANSICHAR>(*AttributeSetName); const auto AttributeSetNameStr = StringCast<ANSICHAR>(*AttributeSetName);
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
@@ -161,7 +161,7 @@ void FCogAbilityWindow_Attributes::RenderContent()
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); 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); bOpenAttributeSet = ImGui::TreeNodeEx(AttributeSetNameStr.Get(), ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_SpanAllColumns | ImGuiTreeNodeFlags_LabelSpanAllColumns);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
@@ -273,8 +273,8 @@ void FCogAbilityWindow_Attributes::RenderContent()
ImGui::TableNextRow(); ImGui::TableNextRow();
//------------------------ //------------------------
// Selectable // Selectable
//------------------------ //------------------------
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::Selectable("", Selected == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::Selectable("", Selected == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowDoubleClick))
{ {
@@ -304,8 +304,8 @@ void FCogAbilityWindow_Attributes::RenderContent()
ImGui::PushStyleColor(ImGuiCol_Text, Color); ImGui::PushStyleColor(ImGuiCol_Text, Color);
//------------------------ //------------------------
// Attribute Set // Attribute Set
//------------------------ //------------------------
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%s", AttributeSetNameStr.Get()); 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) void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemComponent& AbilitySystemComponent, const char* AttributeSetName, const FGameplayAttribute& Attribute, bool IsForTooltip)
{ {
ImGuiTableFlags TableFlags = IsForTooltip ? ImGuiTableFlags_Borders 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 BaseValue = AbilitySystemComponent.GetNumericAttributeBase(Attribute);
const float CurrentValue = AbilitySystemComponent.GetNumericAttribute(Attribute); const float CurrentValue = AbilitySystemComponent.GetNumericAttribute(Attribute);
if (ImGui::BeginTable("Details", 2, TableFlags)) 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("Property");
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
if (IsForTooltip == false) if (IsForTooltip == false)
{ {
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
} }
//------------------------ //------------------------
// Attribute Set // Attribute Set
@@ -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))
{ {
@@ -460,8 +456,8 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Effect"); ImGui::TextColored(TextColor, "Effect");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%s", TCHAR_TO_ANSI(*FCogAbilityHelper::CleanupName(GetNameSafe(ActiveEffect->Spec.Def)))); 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) if (ModInfo.SourceTags.RequireTags.IsEmpty() == false)
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "SourceTags - Require"); ImGui::TextColored(TextColor, "SourceTags - Require");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.RequireTags, false); FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.RequireTags, false);
} }
if (ModInfo.SourceTags.IgnoreTags.IsEmpty() == false) if (ModInfo.SourceTags.IgnoreTags.IsEmpty() == false)
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "SourceTags - Ignore"); ImGui::TextColored(TextColor, "SourceTags - Ignore");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.IgnoreTags, false); FCogAbilityHelper::RenderTagContainer(ModInfo.SourceTags.IgnoreTags, false);
} }
if (ModInfo.SourceTags.TagQuery.IsEmpty() == false) if (ModInfo.SourceTags.TagQuery.IsEmpty() == false)
@@ -507,20 +503,20 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo
if (ModInfo.TargetTags.RequireTags.IsEmpty() == false) if (ModInfo.TargetTags.RequireTags.IsEmpty() == false)
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "TargetTags - Require"); ImGui::TextColored(TextColor, "TargetTags - Require");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.RequireTags, false); FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.RequireTags, false);
} }
if (ModInfo.TargetTags.IgnoreTags.IsEmpty() == false) if (ModInfo.TargetTags.IgnoreTags.IsEmpty() == false)
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "TargetTags - Ignore"); ImGui::TextColored(TextColor, "TargetTags - Ignore");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.IgnoreTags, false); FCogAbilityHelper::RenderTagContainer(ModInfo.TargetTags.IgnoreTags, false);
} }
if (ModInfo.TargetTags.TagQuery.IsEmpty() == false) if (ModInfo.TargetTags.TagQuery.IsEmpty() == false)
@@ -537,8 +533,6 @@ void FCogAbilityWindow_Attributes::RenderAttributeDetails(const UAbilitySystemCo
} }
} }
ImGui::PopStyleColor(3);
ModifierIndex++; ModifierIndex++;
} }
} }
@@ -564,7 +558,7 @@ void FCogAbilityWindow_Attributes::RenderOpenAttributes()
{ {
const FGameplayAttribute& Attribute = OpenedAttributes[i]; const FGameplayAttribute& Attribute = OpenedAttributes[i];
FString AttributeSetName = Attribute.GetAttributeSetClass()->GetFName().ToString(); FString AttributeSetName = Attribute.GetAttributeSetClass()->GetFName().ToString();
FormatAttributeSetName(AttributeSetName); FormatAttributeSetName(AttributeSetName);
const FString WindowName = AttributeSetName + FString(" - ") + Attribute.GetName(); const FString WindowName = AttributeSetName + FString(" - ") + Attribute.GetName();