Fix compling errors on various platforms/consoles

- Fixed some include paths case sensitive
- Fixed CogImguiInputHelper.h including itself
- Added missing includes
- Added missing forward declarations
- Fixed enums forward declarations
- Fixed "TCHAR_TO_ANSI" and const char* formatting issues
- Fixed "sscanf" on Linux
This commit is contained in:
Elhoussine Mehnik
2023-12-09 04:38:02 +01:00
parent caa0f015d4
commit 3e73c486a4
62 changed files with 194 additions and 85 deletions
@@ -8,6 +8,9 @@
#include "EngineUtils.h"
#include "Net/Core/PushModel/PushModel.h"
#include "Net/UnrealNetwork.h"
#include "GameFramework/Pawn.h"
#include "Engine/World.h"
#include "Engine/EngineTypes.h"
DEFINE_LOG_CATEGORY(LogCogEngine);
@@ -3,7 +3,7 @@
#include "CogDebugDrawHelper.h"
#include "CogDebugSettings.h"
#include "CogEngineDataAsset.h"
#include "CogImGuiHelper.h"
#include "CogImguiHelper.h"
#include "CogWindowHelper.h"
#include "Components/BoxComponent.h"
#include "Components/CapsuleComponent.h"
@@ -12,6 +12,9 @@
#include "Components/SphereComponent.h"
#include "imgui.h"
#include "Kismet/GameplayStatics.h"
#include "DrawDebugHelpers.h"
#include "GameFramework/Pawn.h"
#include "Engine/World.h"
//--------------------------------------------------------------------------------------------------------------------------
@@ -4,6 +4,7 @@
#include "CogWindowWidgets.h"
#include "GameFramework/PlayerInput.h"
#include "imgui.h"
#include "GameFramework/PlayerController.h"
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_CommandBindings::RenderHelp()
@@ -160,19 +160,19 @@ void FCogEngineWindow_Inspector::RenderMenu()
//-----------------------------------
// Current Inspected Object
//-----------------------------------
const char* InspectedObjectName = TCHAR_TO_ANSI(*GetNameSafe(InspectedObject.Get()));
const auto InspectedObjectName = StringCast<ANSICHAR>(*GetNameSafe(InspectedObject.Get()));
ImVec2 Pos = ImGui::GetCursorScreenPos();
{
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
ImGui::SameLine();
if (ImGui::Button(InspectedObjectName, ImVec2(FCogWindowWidgets::GetFontWidth() * 20, 0)))
if (ImGui::Button(InspectedObjectName.Get(), ImVec2(FCogWindowWidgets::GetFontWidth() * 20, 0)))
{
ImGui::OpenPopup("SelectionPopup");
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Current Inspected Object: %s", InspectedObjectName);
ImGui::SetTooltip("Current Inspected Object: %s", InspectedObjectName.Get());
}
ImGui::PopStyleVar(1);
@@ -180,7 +180,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", InspectedObjectName);
ImGui::SetTooltip("%s", InspectedObjectName.Get());
}
ImGui::PopStyleColor(1);
@@ -784,8 +784,8 @@ bool FCogEngineWindow_Inspector::RenderString(const FStrProperty* StrProperty, u
static char Buffer[256] = "";
const char* Str = TCHAR_TO_ANSI(*Text);
ImStrncpy(Buffer, Str, IM_ARRAYSIZE(Buffer));
const auto Str = StringCast<ANSICHAR>(*Text);
ImStrncpy(Buffer, Str.Get(), IM_ARRAYSIZE(Buffer));
if (ImGui::InputText("##String", Buffer, IM_ARRAYSIZE(Buffer)))
{
@@ -4,6 +4,9 @@
#include "CogDebugSettings.h"
#include "CogWindowWidgets.h"
#include "CogDebugLog.h"
#include "DrawDebugHelpers.h"
#include "Engine/World.h"
#include "Engine/Engine.h"
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_LogCategories::Initialize()
@@ -117,8 +120,8 @@ void FCogEngineWindow_LogCategories::RenderContent()
FLogCategoryBase* Category = CategoryInfo.LogCategory;
ImGui::PushID(Index);
const char* CategoryFriendlyName = TCHAR_TO_ANSI(*CategoryInfo.GetDisplayName());
const char* CategoryDescription = TCHAR_TO_ANSI(*CategoryInfo.Description);
const auto CategoryFriendlyName = StringCast<ANSICHAR>(*CategoryInfo.GetDisplayName());
const auto CategoryDescription = StringCast<ANSICHAR>(*CategoryInfo.Description);
if (bShowAllVerbosity == false)
{
@@ -156,7 +159,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
{
ImGui::BeginTooltip();
ImGui::Separator();
ImGui::Text("%s", CategoryDescription);
ImGui::Text("%s", CategoryDescription.Get());
ImGui::Text("Server");
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, IsControlDown ? 1.0f : 0.5f), "Very Verbose [CTRL]");
ImGui::EndTooltip();
@@ -174,7 +177,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
ImGui::PushStyleColor(ImGuiCol_CheckMark, IM_COL32(255, 128, 0, 200));
}
if (ImGui::Checkbox(CategoryFriendlyName, &IsActive))
if (ImGui::Checkbox(CategoryFriendlyName.Get(), &IsActive))
{
ELogVerbosity::Type NewVerbosity;
if (IsControlDown && Verbosity != ELogVerbosity::VeryVerbose)
@@ -196,7 +199,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::BeginTooltip();
ImGui::Text("%s", CategoryDescription);
ImGui::Text("%s", CategoryDescription.Get());
ImGui::Separator();
if (IsClient)
{
@@ -231,7 +234,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::BeginTooltip();
ImGui::Text("%s", CategoryDescription);
ImGui::Text("%s", CategoryDescription.Get());
ImGui::Separator();
ImGui::Text("Server");
ImGui::EndTooltip();
@@ -261,7 +264,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
if (IsClient && ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::BeginTooltip();
ImGui::Text("%s", CategoryDescription);
ImGui::Text("%s", CategoryDescription.Get());
ImGui::Separator();
ImGui::Text("Local Client");
ImGui::EndTooltip();
@@ -269,7 +272,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
}
ImGui::SameLine();
ImGui::Text("%s", CategoryFriendlyName);
ImGui::Text("%s", CategoryFriendlyName.Get());
}
ImGui::PopID();
@@ -4,6 +4,7 @@
#include "CogImguiHelper.h"
#include "CogWindowWidgets.h"
#include "imgui.h"
#include "Engine/World.h"
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_Metrics::Initialize()
@@ -7,6 +7,8 @@
#include "Engine/NetConnection.h"
#include "Engine/World.h"
#include "GameFramework/PlayerState.h"
#include "GameFramework/Controller.h"
#include "GameFramework/PlayerController.h"
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_NetEmulation::RenderHelp()
@@ -1,11 +1,12 @@
#include "CogEngineWindow_Plots.h"
#include "CogImGuiHelper.h"
#include "CogImguiHelper.h"
#include "CogDebugPlot.h"
#include "CogWindowWidgets.h"
#include "imgui.h"
#include "implot_internal.h"
#include "Kismet/GameplayStatics.h"
#include "Engine/World.h"
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_Plots::Initialize()
@@ -142,7 +143,7 @@ void FCogEngineWindow_Plots::RenderPlotsList(TArray<FCogDebugPlotEntry*>& Visibl
{
const auto EntryName = StringCast<ANSICHAR>(*Entry.Name.ToString());
ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1);
ImGui::Text(EntryName.Get());
ImGui::Text("%s", EntryName.Get());
ImGui::EndDragDropSource();
}
@@ -246,7 +247,7 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
ImPlot::SetAxis(Entry.CurrentYAxis);
ImPlot::SetNextLineStyle(IMPLOT_AUTO_COL);
const char* Label = TCHAR_TO_ANSI(*Entry.Name.ToString());
const auto Label = StringCast<ANSICHAR>(*Entry.Name.ToString());
//----------------------------------------------------------------
// Pause the scrolling if the user drag inside
@@ -271,20 +272,20 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
const bool IsEventPlot = Entry.Events.Num() > 0;
if (IsEventPlot)
{
RenderEvents(Entry, Label, PlotMin, PlotMax);
RenderEvents(Entry, Label.Get(), PlotMin, PlotMax);
}
//-------------------------------------------------------
// Plot Values
//-------------------------------------------------------
else
{
RenderValues(Entry, Label);
RenderValues(Entry, Label.Get());
}
//-------------------------------------------------------
// Allow legend item labels to be drag and drop sources
//-------------------------------------------------------
if (ImPlot::BeginDragDropSourceItem(Label))
if (ImPlot::BeginDragDropSourceItem(Label.Get()))
{
const auto EntryName = StringCast<ANSICHAR>(*Entry.Name.ToString());
ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1);
@@ -4,6 +4,7 @@
#include "CogImguiHelper.h"
#include "CogWindowWidgets.h"
#include "Engine/Engine.h"
#include "Scalability.h"
#define SCALABILITY_NUM_LEVELS 5
@@ -13,6 +13,7 @@
#include "HAL/IConsoleManager.h"
#include "imgui.h"
#include "Kismet/GameplayStatics.h"
#include "Components/PrimitiveComponent.h"
FString FCogEngineWindow_Selection::ToggleSelectionModeCommand = TEXT("Cog.ToggleSelectionMode");
@@ -6,6 +6,8 @@
#include "Components/SkeletalMeshComponent.h"
#include "Engine/SkeletalMesh.h"
#include "imgui_internal.h"
#include "DrawDebugHelpers.h"
#include "Engine/World.h"
//--------------------------------------------------------------------------------------------------------------------------
void FCogEngineWindow_Skeleton::Initialize()
@@ -138,8 +140,8 @@ void FCogEngineWindow_Skeleton::RenderBoneEntry(int32 BoneIndex, bool OpenAllChi
return;
}
const char* BoneName = TCHAR_TO_ANSI(*BoneInfo.Name.ToString());
const bool ShowNode = Filter.PassFilter(BoneName);
const auto BoneName = StringCast<ANSICHAR>(*BoneInfo.Name.ToString());
const bool ShowNode = Filter.PassFilter(BoneName.Get());
bool OpenChildren = false;
if (ShowNode)
@@ -235,7 +237,7 @@ void FCogEngineWindow_Skeleton::RenderBoneEntry(int32 BoneIndex, bool OpenAllChi
//------------------------
ImGui::SameLine();
ImVec4 NameColor = HasCustomVisiblity ? ImVec4(1.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
ImGui::TextColored(NameColor, "%s", BoneName);
ImGui::TextColored(NameColor, "%s", BoneName.Get());
}
//------------------------
@@ -6,6 +6,8 @@
#include "Engine/NetConnection.h"
#include "GameFramework/PlayerState.h"
#include "Net/NetPing.h"
#include "GameFramework/Controller.h"
#include "GameFramework/PlayerController.h"
ImVec4 StatRedColor(1.0f, 0.4f, 0.3f, 1.0f);
ImVec4 StatOrangeColor(1.0f, 0.7f, 0.4f, 1.0f);