CogWindow: CogWindows are not UObject anymore

CogWindows are now normal object because we want to be able to Ifdef them, and UObject cannot be ifdef. CogWindows were UObject mainly for saving their config. The configs have been moved in separated class, which are UObject.
This commit is contained in:
Arnaud Jamin
2023-10-27 02:39:33 -04:00
parent 42ca1afc6a
commit e72504b47a
73 changed files with 1448 additions and 981 deletions
@@ -6,7 +6,20 @@
#include "imgui.h"
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::RenderHelp()
void FCogEngineWindow_Metrics::Initialize()
{
Super::Initialize();
bHasMenu = true;
Config = GetConfig<UCogEngineConfig_Metrics>();
FCogDebugMetric::MaxDurationSetting = Config->MaxDurationSetting;
FCogDebugMetric::RestartDelaySetting = Config->RestartDelaySetting;
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_Metrics::RenderHelp()
{
ImGui::Text(
"This window gather events generated by the selected actor to compute how much output it produces or receives per second. "
@@ -15,41 +28,24 @@ void UCogEngineWindow_Metrics::RenderHelp()
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::ResetConfig()
void FCogEngineWindow_Metrics::ResetConfig()
{
Super::ResetConfig();
MaxDurationSetting = 0.0f;
RestartDelaySetting = 5.0f;
PostInitProperties();
Config->Reset();
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::PostInitProperties()
{
Super::PostInitProperties();
FCogDebugMetric::MaxDurationSetting = MaxDurationSetting;
FCogDebugMetric::RestartDelaySetting = RestartDelaySetting;
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::PreSaveConfig()
void FCogEngineWindow_Metrics::PreSaveConfig()
{
Super::PreSaveConfig();
MaxDurationSetting = FCogDebugMetric::MaxDurationSetting;
RestartDelaySetting = FCogDebugMetric::RestartDelaySetting;
Config->MaxDurationSetting = FCogDebugMetric::MaxDurationSetting;
Config->RestartDelaySetting = FCogDebugMetric::RestartDelaySetting;
}
//--------------------------------------------------------------------------------------------------------------------------
UCogEngineWindow_Metrics::UCogEngineWindow_Metrics()
{
bHasMenu = true;
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::RenderTick(float DeltaTime)
void FCogEngineWindow_Metrics::RenderTick(float DeltaTime)
{
Super::RenderTick(DeltaTime);
FCogDebugMetric::IsVisible = GetIsVisible();
@@ -58,7 +54,7 @@ void UCogEngineWindow_Metrics::RenderTick(float DeltaTime)
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::RenderContent()
void FCogEngineWindow_Metrics::RenderContent()
{
Super::RenderContent();
@@ -112,7 +108,7 @@ void UCogEngineWindow_Metrics::RenderContent()
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::DrawMetric(FCogDebugMetricEntry& Metric)
void FCogEngineWindow_Metrics::DrawMetric(FCogDebugMetricEntry& Metric)
{
FCogWindowWidgets::PushBackColor(ImVec4(0.8f, 0.8f, 0.8f, 1.0f));
@@ -164,7 +160,7 @@ void UCogEngineWindow_Metrics::DrawMetric(FCogDebugMetricEntry& Metric)
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Metrics::DrawMetricRow(const char* RowTitle, float MitigatedValue, float UnmitigatedValue, const ImVec4& Color)
void FCogEngineWindow_Metrics::DrawMetricRow(const char* RowTitle, float MitigatedValue, float UnmitigatedValue, const ImVec4& Color)
{
ImGui::TableNextRow();
ImGui::TableNextColumn();