mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 08:02:23 -07:00
Add help
This commit is contained in:
Binary file not shown.
@@ -9,6 +9,17 @@
|
||||
ImVec4 ActiveColor(1.0f, 0.8f, 0.0f, 1.0f);
|
||||
ImVec4 DeactiveColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Abilities::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window displays the gameplay abilities of the selected actor. "
|
||||
"Click the ability check box to force its activation or deactivation. "
|
||||
"Right click an ability to open or close the ability separate window. "
|
||||
"Use the 'Give Ability' menu to manually give an ability from a list defined in the '%s' data asset. "
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(AbilitiesAsset.Get())));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Abilities::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
@@ -107,7 +118,7 @@ void UCogAbilityWindow_Abilities::RenderAbiltiesMenu(AActor* Selection)
|
||||
{
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("Add"))
|
||||
if (ImGui::BeginMenu("Give Ability"))
|
||||
{
|
||||
if (AbilitiesAsset != nullptr)
|
||||
{
|
||||
|
||||
@@ -9,8 +9,15 @@
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogAbilityWindow_Attributes::UCogAbilityWindow_Attributes()
|
||||
void UCogAbilityWindow_Attributes::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window display the gameplay attributes of the selected actor. "
|
||||
"Attributes can be sorted by name, category or attribute set. "
|
||||
"Attributes with the Current value greater than the Base value are displayed in green. "
|
||||
"Attributes with the Current value lower than the Base value are displayed in red. "
|
||||
"Use the options 'Show Only Modified' to only show the attributes that have modifiers. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -19,98 +26,6 @@ void UCogAbilityWindow_Attributes::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
WindowFlags = ImGuiWindowFlags_MenuBar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
static void DrawAttributeInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FGameplayAttribute& Attribute)
|
||||
{
|
||||
if (ImGui::BeginTable("Attribute", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
const ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
ImGui::TableSetupColumn("Property");
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
const float BaseValue = AbilitySystemComponent.GetNumericAttributeBase(Attribute);
|
||||
const float CurrentValue = AbilitySystemComponent.GetNumericAttribute(Attribute);
|
||||
|
||||
ImVec4 Color;
|
||||
if (CurrentValue > BaseValue)
|
||||
{
|
||||
Color = ImVec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else if (CurrentValue < BaseValue)
|
||||
{
|
||||
Color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
//------------------------
|
||||
// Name
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Name");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*Attribute.GetName()));
|
||||
|
||||
//------------------------
|
||||
// Base Value
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Base Value");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%0.2f", BaseValue);
|
||||
|
||||
//------------------------
|
||||
// Current Value
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Current Value");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, Color);
|
||||
ImGui::Text("%0.2f", CurrentValue);
|
||||
ImGui::PopStyleColor(1);
|
||||
|
||||
//------------------------
|
||||
// Modifiers
|
||||
//------------------------
|
||||
FGameplayEffectQuery Query;
|
||||
for (const FActiveGameplayEffectHandle& ActiveHandle : AbilitySystemComponent.GetActiveEffects(Query))
|
||||
{
|
||||
const FActiveGameplayEffect* ActiveEffect = AbilitySystemComponent.GetActiveGameplayEffect(ActiveHandle);
|
||||
if (ActiveEffect == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < ActiveEffect->Spec.Modifiers.Num(); ++i)
|
||||
{
|
||||
const FModifierSpec& ModSpec = ActiveEffect->Spec.Modifiers[i];
|
||||
const FGameplayModifierInfo& ModInfo = ActiveEffect->Spec.Def->Modifiers[i];
|
||||
|
||||
if (ModInfo.Attribute == Attribute)
|
||||
{
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Effect");
|
||||
ImGui::TextColored(TextColor, "Operation");
|
||||
ImGui::TextColored(TextColor, "Magnitude");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*FCogAbilityHelper::CleanupName(GetNameSafe(ActiveEffect->Spec.Def))));
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*EGameplayModOpToString(ModInfo.ModifierOp)));
|
||||
ImGui::Text("%0.2f", ModSpec.GetEvaluatedMagnitude());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Attributes::RenderContent()
|
||||
{
|
||||
@@ -348,4 +263,97 @@ void UCogAbilityWindow_Attributes::RenderContent()
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Attributes::DrawAttributeInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FGameplayAttribute& Attribute)
|
||||
{
|
||||
if (ImGui::BeginTable("Attribute", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
const ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
ImGui::TableSetupColumn("Property");
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
const float BaseValue = AbilitySystemComponent.GetNumericAttributeBase(Attribute);
|
||||
const float CurrentValue = AbilitySystemComponent.GetNumericAttribute(Attribute);
|
||||
|
||||
ImVec4 Color;
|
||||
if (CurrentValue > BaseValue)
|
||||
{
|
||||
Color = ImVec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else if (CurrentValue < BaseValue)
|
||||
{
|
||||
Color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
//------------------------
|
||||
// Name
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Name");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*Attribute.GetName()));
|
||||
|
||||
//------------------------
|
||||
// Base Value
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Base Value");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%0.2f", BaseValue);
|
||||
|
||||
//------------------------
|
||||
// Current Value
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Current Value");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, Color);
|
||||
ImGui::Text("%0.2f", CurrentValue);
|
||||
ImGui::PopStyleColor(1);
|
||||
|
||||
//------------------------
|
||||
// Modifiers
|
||||
//------------------------
|
||||
FGameplayEffectQuery Query;
|
||||
for (const FActiveGameplayEffectHandle& ActiveHandle : AbilitySystemComponent.GetActiveEffects(Query))
|
||||
{
|
||||
const FActiveGameplayEffect* ActiveEffect = AbilitySystemComponent.GetActiveGameplayEffect(ActiveHandle);
|
||||
if (ActiveEffect == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < ActiveEffect->Spec.Modifiers.Num(); ++i)
|
||||
{
|
||||
const FModifierSpec& ModSpec = ActiveEffect->Spec.Modifiers[i];
|
||||
const FGameplayModifierInfo& ModInfo = ActiveEffect->Spec.Def->Modifiers[i];
|
||||
|
||||
if (ModInfo.Attribute == Attribute)
|
||||
{
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Effect");
|
||||
ImGui::TextColored(TextColor, "Operation");
|
||||
ImGui::TextColored(TextColor, "Magnitude");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*FCogAbilityHelper::CleanupName(GetNameSafe(ActiveEffect->Spec.Def))));
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*EGameplayModOpToString(ModInfo.ModifierOp)));
|
||||
ImGui::Text("%0.2f", ModSpec.GetEvaluatedMagnitude());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,20 @@
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Cheats::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to apply cheats to the selected actor (by default). "
|
||||
"The cheats can be configured in the '%s' data asset. "
|
||||
"When clicking a cheat button, press:\n"
|
||||
" [CTRL] to apply the cheat to controlled actor\n"
|
||||
" [ALT] to apply the cheat to the allies of the selected actor\n"
|
||||
" [SHIFT] to apply the cheat to the enemies of the selected actor\n"
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(CheatsAsset.Get()))
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Cheats::RenderContent()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,15 @@
|
||||
#include "EngineUtils.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window displays the gameplay effects of the selected actor. "
|
||||
"Mouse over an effect to see its details such as its modifiers and the gameplay tags it grants"
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
@@ -300,7 +309,7 @@ void UCogAbilityWindow_Effects::RenderRemainingTime(const UAbilitySystemComponen
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(100, 100, 100, 255));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 100));
|
||||
ImGui::ProgressBar(RemainingTime / Duration, ImVec2(FCogWindowWidgets::TextBaseWidth * 15, FCogWindowWidgets::TextBaseHeight * 0.8f), TCHAR_TO_ANSI(*FString::Printf(TEXT("%.2f / %.2f"), RemainingTime, Duration)));
|
||||
ImGui::ProgressBar(RemainingTime / Duration, ImVec2(FCogWindowWidgets::GetFontWidth() * 15, ImGui::GetTextLineHeightWithSpacing() * 0.8f), TCHAR_TO_ANSI(*FString::Printf(TEXT("%.2f / %.2f"), RemainingTime, Duration)));
|
||||
ImGui::PopStyleColor(2);
|
||||
}
|
||||
}
|
||||
@@ -318,7 +327,7 @@ void UCogAbilityWindow_Effects::RenderStacks(const FActiveGameplayEffect& Active
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(100, 100, 100, 255));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 100));
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::ProgressBar(CurrentStackCount / (float)Effect.StackLimitCount, ImVec2(FCogWindowWidgets::TextBaseWidth * 15, FCogWindowWidgets::TextBaseHeight * 0.8f), TCHAR_TO_ANSI(*FString::Printf(TEXT("%d / %d"), CurrentStackCount, Effect.StackLimitCount)));
|
||||
ImGui::ProgressBar(CurrentStackCount / (float)Effect.StackLimitCount, ImVec2(FCogWindowWidgets::GetFontWidth() * 15, ImGui::GetTextLineHeightWithSpacing() * 0.8f), TCHAR_TO_ANSI(*FString::Printf(TEXT("%d / %d"), CurrentStackCount, Effect.StackLimitCount)));
|
||||
ImGui::PopStyleColor(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,48 +4,13 @@
|
||||
#include "CogImguiHelper.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogAbilityWindow_Pools::UCogAbilityWindow_Pools()
|
||||
void UCogAbilityWindow_Pools::RenderHelp()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void DrawPool(const UAbilitySystemComponent* AbilitySystemComponent, const FCogAbilityPool& Pool)
|
||||
{
|
||||
if (AbilitySystemComponent->HasAttributeSetForAttribute(Pool.Max) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbilitySystemComponent->HasAttributeSetForAttribute(Pool.Value) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*Pool.Name));
|
||||
|
||||
const float Value = AbilitySystemComponent->GetNumericAttribute(Pool.Value);
|
||||
const float Max = AbilitySystemComponent->GetNumericAttribute(Pool.Max);
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Use a different format base on max value for all pools to be nicely aligned at the center
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const char* format = nullptr;
|
||||
if (Max >= 100) { format = "%3.0f / %3.0f"; } // |200 / 200| |__1 / 200| 3 characters with 0 floating point
|
||||
else if (Max >= 10) { format = "%4.1f / %4.1f"; } // |20.0 / 20.0| |_1.1 / 20.0| 4 characters with 1 floating point
|
||||
else { format = "%3.2f / %3.2f"; } // |2.00 / 2.00| |1.11 / 2.00| 3 characters with 2 floating points
|
||||
|
||||
char Buffer[64];
|
||||
ImFormatString(Buffer, IM_ARRAYSIZE(Buffer), format, Value, Max);
|
||||
|
||||
const float Ratio = Max > 0.0f ? Value / Max : 0.0f;
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, FCogImguiHelper::ToImVec4(Pool.Color));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, FCogImguiHelper::ToImVec4(Pool.BackColor));
|
||||
FCogWindowWidgets::ProgressBarCentered(Ratio, ImVec2(-1, 0), Buffer);
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::Text(
|
||||
"This window displays attributes of the selected actor as pools. "
|
||||
"The pools can be configured in the '%s' data asset."
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(PoolsAsset.Get()))
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -77,3 +42,44 @@ void UCogAbilityWindow_Pools::RenderContent()
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Pools::DrawPool(const UAbilitySystemComponent* AbilitySystemComponent, const FCogAbilityPool& Pool)
|
||||
{
|
||||
if (AbilitySystemComponent->HasAttributeSetForAttribute(Pool.Max) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbilitySystemComponent->HasAttributeSetForAttribute(Pool.Value) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*Pool.Name));
|
||||
|
||||
const float Value = AbilitySystemComponent->GetNumericAttribute(Pool.Value);
|
||||
const float Max = AbilitySystemComponent->GetNumericAttribute(Pool.Max);
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Use a different format base on max value for all pools to be nicely aligned at the center
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const char* format = nullptr;
|
||||
if (Max >= 100) { format = "%3.0f / %3.0f"; } // |200 / 200| |__1 / 200| 3 characters with 0 floating point
|
||||
else if (Max >= 10) { format = "%4.1f / %4.1f"; } // |20.0 / 20.0| |_1.1 / 20.0| 4 characters with 1 floating point
|
||||
else { format = "%3.2f / %3.2f"; } // |2.00 / 2.00| |1.11 / 2.00| 3 characters with 2 floating points
|
||||
|
||||
char Buffer[64];
|
||||
ImFormatString(Buffer, IM_ARRAYSIZE(Buffer), format, Value, Max);
|
||||
|
||||
const float Ratio = Max > 0.0f ? Value / Max : 0.0f;
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, FCogImguiHelper::ToImVec4(Pool.Color));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, FCogImguiHelper::ToImVec4(Pool.BackColor));
|
||||
FCogWindowWidgets::ProgressBarCentered(Ratio, ImVec2(-1, 0), Buffer);
|
||||
ImGui::PopStyleColor(2);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,37 @@
|
||||
#include "CogWindowWidgets.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
static void DrawTagInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FGameplayTag& Tag)
|
||||
void UCogAbilityWindow_Tags::RenderHelp()
|
||||
{
|
||||
ImGui::Text("This window displays gameplay tags of the selected actor. ");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Tags::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
Super::PreRender(WindowFlags);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Tags::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FGameplayTagContainer OwnedTags, BlockedTags;
|
||||
AbilitySystemComponent->GetOwnedGameplayTags(OwnedTags);
|
||||
AbilitySystemComponent->GetBlockedAbilityTags(BlockedTags);
|
||||
|
||||
DrawTagContainer("Owned Tags", *AbilitySystemComponent, OwnedTags);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Tags::DrawTag(const UAbilitySystemComponent& AbilitySystemComponent, const FGameplayTag& Tag)
|
||||
{
|
||||
if (ImGui::BeginTable("Tag", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
@@ -33,27 +63,6 @@ static void DrawTagInfo(const UAbilitySystemComponent& AbilitySystemComponent, c
|
||||
const int32 TagCount = AbilitySystemComponent.GetTagCount(Tag);
|
||||
ImGui::TextColored(TagCount > 1 ? ImVec4(1.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f), "%d", TagCount);
|
||||
|
||||
//------------------------
|
||||
// Abilities
|
||||
//------------------------
|
||||
//ImGui::TableNextRow();
|
||||
//ImGui::TableNextColumn();
|
||||
//ImGui::TextColored(TextColor, "Abilities");
|
||||
//ImGui::TableNextColumn();
|
||||
//for (FGameplayAbilitySpec AbilitySpec : AbilitySystemComponent.GetActivatableAbilities())
|
||||
//{
|
||||
// UGameplayAbility* Ability = AbilitySpec.GetPrimaryInstance() != nullptr ? AbilitySpec.GetPrimaryInstance() : AbilitySpec.Ability;
|
||||
// if (Ability == nullptr)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// if (Ability->ActivationOwnedTags GetActivationOwnedTags().HasTagExact(Tag))
|
||||
// {
|
||||
// ImGui::Text("%s", TCHAR_TO_ANSI(*FCogAbilityHelper::CleanupName(GetNameSafe(Ability))));
|
||||
// }
|
||||
//}
|
||||
|
||||
//------------------------
|
||||
// Effects
|
||||
//------------------------
|
||||
@@ -83,9 +92,8 @@ static void DrawTagInfo(const UAbilitySystemComponent& AbilitySystemComponent, c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
static void DrawTags(const FString& Title, UAbilitySystemComponent& AbilitySystemComponent, FGameplayTagContainer& TagContainer)
|
||||
void UCogAbilityWindow_Tags::DrawTagContainer(const FString& Title, const UAbilitySystemComponent& AbilitySystemComponent, FGameplayTagContainer& TagContainer)
|
||||
{
|
||||
if (ImGui::BeginTable(TCHAR_TO_ANSI(*Title), 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_BordersOuterV))
|
||||
{
|
||||
@@ -122,50 +130,19 @@ static void DrawTags(const FString& Title, UAbilitySystemComponent& AbilitySyste
|
||||
}
|
||||
|
||||
//------------------------
|
||||
// Popup
|
||||
// Tooltip
|
||||
//------------------------
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
FCogWindowWidgets::BeginTableTooltip();
|
||||
DrawTagInfo(AbilitySystemComponent, Tag);
|
||||
DrawTag(AbilitySystemComponent, Tag);
|
||||
FCogWindowWidgets::EndTableTooltip();
|
||||
}
|
||||
|
||||
|
||||
ImGui::PopID();
|
||||
index++;
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
UCogAbilityWindow_Tags::UCogAbilityWindow_Tags()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Tags::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
WindowFlags = ImGuiWindowFlags_MenuBar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Tags::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FGameplayTagContainer OwnedTags, BlockedTags;
|
||||
AbilitySystemComponent->GetOwnedGameplayTags(OwnedTags);
|
||||
AbilitySystemComponent->GetBlockedAbilityTags(BlockedTags);
|
||||
|
||||
DrawTags("Owned Tags", *AbilitySystemComponent, OwnedTags);
|
||||
}
|
||||
@@ -3,48 +3,14 @@
|
||||
#include "AbilitySystemComponent.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogAbilityWindow_Tweaks::UCogAbilityWindow_Tweaks()
|
||||
void UCogAbilityWindow_Tweaks::RenderHelp()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void DrawTweak(ACogAbilityReplicator* Replicator, const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex)
|
||||
{
|
||||
if (TweaksAsset->TweaksCategories.IsValidIndex(TweakCategoryIndex) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float* Value = Replicator->GetTweakCurrentValuePtr(TweaksAsset, TweakIndex, TweakCategoryIndex);
|
||||
if (Value == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FCogAbilityTweakCategory& Category = TweaksAsset->TweaksCategories[TweakCategoryIndex];
|
||||
|
||||
FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Category.Color));
|
||||
ImGui::PushItemWidth(-1);
|
||||
ImGui::SliderFloat("##Value", Value, TweaksAsset->TweakMinValue, TweaksAsset->TweakMaxValue, "%+0.0f%%", 1.0f);
|
||||
ImGui::PopItemWidth();
|
||||
FCogWindowWidgets::PopBackColor();
|
||||
|
||||
bool bUpdateValue = ImGui::IsItemDeactivatedAfterEdit();
|
||||
|
||||
if (ImGui::BeginPopupContextItem())
|
||||
{
|
||||
if (ImGui::Button("Reset"))
|
||||
{
|
||||
*Value = 0.f;
|
||||
bUpdateValue = true;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (bUpdateValue)
|
||||
{
|
||||
Replicator->SetTweakValue(TweaksAsset, TweakIndex, TweakCategoryIndex, *Value);
|
||||
}
|
||||
ImGui::Text(
|
||||
"This window can be used to apply tweaks to all the loaded actors. "
|
||||
"The tweaks are used to test various gameplay settings by actor category. "
|
||||
"The tweaks can be configured in the '%s' data asset. "
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(TweaksAsset.Get()))
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -52,6 +18,11 @@ void UCogAbilityWindow_Tweaks::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
if (TweaksAsset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FCogAbilityModule& Module = FCogAbilityModule::Get();
|
||||
ACogAbilityReplicator* Replicator = Module.GetLocalReplicator();
|
||||
if (Replicator == nullptr)
|
||||
@@ -127,7 +98,7 @@ void UCogAbilityWindow_Tweaks::RenderContent()
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID(TweakCategoryIndex);
|
||||
DrawTweak(Replicator, TweaksAsset.Get(), TweakIndex, TweakCategoryIndex);
|
||||
DrawTweak(Replicator, TweakIndex, TweakCategoryIndex);
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
@@ -139,3 +110,43 @@ void UCogAbilityWindow_Tweaks::RenderContent()
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Tweaks::DrawTweak(ACogAbilityReplicator* Replicator, int32 TweakIndex, int32 TweakCategoryIndex)
|
||||
{
|
||||
if (TweaksAsset->TweaksCategories.IsValidIndex(TweakCategoryIndex) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float* Value = Replicator->GetTweakCurrentValuePtr(TweaksAsset.Get(), TweakIndex, TweakCategoryIndex);
|
||||
if (Value == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FCogAbilityTweakCategory& Category = TweaksAsset->TweaksCategories[TweakCategoryIndex];
|
||||
|
||||
FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Category.Color));
|
||||
ImGui::PushItemWidth(-1);
|
||||
ImGui::SliderFloat("##Value", Value, TweaksAsset->TweakMinValue, TweaksAsset->TweakMaxValue, "%+0.0f%%", 1.0f);
|
||||
ImGui::PopItemWidth();
|
||||
FCogWindowWidgets::PopBackColor();
|
||||
|
||||
bool bUpdateValue = ImGui::IsItemDeactivatedAfterEdit();
|
||||
|
||||
if (ImGui::BeginPopupContextItem())
|
||||
{
|
||||
if (ImGui::Button("Reset"))
|
||||
{
|
||||
*Value = 0.f;
|
||||
bUpdateValue = true;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (bUpdateValue)
|
||||
{
|
||||
Replicator->SetTweakValue(TweaksAsset.Get(), TweakIndex, TweakCategoryIndex, *Value);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderTick(float DetlaTime) override;
|
||||
|
||||
@@ -9,12 +9,18 @@ class COGABILITY_API UCogAbilityWindow_Attributes : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogAbilityWindow_Attributes();
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawAttributeInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FGameplayAttribute& Attribute);
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool bSortByNameSetting = true;
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@ class COGABILITY_API UCogAbilityWindow_Cheats : public UCogWindow
|
||||
|
||||
public:
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
TWeakObjectPtr<UCogAbilityDataAsset_Cheats> CheatsAsset;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
private:
|
||||
|
||||
void AddCheat(AActor* InstigatorActor, AActor* TargetActor, const FCogAbilityCheat& CheatEffect, bool IsPersistent);
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "CogAbilityWindow_Pools.generated.h"
|
||||
|
||||
class UCogAbilityDataAsset_Pools;
|
||||
class UAbilitySystemComponent;
|
||||
struct FCogAbilityPool;
|
||||
|
||||
UCLASS()
|
||||
class COGABILITY_API UCogAbilityWindow_Pools : public UCogWindow
|
||||
@@ -13,8 +15,15 @@ class COGABILITY_API UCogAbilityWindow_Pools : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogAbilityWindow_Pools();
|
||||
|
||||
TWeakObjectPtr<UCogAbilityDataAsset_Pools> PoolsAsset;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
TWeakObjectPtr<UCogAbilityDataAsset_Pools> PoolsAsset;
|
||||
virtual void DrawPool(const UAbilitySystemComponent* AbilitySystemComponent, const FCogAbilityPool& Pool);
|
||||
|
||||
};
|
||||
|
||||
@@ -9,9 +9,14 @@ class COGABILITY_API UCogAbilityWindow_Tags : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogAbilityWindow_Tags();
|
||||
protected:
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawTagContainer(const FString& Title, const UAbilitySystemComponent& AbilitySystemComponent, FGameplayTagContainer& TagContainer);
|
||||
|
||||
virtual void DrawTag(const UAbilitySystemComponent& AbilitySystemComponent, const FGameplayTag& Tag);
|
||||
};
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
#include "CogWindow.h"
|
||||
#include "CogAbilityWindow_Tweaks.generated.h"
|
||||
|
||||
class AActor;
|
||||
class UCogAbilityDataAsset_Tweaks;
|
||||
class ACogAbilityReplicator;
|
||||
|
||||
UCLASS()
|
||||
class COGABILITY_API UCogAbilityWindow_Tweaks : public UCogWindow
|
||||
@@ -14,10 +12,15 @@ class COGABILITY_API UCogAbilityWindow_Tweaks : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogAbilityWindow_Tweaks();
|
||||
TWeakObjectPtr<UCogAbilityDataAsset_Tweaks> TweaksAsset;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
TWeakObjectPtr<UCogAbilityDataAsset_Tweaks> TweaksAsset;
|
||||
virtual void DrawTweak(ACogAbilityReplicator* Replicator, int32 TweakIndex, int32 TweakCategoryIndex);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -12,30 +12,19 @@
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogEngineWindow_Collisions::UCogEngineWindow_Collisions()
|
||||
void UCogEngineWindow_Collisions::RenderHelp()
|
||||
{
|
||||
ObjectTypesToQuery = 0;
|
||||
ImGui::Text("This window is used to inspect collisions by performing a collision query with the selected channels. "
|
||||
"The query can be configured in the options. "
|
||||
"The displayed collision channels can be configured in the '%s' data asset. "
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(CollisionsAsset.Get()))
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Collisions::SetCollisionsAsset(const UCogEngineDataAsset_Collisions* Asset)
|
||||
void UCogEngineWindow_Collisions::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (FChannel& Channel : Channels)
|
||||
{
|
||||
Channel.IsValid = false;
|
||||
}
|
||||
|
||||
for (const FCogCollisionChannel& AssetChannel : Asset->Channels)
|
||||
{
|
||||
FChannel& Channel = Channels[(uint8)AssetChannel.Channel];
|
||||
Channel.IsValid = true;
|
||||
Channel.Color = AssetChannel.Color.ToFColor(true);
|
||||
}
|
||||
WindowFlags = ImGuiWindowFlags_MenuBar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -60,6 +49,60 @@ void UCogEngineWindow_Collisions::RenderContent()
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Menu
|
||||
//-------------------------------------------------
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
{
|
||||
//-------------------------------------------------
|
||||
// Query Mode
|
||||
//-------------------------------------------------
|
||||
ImGui::Combo("Query", &QueryType,
|
||||
"Sphere\0"
|
||||
"Raycast Crosshair\0"
|
||||
"Raycast Cursor\0"
|
||||
"\0"
|
||||
);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Distance
|
||||
//-------------------------------------------------
|
||||
ImGui::SliderFloat("Distance", &QueryDistance, 0.0f, 20000.0f, "%0.f");
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Thickness
|
||||
//-------------------------------------------------
|
||||
if (QueryType == 1 || QueryType == 2)
|
||||
{
|
||||
ImGui::SliderFloat("Thickness", &QueryThickness, 0.0f, 1000.0f, "%0.f");
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Use Complex Collisions
|
||||
//-------------------------------------------------
|
||||
ImGui::Checkbox("Use Complex Collisions", &UseComplexCollisions);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Show Names
|
||||
//-------------------------------------------------
|
||||
ImGui::Checkbox("Show Actors Names", &ShowActorsNames);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Show Query
|
||||
//-------------------------------------------------
|
||||
ImGui::Checkbox("Show Query", &ShowQuery);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Profile
|
||||
//-------------------------------------------------
|
||||
const FCollisionResponseTemplate* SelectedProfile = CollisionProfile->GetProfileByIndex(ProfileIndex);
|
||||
FName SelectedProfileName = SelectedProfile != nullptr ? SelectedProfile->Name : FName("Custom");
|
||||
|
||||
@@ -89,7 +132,6 @@ void UCogEngineWindow_Collisions::RenderContent()
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
//-------------------------------------------------
|
||||
@@ -128,52 +170,6 @@ void UCogEngineWindow_Collisions::RenderContent()
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Mode
|
||||
//-------------------------------------------------
|
||||
static int QueryType = 0;
|
||||
ImGui::Combo("Query", &QueryType,
|
||||
"Sphere\0"
|
||||
"Raycast Crosshair\0"
|
||||
"Raycast Cursor\0"
|
||||
"\0"
|
||||
);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Distance
|
||||
//-------------------------------------------------
|
||||
static float QueryDistance = 5000.0f;
|
||||
ImGui::SliderFloat("Distance", &QueryDistance, 0.0f, 20000.0f, "%0.f");
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Thickness
|
||||
//-------------------------------------------------
|
||||
static float QueryThickness = 0.0f;
|
||||
if (QueryType == 1 || QueryType == 2)
|
||||
{
|
||||
ImGui::SliderFloat("Thickness", &QueryThickness, 0.0f, 1000.0f, "%0.f");
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Use Complex Collisions
|
||||
//-------------------------------------------------
|
||||
static bool UseComplexCollisions = false;
|
||||
ImGui::Checkbox("Use Complex Collisions", &UseComplexCollisions);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Show Names
|
||||
//-------------------------------------------------
|
||||
static bool ShowActorsNames = false;
|
||||
ImGui::Checkbox("Show Actors Names", &ShowActorsNames);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Show Query
|
||||
//-------------------------------------------------
|
||||
static bool ShowQuery = false;
|
||||
ImGui::Checkbox("Show Query", &ShowQuery);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Perform Query
|
||||
//-------------------------------------------------
|
||||
@@ -182,8 +178,6 @@ void UCogEngineWindow_Collisions::RenderContent()
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
|
||||
FVector QueryStart;
|
||||
FVector QueryEnd;
|
||||
float QueryRadius = 0.0f;
|
||||
@@ -235,6 +229,7 @@ void UCogEngineWindow_Collisions::RenderContent()
|
||||
QueryShape.SetSphere(QueryRadius);
|
||||
|
||||
TArray<FHitResult> QueryHits;
|
||||
UWorld* World = GetWorld();
|
||||
World->SweepMultiByObjectType(
|
||||
QueryHits,
|
||||
QueryStart,
|
||||
@@ -371,3 +366,24 @@ void UCogEngineWindow_Collisions::RenderContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Collisions::SetCollisionsAsset(const UCogEngineDataAsset_Collisions* Asset)
|
||||
{
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (FChannel& Channel : Channels)
|
||||
{
|
||||
Channel.IsValid = false;
|
||||
}
|
||||
|
||||
for (const FCogCollisionChannel& AssetChannel : Asset->Channels)
|
||||
{
|
||||
FChannel& Channel = Channels[(uint8)AssetChannel.Channel];
|
||||
Channel.IsValid = true;
|
||||
Channel.Color = AssetChannel.Color.ToFColor(true);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,12 @@
|
||||
#include "CogWindowWidgets.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogEngineWindow_DebugSettings::UCogEngineWindow_DebugSettings()
|
||||
void UCogEngineWindow_DebugSettings::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to setup how the debug display is drawn. "
|
||||
"Check each item for more info. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -41,64 +45,62 @@ void UCogEngineWindow_DebugSettings::RenderContent()
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("Show a shadow below debug text.");
|
||||
|
||||
const float ItemsWidth = FCogWindowWidgets::TextBaseWidth * 10;
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::Checkbox("Fade 2D", &FCogDebugSettings::Fade2D);
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("Does the 2D debug is fading out.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Duration", &FCogDebugSettings::Duration, 0.01f, 0.0f, 100.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The duration of debug elements.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Thickness", &FCogDebugSettings::Thickness, 0.05f, 0.0f, 5.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The thickness of debug lines.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Server Thickness", &FCogDebugSettings::ServerThickness, 0.05f, 0.0f, 5.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The thickness the server debug lines.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Server Color Mult", &FCogDebugSettings::ServerColorMultiplier, 0.01f, 0.0f, 1.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The color multiplier applied to the server debug lines.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Depth Priority", &FCogDebugSettings::DepthPriority, 0.1f, 0, 100);
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The depth priority of debug elements.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Segments", &FCogDebugSettings::Segments, 0.1f, 4, 20.0f);
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The number of segments used for circular shapes.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Axes Scale", &FCogDebugSettings::AxesScale, 0.1f, 0, 10.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The scaling debug axis.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Arrow Size", &FCogDebugSettings::ArrowSize, 1.0f, 0.0f, 200.0f, "%.0f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The size of debug arrows.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gradient Intensity", &FCogDebugSettings::GradientColorIntensity, 0.01f, 0.0f, 1.0f, "%.2f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("How much the debug elements color should be changed by a gradient color over time.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gradient Speed", &FCogDebugSettings::GradientColorSpeed, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The speed of the gradient color change.");
|
||||
|
||||
ImGui::SetNextItemWidth(ItemsWidth);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Text Size", &FCogDebugSettings::TextSize, 0.1f, 0.1f, 5.0f, "%.1f");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("The size of the debug texts.");
|
||||
|
||||
@@ -4,6 +4,19 @@
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "CogDebugLogCategoryManager.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_LogCategories::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to activate and deactivate log categories."
|
||||
"Activating a log category set its verbosity to VeryVerbose. "
|
||||
"Deactivating a log category set its verbosity to Warning. "
|
||||
"The detailed verbosity of each log category can shown by using the Option menu. "
|
||||
"On a client, both the client and the server verbosity can be modified. "
|
||||
"The log categories are used to display both output log and debug display in the world. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_LogCategories::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
@@ -145,7 +158,7 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
if (IsClient)
|
||||
{
|
||||
ELogVerbosity::Type CurrentVerbosity = FCogDebugLogCategoryManager::GetServerVerbosity(CategoryName);
|
||||
ImGui::SetNextItemWidth(FCogWindowWidgets::TextBaseWidth * 12);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("##Server", FCogDebugHelper::VerbosityToString(CurrentVerbosity)))
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
@@ -173,7 +186,7 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
|
||||
{
|
||||
ELogVerbosity::Type CurrentVerbosity = Category->GetVerbosity();
|
||||
ImGui::SetNextItemWidth(FCogWindowWidgets::TextBaseWidth * 12);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("##Local", FCogDebugHelper::VerbosityToString(CurrentVerbosity)))
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
#include "CogImguiHelper.h"
|
||||
#include "imgui.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Metrics::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window gather events generated by the selected actor to compute how much output it produces or receives per second. "
|
||||
"This is typically useful to compute the damage dealt per second, the damage received per second, etc. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Metrics::PostLoad()
|
||||
@@ -107,19 +115,19 @@ void UCogEngineWindow_Metrics::DrawMetric(FCogDebugMetricEntry& Metric)
|
||||
}
|
||||
|
||||
ImGui::Text("Crits");
|
||||
ImGui::SameLine(FCogWindowWidgets::TextBaseWidth * 20);
|
||||
ImGui::SameLine(FCogWindowWidgets::GetFontWidth() * 20);
|
||||
FCogWindowWidgets::ProgressBarCentered(Metric.Count == 0 ? 0.0f : Metric.Crits / (float)Metric.Count, ImVec2(-1, 0), TCHAR_TO_ANSI(*FString::Printf(TEXT("%d / %d"), Metric.Crits, Metric.Count)));
|
||||
|
||||
if (FCogDebugMetric::MaxDurationSetting > 0.0f)
|
||||
{
|
||||
ImGui::Text("Timer");
|
||||
ImGui::SameLine(FCogWindowWidgets::TextBaseWidth * 20);
|
||||
ImGui::SameLine(FCogWindowWidgets::GetFontWidth() * 20);
|
||||
FCogWindowWidgets::ProgressBarCentered(Metric.Timer / (float)FCogDebugMetric::MaxDurationSetting, ImVec2(-1, 0), TCHAR_TO_ANSI(*FString::Printf(TEXT("%0.1f / %0.1f"), Metric.Timer, FCogDebugMetric::MaxDurationSetting)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("Timer");
|
||||
ImGui::SameLine(FCogWindowWidgets::TextBaseWidth * 20);
|
||||
ImGui::SameLine(FCogWindowWidgets::GetFontWidth() * 20);
|
||||
ImGui::Text("%0.1f", Metric.Timer);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,58 @@
|
||||
#include "GameFramework/PlayerState.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void DrawControls(UWorld* World)
|
||||
void UCogEngineWindow_NetEmulation::RenderHelp()
|
||||
{
|
||||
FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(World);
|
||||
ImGui::Text("This window is used to configure the network emulation.");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_NetEmulation::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
DrawStats();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
DrawControls();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_NetEmulation::DrawStats()
|
||||
{
|
||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||
if (PlayerController == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (const APlayerState* PlayerState = PlayerController->GetPlayerState<APlayerState>())
|
||||
{
|
||||
const float Ping = PlayerState->GetPingInMilliseconds();
|
||||
ImGui::Text("Ping ");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(UCogEngineWindow_Stats::GetPingColor(Ping), "%0.0fms", Ping);
|
||||
}
|
||||
|
||||
if (UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||
{
|
||||
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||
ImGui::Text("Packet Loss Out ");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(UCogEngineWindow_Stats::GetPacketLossColor(OutPacketLost), "%0.0f%%", OutPacketLost);
|
||||
|
||||
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||
ImGui::Text("Packet Loss In ");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(UCogEngineWindow_Stats::GetPacketLossColor(InPacketLost), "%0.0f%%", InPacketLost);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_NetEmulation::DrawControls()
|
||||
{
|
||||
FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(GetWorld());
|
||||
|
||||
if (WorldContext.ActiveNetDrivers.Num() == 0)
|
||||
{
|
||||
@@ -30,6 +79,7 @@ void DrawControls(UWorld* World)
|
||||
return;
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("Driver", TCHAR_TO_ANSI(*SelectedNetDriver->NetDriver->GetName())))
|
||||
{
|
||||
int i = 0;
|
||||
@@ -60,6 +110,7 @@ void DrawControls(UWorld* World)
|
||||
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::DragInt("Lag Min", &Settings.PktLagMin, 1.0f, 0, INT_MAX, "%d ms"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -71,6 +122,7 @@ void DrawControls(UWorld* World)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::DragInt("Lag Max", &Settings.PktLagMax, 1.0f, 0, INT_MAX, "%d ms"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -81,6 +133,8 @@ void DrawControls(UWorld* World)
|
||||
"If set lag values will randomly fluctuate between Min and Max.");
|
||||
}
|
||||
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::SliderInt("Packet Loss", &Settings.PktLoss, 0, 100, "%d%%"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -96,6 +150,7 @@ void DrawControls(UWorld* World)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::SliderInt("Packet Order", &Settings.PktOrder, 0, 100, "%d%%"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -110,6 +165,7 @@ void DrawControls(UWorld* World)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::SliderInt("Packet Dup", &Settings.PktDup, 0, 100, "%d%%"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -127,6 +183,7 @@ void DrawControls(UWorld* World)
|
||||
ImGui::Separator();
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::DragInt("Incoming Lag Min", &Settings.PktIncomingLagMin, 1.0f, 0, INT_MAX, "%d ms"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -138,6 +195,7 @@ void DrawControls(UWorld* World)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::DragInt("Incoming Lag Max", &Settings.PktIncomingLagMax, 1.0f, 0, INT_MAX, "%d ms"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -149,6 +207,7 @@ void DrawControls(UWorld* World)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::SliderInt("Incoming Packet Loss", &Settings.PktIncomingLoss, 0, 100, "%d%%"))
|
||||
{
|
||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||
@@ -159,43 +218,4 @@ void DrawControls(UWorld* World)
|
||||
"The ratio of incoming packets that will be dropped to simulate packet loss");
|
||||
}
|
||||
|
||||
#endif //DO_ENABLE_NET_TEST
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_NetEmulation::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||
if (PlayerController == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (const APlayerState* PlayerState = PlayerController->GetPlayerState<APlayerState>())
|
||||
{
|
||||
const float Ping = PlayerState->GetPingInMilliseconds();
|
||||
ImGui::Text("Ping ");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(UCogEngineWindow_Stats::GetPingColor(Ping), "%0.0fms", Ping);
|
||||
}
|
||||
|
||||
if (UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||
{
|
||||
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||
ImGui::Text("Packet Loss Out ");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(UCogEngineWindow_Stats::GetPacketLossColor(OutPacketLost), "%0.0f%%", OutPacketLost);
|
||||
|
||||
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||
ImGui::Text("Packet Loss In ");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(UCogEngineWindow_Stats::GetPacketLossColor(InPacketLost), "%0.0f%%", InPacketLost);
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
DrawControls(GetWorld());
|
||||
}
|
||||
#endif //DO_ENABLE_NET_TEST
|
||||
@@ -40,6 +40,15 @@ UCogEngineWindow_OutputLog::UCogEngineWindow_OutputLog()
|
||||
OutputDevice.OutputLog = this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_OutputLog::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window output the log based on each log categories verbosity. "
|
||||
"The verbosity of each log category can be configured in the 'Log Categories' window. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_OutputLog::Clear()
|
||||
{
|
||||
@@ -169,13 +178,6 @@ void UCogEngineWindow_OutputLog::RenderContent()
|
||||
ImGui::Checkbox("Show Verbosity", &ShowVerbosity);
|
||||
ImGui::Checkbox("Show As Table", &ShowAsTable);
|
||||
|
||||
//if (ImGui::SmallButton("Add Log"))
|
||||
//{
|
||||
// AddLog(TEXT("ABCD"), ELogVerbosity::Verbose, FName("Test"));
|
||||
// AddLog(TEXT("EFGH"), ELogVerbosity::Warning, FName("Test"));
|
||||
// AddLog(TEXT("WXYZ"), ELogVerbosity::Error, FName("Test"));
|
||||
//}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -222,17 +224,17 @@ void UCogEngineWindow_OutputLog::RenderContent()
|
||||
IsTableShown = true;
|
||||
if (ShowFrame)
|
||||
{
|
||||
ImGui::TableSetupColumn("Frame", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::TextBaseWidth * 4);
|
||||
ImGui::TableSetupColumn("Frame", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::GetFontWidth() * 4);
|
||||
}
|
||||
|
||||
if (ShowCategory)
|
||||
{
|
||||
ImGui::TableSetupColumn("Category", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::TextBaseWidth * 10);
|
||||
ImGui::TableSetupColumn("Category", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::GetFontWidth() * 10);
|
||||
}
|
||||
|
||||
if (ShowVerbosity)
|
||||
{
|
||||
ImGui::TableSetupColumn("Verbosity", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::TextBaseWidth * 10);
|
||||
ImGui::TableSetupColumn("Verbosity", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::GetFontWidth() * 10);
|
||||
}
|
||||
|
||||
ImGui::TableSetupColumn("Message", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogEngineWindow_Plots::UCogEngineWindow_Plots()
|
||||
void UCogEngineWindow_Plots::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window plots values overtime. When applicable, only the values of the selected actor are displayed."
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -29,7 +32,7 @@ void UCogEngineWindow_Plots::RenderContent()
|
||||
|
||||
if (ImGui::BeginTable("PlotTable", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable))
|
||||
{
|
||||
ImGui::TableSetupColumn("Settings", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::TextBaseWidth * 20.0f);
|
||||
ImGui::TableSetupColumn("Settings", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::GetFontWidth() * 20.0f);
|
||||
ImGui::TableSetupColumn("Graph", ImGuiTableColumnFlags_WidthStretch, 0.0f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
#define SCALABILITY_NUM_LEVELS 5
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogEngineWindow_Scalability::UCogEngineWindow_Scalability()
|
||||
void UCogEngineWindow_Scalability::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to configure the rendering quality."
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -18,6 +22,7 @@ void UCogEngineWindow_Scalability::RenderContent()
|
||||
|
||||
Scalability::FQualityLevels Levels = Scalability::GetQualityLevels();
|
||||
FString CurrentQualityName = Scalability::GetQualityLevelText(Levels.GetMinQualityLevel(), SCALABILITY_NUM_LEVELS).ToString();
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("Scalability", TCHAR_TO_ANSI(*CurrentQualityName)))
|
||||
{
|
||||
for (int32 i = 0; i < SCALABILITY_NUM_LEVELS; ++i)
|
||||
@@ -38,58 +43,44 @@ void UCogEngineWindow_Scalability::RenderContent()
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::SliderFloat("Resolution", &Levels.ResolutionQuality, 10.0f, 100.0f, "%0.f"))
|
||||
bool Modified = false;
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderFloat("Resolution", &Levels.ResolutionQuality, 10.0f, 100.0f, "%0.f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("View Distance", &Levels.ViewDistanceQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Anti Aliasing", &Levels.AntiAliasingQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Shadow", &Levels.ShadowQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Global Illumination", &Levels.GlobalIlluminationQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Reflection", &Levels.ReflectionQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Post Process", &Levels.PostProcessQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Texture", &Levels.TextureQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Effects", &Levels.EffectsQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Foliage", &Levels.FoliageQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
Modified |= ImGui::SliderInt("Shading", &Levels.ShadingQuality, 0, SCALABILITY_NUM_LEVELS - 1);
|
||||
|
||||
if (Modified)
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("View Distance", &Levels.ViewDistanceQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Anti Aliasing", &Levels.AntiAliasingQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Shadow", &Levels.ShadowQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Global Illumination", &Levels.GlobalIlluminationQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Reflection", &Levels.ReflectionQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Post Process", &Levels.PostProcessQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Texture", &Levels.TextureQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Effects", &Levels.EffectsQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Foliage", &Levels.FoliageQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
|
||||
if (ImGui::SliderInt("Shading", &Levels.ShadingQuality, 0, SCALABILITY_NUM_LEVELS - 1))
|
||||
{
|
||||
Scalability::SetQualityLevels(Levels);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,14 @@
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogEngineWindow_Selection::UCogEngineWindow_Selection()
|
||||
void UCogEngineWindow_Selection::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to select an actor either by picking an actor in the world, "
|
||||
"or by selecting an actor in the actor list. "
|
||||
"The actor list can be filtered by actor type (Actor, Character, etc). "
|
||||
"The current selection is used by various debug windows to filter out their content"
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -200,7 +206,7 @@ void UCogEngineWindow_Selection::DrawActorContextMenu(AActor* Actor)
|
||||
//------------------------
|
||||
// ContextMenu
|
||||
//------------------------
|
||||
ImGui::SetNextWindowSize(ImVec2(FCogWindowWidgets::TextBaseWidth * 20, 0));
|
||||
ImGui::SetNextWindowSize(ImVec2(FCogWindowWidgets::GetFontWidth() * 20, 0));
|
||||
if (ImGui::BeginPopupContextItem())
|
||||
{
|
||||
if (ImGui::Button("Reset Selection", ImVec2(-1, 0)))
|
||||
@@ -387,9 +393,9 @@ bool UCogEngineWindow_Selection::ComputeBoundingBoxScreenPosition(const APlayerC
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Selection::DrawMainMenuWidget(bool Draw, float& Width)
|
||||
{
|
||||
const float PickButtonWidth = FCogWindowWidgets::TextBaseWidth * 5;
|
||||
const float SelectionButtonWidth = FCogWindowWidgets::TextBaseWidth * 30;
|
||||
const float ResetButtonWidth = FCogWindowWidgets::TextBaseWidth * 2;
|
||||
const float PickButtonWidth = FCogWindowWidgets::GetFontWidth() * 5;
|
||||
const float SelectionButtonWidth = FCogWindowWidgets::GetFontWidth() * 30;
|
||||
const float ResetButtonWidth = FCogWindowWidgets::GetFontWidth() * 2;
|
||||
Width = PickButtonWidth + SelectionButtonWidth + ResetButtonWidth;
|
||||
|
||||
if (Draw == false)
|
||||
@@ -399,7 +405,7 @@ void UCogEngineWindow_Selection::DrawMainMenuWidget(bool Draw, float& Width)
|
||||
|
||||
if (ImGui::BeginPopup("SelectionPopup"))
|
||||
{
|
||||
ImGui::BeginChild("Popup", ImVec2(Width, FCogWindowWidgets::TextBaseWidth * 40), false);
|
||||
ImGui::BeginChild("Popup", ImVec2(Width, FCogWindowWidgets::GetFontWidth() * 40), false);
|
||||
|
||||
if (DrawSelectionCombo())
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ void UCogEngineWindow_Skeleton::RenderContent()
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, FCogWindowWidgets::TextBaseWidth);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, FCogWindowWidgets::GetFontWidth());
|
||||
|
||||
HoveredBoneIndex = INDEX_NONE;
|
||||
DrawBoneEntry(0, false);
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
#include "CogEngineWindow_Spawns.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Spawns::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to spawn new actors in the world. "
|
||||
"The spawn list can be configured in the '%s' data asset. "
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(SpawnAsset))
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Spawns::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
@@ -11,12 +21,12 @@ void UCogEngineWindow_Spawns::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
if (Asset == nullptr)
|
||||
if (SpawnAsset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (const FCogEngineSpawnGroup& SpawnGroup : Asset->SpawnGroups)
|
||||
for (const FCogEngineSpawnGroup& SpawnGroup : SpawnAsset->SpawnGroups)
|
||||
{
|
||||
RenderSpawnGroup(SpawnGroup);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,14 @@ ImVec4 StatRedColor(1.0f, 0.4f, 0.3f, 1.0f);
|
||||
ImVec4 StatOrangeColor(1.0f, 0.7f, 0.4f, 1.0f);
|
||||
ImVec4 StatGreenColor(0.5f, 1.0f, 0.6f, 1.0f);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Stats::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window display engine stats such as FPS, Ping, Packet Loss. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Stats::RenderContent()
|
||||
{
|
||||
@@ -46,7 +54,7 @@ void UCogEngineWindow_Stats::RenderContent()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Stats::DrawMainMenuWidget(bool Draw, float& Width)
|
||||
{
|
||||
Width = FCogWindowWidgets::TextBaseWidth * 25;
|
||||
Width = FCogWindowWidgets::GetFontWidth() * 25;
|
||||
|
||||
if (Draw == false)
|
||||
{
|
||||
|
||||
+39
-30
@@ -1,42 +1,20 @@
|
||||
#include "CogEngineWindow_Time.h"
|
||||
#include "CogEngineWindow_TimeScale.h"
|
||||
|
||||
#include "CogEngineReplicator.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Engine/World.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void DrawTimeButton(ACogEngineReplicator* Replicator, float Value)
|
||||
void UCogEngineWindow_TimeScale::RenderHelp()
|
||||
{
|
||||
const bool IsSelected = FMath::IsNearlyEqual(Replicator->GetTimeDilation(), Value, 0.0001f);
|
||||
if (IsSelected)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(128, 128, 128, 50));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, IM_COL32(128, 128, 128, 100));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, IM_COL32(128, 128, 128, 150));
|
||||
}
|
||||
|
||||
const char* Text = TCHAR_TO_ANSI(*FString::Printf(TEXT("%g"), Value).Replace(TEXT("0."), TEXT(".")));
|
||||
if (ImGui::Button(Text, ImVec2(3.5f * FCogWindowWidgets::TextBaseWidth, 0)))
|
||||
{
|
||||
Replicator->Server_SetTimeDilation(Value);
|
||||
}
|
||||
|
||||
if (IsSelected)
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PopStyleColor(3);
|
||||
}
|
||||
ImGui::Text(
|
||||
"This window can be used to change the game global time scale. "
|
||||
"If changed on a client the time scale is also modified on the game server. "
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogEngineWindow_Time::UCogEngineWindow_Time()
|
||||
UCogEngineWindow_TimeScale::UCogEngineWindow_TimeScale()
|
||||
{
|
||||
TimingScales.Add(0.00f);
|
||||
TimingScales.Add(0.01f);
|
||||
@@ -49,7 +27,7 @@ UCogEngineWindow_Time::UCogEngineWindow_Time()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Time::RenderContent()
|
||||
void UCogEngineWindow_TimeScale::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
@@ -74,3 +52,34 @@ void UCogEngineWindow_Time::RenderContent()
|
||||
ImGui::PopStyleColor(1);
|
||||
ImGui::PopStyleVar(3);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_TimeScale::DrawTimeButton(ACogEngineReplicator* Replicator, float Value)
|
||||
{
|
||||
const bool IsSelected = FMath::IsNearlyEqual(Replicator->GetTimeDilation(), Value, 0.0001f);
|
||||
if (IsSelected)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(128, 128, 128, 50));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, IM_COL32(128, 128, 128, 100));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, IM_COL32(128, 128, 128, 150));
|
||||
}
|
||||
|
||||
const char* Text = TCHAR_TO_ANSI(*FString::Printf(TEXT("%g"), Value).Replace(TEXT("0."), TEXT(".")));
|
||||
if (ImGui::Button(Text, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
||||
{
|
||||
Replicator->Server_SetTimeDilation(Value);
|
||||
}
|
||||
|
||||
if (IsSelected)
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PopStyleColor(3);
|
||||
}
|
||||
}
|
||||
@@ -12,14 +12,17 @@ class COGENGINE_API UCogEngineWindow_Collisions : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogEngineWindow_Collisions();
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
void SetCollisionsAsset(const UCogEngineDataAsset_Collisions* Asset);
|
||||
|
||||
private:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
struct FChannel
|
||||
{
|
||||
bool IsValid = false;
|
||||
@@ -31,8 +34,26 @@ private:
|
||||
FChannel Channels[ECC_MAX];
|
||||
|
||||
UPROPERTY(Config)
|
||||
int32 ObjectTypesToQuery;
|
||||
int32 ObjectTypesToQuery = 0;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int32 ProfileIndex = 0;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int QueryType = 0;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float QueryDistance = 5000.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float QueryThickness = 0.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool UseComplexCollisions = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowActorsNames = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowQuery = false;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ class COGENGINE_API UCogEngineWindow_DebugSettings : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogEngineWindow_DebugSettings();
|
||||
virtual void RenderHelp()override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ class COGENGINE_API UCogEngineWindow_LogCategories : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
@@ -15,7 +15,9 @@ class COGENGINE_API UCogEngineWindow_Metrics : public UCogWindow
|
||||
public:
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PostLoad() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
@@ -9,10 +9,16 @@ class COGENGINE_API UCogEngineWindow_NetEmulation : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawStats();
|
||||
|
||||
virtual void DrawControls();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@@ -27,8 +27,13 @@ class COGENGINE_API UCogEngineWindow_OutputLog : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UCogEngineWindow_OutputLog();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
#include "CogWindow.h"
|
||||
#include "CogEngineWindow_Plots.generated.h"
|
||||
|
||||
class UCogEngineDataAsset_Collisions;
|
||||
|
||||
UCLASS()
|
||||
class COGENGINE_API UCogEngineWindow_Plots : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogEngineWindow_Plots();
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class COGENGINE_API UCogEngineWindow_Scalability : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogEngineWindow_Scalability();
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
};
|
||||
|
||||
@@ -11,23 +11,6 @@ class COGENGINE_API UCogEngineWindow_Selection : public UCogWindow
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogEngineWindow_Selection();
|
||||
|
||||
virtual void RenderTick(float DeltaTime);
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawMainMenuWidget(bool Draw, float& Width) override;
|
||||
|
||||
bool DrawSelectionCombo();
|
||||
|
||||
void DrawActorContextMenu(AActor* Actor);
|
||||
|
||||
void ActivateSelectionMode();
|
||||
|
||||
void HackWaitInputRelease();
|
||||
|
||||
bool GetIsSelecting() const { return bSelectionModeActive; }
|
||||
|
||||
@@ -43,6 +26,26 @@ public:
|
||||
|
||||
void SetTraceType(ETraceTypeQuery Value) { TraceType = Value; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawMainMenuWidget(bool Draw, float& Width) override;
|
||||
|
||||
bool DrawSelectionCombo();
|
||||
|
||||
void DrawActorContextMenu(AActor* Actor);
|
||||
|
||||
void ActivateSelectionMode();
|
||||
|
||||
void HackWaitInputRelease();
|
||||
|
||||
private:
|
||||
|
||||
void TickSelectionMode();
|
||||
@@ -53,8 +56,6 @@ private:
|
||||
|
||||
void DrawActorFrame(const AActor* Actor);
|
||||
|
||||
//void DrawActorDebug(const AActor* Actor);
|
||||
|
||||
bool ComputeBoundingBoxScreenPosition(const APlayerController* PlayerController, const FVector& Origin, const FVector& Extent, FVector2D& Min, FVector2D& Max);
|
||||
|
||||
FVector LastSelectedActorLocation = FVector::ZeroVector;
|
||||
|
||||
@@ -14,9 +14,9 @@ class COGENGINE_API UCogEngineWindow_Spawns : public UCogWindow
|
||||
|
||||
public:
|
||||
|
||||
const UCogEngineDataAsset_Spawns* GetSpawnsAsset() const { return Asset; }
|
||||
const UCogEngineDataAsset_Spawns* GetSpawnsAsset() const { return SpawnAsset; }
|
||||
|
||||
void SetSpawnsAsset(const UCogEngineDataAsset_Spawns* Value) { Asset = Value; }
|
||||
void SetSpawnsAsset(const UCogEngineDataAsset_Spawns* Value) { SpawnAsset = Value; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -30,5 +30,5 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
const UCogEngineDataAsset_Spawns* Asset = nullptr;
|
||||
const UCogEngineDataAsset_Spawns* SpawnAsset = nullptr;
|
||||
};
|
||||
|
||||
@@ -11,10 +11,17 @@ class COGENGINE_API UCogEngineWindow_Stats : public UCogWindow
|
||||
|
||||
public:
|
||||
|
||||
virtual void RenderContent() override;
|
||||
virtual void DrawMainMenuWidget(bool Draw, float& Width) override;
|
||||
|
||||
static ImVec4 GetFpsColor(float Value, float Good = 50.0f, float Medium = 30.0f);
|
||||
|
||||
static ImVec4 GetPingColor(float Value, float Good = 100.0f, float Medium = 200.0f);
|
||||
|
||||
static ImVec4 GetPacketLossColor(float Value, float Good = 10.0f, float Medium = 20.0f);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawMainMenuWidget(bool Draw, float& Width) override;
|
||||
};
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogWindow.h"
|
||||
#include "CogEngineWindow_Time.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class COGENGINE_API UCogEngineWindow_Time : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogEngineWindow_Time();
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
TArray<float> TimingScales;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogWindow.h"
|
||||
#include "CogEngineWindow_TimeScale.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class COGENGINE_API UCogEngineWindow_TimeScale : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UCogEngineWindow_TimeScale();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawTimeButton(ACogEngineReplicator* Replicator, float Value);
|
||||
|
||||
TArray<float> TimingScales;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
@@ -9,8 +9,14 @@
|
||||
#include "InputMappingContext.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogInputWindow_Actions::UCogInputWindow_Actions()
|
||||
void UCogInputWindow_Actions::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window display the current state of each Input Action. "
|
||||
"It can also be used to inject inputs to help debugging. "
|
||||
"The input action are read from a Input Mapping Context defined in '%s' data asset. "
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(ActionAsset))
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -19,27 +25,6 @@ void UCogInputWindow_Actions::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
WindowFlags = ImGuiWindowFlags_MenuBar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void DrawAxis(const char* Format, const char* ActionName, float CurrentValue, float* InjectValue)
|
||||
{
|
||||
ImGui::PushID(Format);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(Format, ActionName);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::SliderFloat("##Value", &CurrentValue, -1.0f, 1.0f, "%0.2f");
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
FCogWindowWidgets::SliderWithReset("##Inject", InjectValue, -1.0f, 1.0f, 0.0f, "%0.2f");
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogInputWindow_Actions::RenderContent()
|
||||
{
|
||||
@@ -120,7 +105,7 @@ void UCogInputWindow_Actions::RenderContent()
|
||||
|
||||
const ImVec4 ActiveColor(1, 0.8f, 0, 1);
|
||||
const ImVec4 InnactiveColor(0.3f, 0.3f, 0.3f, 1);
|
||||
const ImVec2 ButtonWidth(FCogWindowWidgets::TextBaseWidth * 10, 0);
|
||||
const ImVec2 ButtonWidth(FCogWindowWidgets::GetFontWidth() * 10, 0);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::BeginDisabled();
|
||||
@@ -202,3 +187,24 @@ void UCogInputWindow_Actions::RenderTick(float DeltaSeconds)
|
||||
ActionInfo.Inject(*EnhancedInput, IsTimeToRepeat);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogInputWindow_Actions::DrawAxis(const char* Format, const char* ActionName, float CurrentValue, float* InjectValue)
|
||||
{
|
||||
ImGui::PushID(Format);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(Format, ActionName);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::SliderFloat("##Value", &CurrentValue, -1.0f, 1.0f, "%0.2f");
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
FCogWindowWidgets::SliderWithReset("##Inject", InjectValue, -1.0f, 1.0f, 0.0f, "%0.2f");
|
||||
ImGui::PopID();
|
||||
}
|
||||
@@ -8,23 +8,32 @@
|
||||
class UInputAction;
|
||||
class UCogInputDataAsset_Actions;
|
||||
|
||||
UCLASS()
|
||||
UCLASS(Config = Cog)
|
||||
class COGINPUT_API UCogInputWindow_Actions : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCogInputWindow_Actions();
|
||||
protected:
|
||||
|
||||
void RenderHelp()
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void RenderTick(float DeltaSeconds) override;
|
||||
|
||||
virtual void DrawAxis(const char* Format, const char* ActionName, float CurrentValue, float* InjectValue);
|
||||
|
||||
TWeakObjectPtr<UCogInputDataAsset_Actions> ActionsAsset;
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(Config)
|
||||
float RepeatPeriod = 0.5f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float RepeatTime = 0.0f;
|
||||
|
||||
TArray<FCogInjectActionInfo> Actions;
|
||||
};
|
||||
|
||||
@@ -54,13 +54,40 @@ void UCogWindow::Render(float DeltaTime)
|
||||
ImGuiWindowFlags WindowFlags = 0;
|
||||
PreRender(WindowFlags);
|
||||
|
||||
if (ImGui::Begin(TCHAR_TO_ANSI(*GetTitle()), &bIsVisible, WindowFlags))
|
||||
const FString WindowTitle = GetTitle() + "##" + Name;
|
||||
|
||||
if (ImGui::Begin(TCHAR_TO_ANSI(*WindowTitle), &bIsVisible, WindowFlags))
|
||||
{
|
||||
if (Owner->GetShowHelp())
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, IM_COL32(29, 42, 62, 240));
|
||||
const float HelpWidth = FCogWindowWidgets::GetFontWidth() * 80;
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(HelpWidth / 2.0f, 0.0f),
|
||||
ImVec2(HelpWidth, FLT_MAX));
|
||||
if (ImGui::BeginTooltip())
|
||||
{
|
||||
ImGui::PushTextWrapPos(HelpWidth - 1 * FCogWindowWidgets::GetFontWidth());
|
||||
RenderHelp();
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
||||
RenderContent();
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindow::RenderHelp()
|
||||
{
|
||||
ImGui::Text("No help available.");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindow::RenderTick(float DeltaTime)
|
||||
{
|
||||
@@ -75,20 +102,20 @@ void UCogWindow::GameTick(float DeltaTime)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindow::DrawMenuItem(const FString& MenuItemName)
|
||||
{
|
||||
if (bShowInsideMenu && bIsVisible == false)
|
||||
if (bShowInsideMenu)
|
||||
{
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(FCogWindowWidgets::TextBaseWidth * 40, FCogWindowWidgets::TextBaseHeight * 1),
|
||||
ImVec2(FCogWindowWidgets::TextBaseWidth * 50, FCogWindowWidgets::TextBaseHeight * 60));
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(FCogWindowWidgets::GetFontWidth() * 40, ImGui::GetTextLineHeightWithSpacing() * 1),
|
||||
ImVec2(FCogWindowWidgets::GetFontWidth() * 50, ImGui::GetTextLineHeightWithSpacing() * 60));
|
||||
|
||||
if (ImGui::BeginMenu(TCHAR_TO_ANSI(*MenuItemName)))
|
||||
{
|
||||
RenderContent();
|
||||
ImGui::EndMenu();
|
||||
|
||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left))
|
||||
{
|
||||
bIsVisible = !bIsVisible;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left))
|
||||
{
|
||||
bIsVisible = !bIsVisible;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -66,9 +66,6 @@ void UCogWindowManager::Tick(float DeltaTime)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::Render(float DeltaTime)
|
||||
{
|
||||
FCogWindowWidgets::TextBaseWidth = ImGui::CalcTextSize("A").x;
|
||||
FCogWindowWidgets::TextBaseHeight = ImGui::GetTextLineHeightWithSpacing();
|
||||
|
||||
ImGui::DockSpaceOverViewport(0, ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_NoDockingInCentralNode);
|
||||
|
||||
bool bCompactSaved = bCompactMode;
|
||||
@@ -272,6 +269,7 @@ void UCogWindowManager::DrawMainMenu()
|
||||
ImGui::Text("DPI Scale");
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::PushStyleCompact();
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::SliderFloat("", &DPIScale, 0.5f, 2.0f, "%.1f");
|
||||
if (ImGui::IsItemDeactivatedAfterEdit())
|
||||
{
|
||||
@@ -287,7 +285,15 @@ void UCogWindowManager::DrawMainMenu()
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::MenuItem("Show Window Help", nullptr, &bShowHelp);
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted("Should some help be displayed when the mouse is over a window title ?");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
float FCogWindowWidgets::TextBaseWidth = 0.0f;
|
||||
float FCogWindowWidgets::TextBaseHeight = 0.0f;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindowWidgets::BeginTableTooltip()
|
||||
{
|
||||
@@ -196,4 +192,17 @@ void FCogWindowWidgets::PushBackColor(const ImVec4& Color)
|
||||
void FCogWindowWidgets::PopBackColor()
|
||||
{
|
||||
ImGui::PopStyleColor(9);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindowWidgets::SetNextItemToShortWidth()
|
||||
{
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 10);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
float FCogWindowWidgets::GetFontWidth()
|
||||
{
|
||||
return ImGui::GetFontSize() * 0.5f;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ protected:
|
||||
|
||||
virtual const FString& GetTitle() const { return Name; }
|
||||
|
||||
virtual void RenderHelp();
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) {}
|
||||
|
||||
virtual void RenderContent() {}
|
||||
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
|
||||
bool GetCompactMode() const { return bCompactMode; }
|
||||
|
||||
bool GetShowHelp() const { return bShowHelp; }
|
||||
|
||||
private:
|
||||
|
||||
struct FMenu
|
||||
@@ -97,6 +99,9 @@ private:
|
||||
UPROPERTY(Config)
|
||||
float DPIScale = 1.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool bShowHelp = true;
|
||||
|
||||
TSharedPtr<SCogImguiWidget> ImGuiWidget;
|
||||
|
||||
TWeakObjectPtr<UWorld> World;
|
||||
|
||||
@@ -25,13 +25,13 @@ public:
|
||||
|
||||
static void AddTextWithShadow(ImDrawList* DrawList, const ImVec2& Position, ImU32 Color, const char* TextBegin, const char* TextEnd = NULL);
|
||||
|
||||
static float TextBaseWidth;
|
||||
|
||||
static float TextBaseHeight;
|
||||
|
||||
static void MenuSearchBar(ImGuiTextFilter& Filter);
|
||||
|
||||
static void PushBackColor(const ImVec4& Color);
|
||||
|
||||
static void PopBackColor();
|
||||
|
||||
static void SetNextItemToShortWidth();
|
||||
|
||||
static float GetFontWidth();
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "CogEngineWindow_Skeleton.h"
|
||||
#include "CogEngineWindow_Spawns.h"
|
||||
#include "CogEngineWindow_Stats.h"
|
||||
#include "CogEngineWindow_Time.h"
|
||||
#include "CogEngineWindow_TimeScale.h"
|
||||
#include "CogImguiModule.h"
|
||||
#include "CogInputDataAsset_Actions.h"
|
||||
#include "CogInputWindow_Actions.h"
|
||||
@@ -158,6 +158,8 @@ void ACogSampleGameState::InitializeCog()
|
||||
|
||||
CogWindowManager->CreateWindow<UCogEngineWindow_OutputLog>("Engine.Output Log");
|
||||
|
||||
CogWindowManager->CreateWindow<UCogEngineWindow_Metrics>("Engine.Metrics");
|
||||
|
||||
CogWindowManager->CreateWindow<UCogEngineWindow_Plots>("Engine.Plots");
|
||||
|
||||
UCogEngineWindow_Selection* SelectionWindow = CogWindowManager->CreateWindow<UCogEngineWindow_Selection>("Engine.Selection");
|
||||
@@ -174,7 +176,7 @@ void ACogSampleGameState::InitializeCog()
|
||||
|
||||
UCogEngineWindow_Stats* StatsWindow = CogWindowManager->CreateWindow<UCogEngineWindow_Stats>("Engine.Stats");
|
||||
|
||||
CogWindowManager->CreateWindow<UCogEngineWindow_Time>("Engine.Time");
|
||||
CogWindowManager->CreateWindow<UCogEngineWindow_TimeScale>("Engine.Time Scale");
|
||||
|
||||
//---------------------------------------
|
||||
// Abilities
|
||||
@@ -186,9 +188,6 @@ void ACogSampleGameState::InitializeCog()
|
||||
|
||||
UCogAbilityWindow_Cheats* CheatsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Cheats>("Gameplay.Cheats");
|
||||
CheatsWindow->CheatsAsset = GetFirstAssetByClass<UCogAbilityDataAsset_Cheats>();
|
||||
|
||||
CogWindowManager->CreateWindow<UCogEngineWindow_Metrics>("Gameplay.Metrics");
|
||||
|
||||
UCogAbilityWindow_Effects* EffectsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Effects>("Gameplay.Effects");
|
||||
EffectsWindow->NegativeEffectTag = Tag_Effect_Alignment_Negative;
|
||||
EffectsWindow->PositiveEffectTag = Tag_Effect_Alignment_Positive;
|
||||
|
||||
Reference in New Issue
Block a user