mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 00:01:37 -07:00
Merge branch 'main' into pr/48
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#include "CogCommonModule.h"
|
||||
|
||||
#include "CogCommonLogCategory.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FCogCommonModule"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "CogDebugReplicator.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Engine/World.h"
|
||||
#include "imgui.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
|
||||
@@ -144,7 +143,7 @@ bool FCogDebug::GetIsFilteringBySelection()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebug::SetIsFilteringBySelection(UWorld* World, bool Value)
|
||||
void FCogDebug::SetIsFilteringBySelection(const UWorld* World, bool Value)
|
||||
{
|
||||
Settings.bIsFilteringBySelection = Value;
|
||||
|
||||
@@ -191,7 +190,7 @@ int FCogDebug::GetDebugSegments()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
int FCogDebug::GetCircleSegments()
|
||||
{
|
||||
return (Settings.Segments * 2) + 2; // because DrawDebugCircle does Segments = FMath::Max((Segments - 2) / 2, 4) for some reason
|
||||
return (Settings.Segments * 2) + 2; // because DrawDebugCircle do: Segments = FMath::Max((Segments - 2) / 2, 4) for some reason
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -252,7 +251,7 @@ FColor FCogDebug::ModulateDebugColor(const UWorld* World, const FColor& Color, b
|
||||
case ECogDebugRecolorMode::HueOverFrames:
|
||||
{
|
||||
const FLinearColor BaseColor(Color);
|
||||
const float Factor = (Settings.RecolorFrameCycle > 0) ? (GFrameCounter % Settings.RecolorFrameCycle) / (float)Settings.RecolorFrameCycle : 0.0f;
|
||||
const float Factor = (Settings.RecolorFrameCycle > 0) ? (GFrameCounter % Settings.RecolorFrameCycle) / static_cast<float>(Settings.RecolorFrameCycle) : 0.0f;
|
||||
const FLinearColor NewColor(Factor * 360.0f, 1.0f, 1.0f);
|
||||
const FLinearColor BlendColor = BaseColor * (1.0f - Settings.RecolorIntensity) + NewColor.HSVToLinearRGB() * Settings.RecolorIntensity;
|
||||
return BlendColor.ToFColor(true);
|
||||
|
||||
@@ -546,7 +546,7 @@ void FCogDebugDraw::Points(const FLogCategoryBase& LogCategory, const UObject* W
|
||||
int32 Index = 0;
|
||||
for (const FVector& Point : Points)
|
||||
{
|
||||
const FLinearColor Color = FLinearColor::LerpUsingHSV(FLinearColor(StartColor), FLinearColor(EndColor), Points.Num() <= 1 ? 0.0f : Index / (float)(Points.Num() - 1));
|
||||
const FLinearColor Color = FLinearColor::LerpUsingHSV(FLinearColor(StartColor), FLinearColor(EndColor), Points.Num() <= 1 ? 0.0f : Index / static_cast<float>(Points.Num() - 1));
|
||||
Sphere(LogCategory, WorldContextObject, Point, Radius, Color.ToFColor(true), Persistent, DepthPriority);
|
||||
Index++;
|
||||
}
|
||||
@@ -577,7 +577,7 @@ void FCogDebugDraw::Path(const FLogCategoryBase& LogCategory, const UObject* Wor
|
||||
int32 Index = 0;
|
||||
for (const FVector& Position : Points)
|
||||
{
|
||||
const FLinearColor LinearColor = FLinearColor::LerpUsingHSV(FLinearColor(StartColor), FLinearColor(EndColor), Points.Num() <= 1 ? 0.0f : Index / (float)(Points.Num() - 1));
|
||||
const FLinearColor LinearColor = FLinearColor::LerpUsingHSV(FLinearColor(StartColor), FLinearColor(EndColor), Points.Num() <= 1 ? 0.0f : Index / static_cast<float>(Points.Num() - 1));
|
||||
FColor Color = LinearColor.ToFColor(true);
|
||||
|
||||
Point(LogCategory, WorldContextObject, Position, PointSize, Color, Persistent, DepthPriority);
|
||||
@@ -622,7 +622,6 @@ void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeleta
|
||||
|
||||
const FTransform Transform = ComponentSpaceTransforms[BoneIndex] * WorldTransform;
|
||||
const FVector BoneLocation = Transform.GetLocation();
|
||||
const FRotator BoneRotation = FRotator(Transform.GetRotation());
|
||||
const int32 ParentIndex = ReferenceSkeleton.GetParentIndex(BoneIndex);
|
||||
|
||||
FVector ParentLocation;
|
||||
|
||||
@@ -78,7 +78,7 @@ void FCogDebugDrawHelper::DrawArc(
|
||||
}
|
||||
|
||||
float CurrentAngle = AngleStartRad;
|
||||
const float AngleStep = (AngleEndRad - AngleStartRad) / float(Segments);
|
||||
const float AngleStep = (AngleEndRad - AngleStartRad) / static_cast<float>(Segments);
|
||||
FVector PrevVertex = Center + OuterRadius * (AxisZ * FMath::Sin(CurrentAngle) + AxisY * FMath::Cos(CurrentAngle));
|
||||
int32 Count = Segments;
|
||||
while (Count--)
|
||||
@@ -94,7 +94,6 @@ void FCogDebugDrawHelper::DrawArc(
|
||||
CurrentAngle = AngleStartRad;
|
||||
PrevVertex = Center + InnerRadius * (AxisZ * FMath::Sin(CurrentAngle) + AxisY * FMath::Cos(CurrentAngle));
|
||||
|
||||
Count = Segments;
|
||||
while (Segments--)
|
||||
{
|
||||
CurrentAngle += AngleStep;
|
||||
@@ -189,8 +188,8 @@ void FCogDebugDrawHelper::DrawFrustum(
|
||||
|
||||
const float HozHalfAngleInRadians = FMath::DegreesToRadians(Angle * 0.5f);
|
||||
|
||||
float HozLength = 0.0f;
|
||||
float VertLength = 0.0f;
|
||||
float HozLength;
|
||||
float VertLength;
|
||||
|
||||
if (Angle > 0.0f)
|
||||
{
|
||||
@@ -398,7 +397,7 @@ void FCogDebugDrawHelper::DrawLineTrace(
|
||||
const FVector& Start,
|
||||
const FVector& End,
|
||||
const bool HasHits,
|
||||
TArray<FHitResult>& HitResults,
|
||||
const TArray<FHitResult>& HitResults,
|
||||
const FCogDebugDrawLineTraceParams& Settings
|
||||
)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "imgui_internal.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
float FCogDebugDrawImGui::Time = 0;
|
||||
TArray<FCogDebugDrawImGui::FLine> FCogDebugDrawImGui::Lines;
|
||||
TArray<FCogDebugDrawImGui::FTriangle> FCogDebugDrawImGui::Triangles;
|
||||
TArray<FCogDebugDrawImGui::FTriangle> FCogDebugDrawImGui::TrianglesFilled;
|
||||
@@ -22,7 +23,7 @@ void FCogDebugDrawImGui::AddLine(const ImVec2& P1, const ImVec2& P2, ImU32 Color
|
||||
Line.P2 = P2;
|
||||
Line.Color = Color;
|
||||
Line.Thickness = Thickness;
|
||||
Line.Time = ImGui::GetCurrentContext()->Time;
|
||||
Line.Time = Time;
|
||||
Line.Duration = Duration;
|
||||
Line.FadeColor = FadeColor;
|
||||
Lines.Add_GetRef(Line);
|
||||
@@ -37,7 +38,7 @@ void FCogDebugDrawImGui::AddRect(const ImVec2& Min, const ImVec2& Max, ImU32 Col
|
||||
Rectangle.Color = Color;
|
||||
Rectangle.Rounding = Rounding;
|
||||
Rectangle.Thickness = Thickness;
|
||||
Rectangle.Time = ImGui::GetCurrentContext()->Time;
|
||||
Rectangle.Time = Time;
|
||||
Rectangle.Duration = Duration;
|
||||
Rectangle.FadeColor = FadeColor;
|
||||
Rectangles.Add_GetRef(Rectangle);
|
||||
@@ -52,7 +53,7 @@ void FCogDebugDrawImGui::AddRectFilled(const ImVec2& Min, const ImVec2& Max, ImU
|
||||
Rectangle.Color = Color;
|
||||
Rectangle.Rounding = Rounding;
|
||||
Rectangle.Thickness = 0.0f;
|
||||
Rectangle.Time = ImGui::GetCurrentContext()->Time;
|
||||
Rectangle.Time = Time;
|
||||
Rectangle.Duration = Duration;
|
||||
Rectangle.FadeColor = FadeColor;
|
||||
RectanglesFilled.Add_GetRef(Rectangle);
|
||||
@@ -68,7 +69,7 @@ void FCogDebugDrawImGui::AddQuad(const ImVec2& P1, const ImVec2& P2, const ImVec
|
||||
Quad.P4 = P4;
|
||||
Quad.Color = Color;
|
||||
Quad.Thickness = Thickness;
|
||||
Quad.Time = ImGui::GetCurrentContext()->Time;
|
||||
Quad.Time = Time;
|
||||
Quad.Duration = Duration;
|
||||
Quad.FadeColor = FadeColor;
|
||||
Quads.Add_GetRef(Quad);
|
||||
@@ -84,7 +85,7 @@ void FCogDebugDrawImGui::AddQuadFilled(const ImVec2& P1, const ImVec2& P2, const
|
||||
Quad.P4 = P4;
|
||||
Quad.Color = Color;
|
||||
Quad.Thickness = 0.0f;
|
||||
Quad.Time = ImGui::GetCurrentContext()->Time;
|
||||
Quad.Time = Time;
|
||||
Quad.Duration = Duration;
|
||||
Quad.FadeColor = FadeColor;
|
||||
QuadsFilled.Add_GetRef(Quad);
|
||||
@@ -99,7 +100,7 @@ void FCogDebugDrawImGui::AddTriangle(const ImVec2& P1, const ImVec2& P2, const I
|
||||
Triangle.P3 = P3;
|
||||
Triangle.Color = Color;
|
||||
Triangle.Thickness = Thickness;
|
||||
Triangle.Time = ImGui::GetCurrentContext()->Time;
|
||||
Triangle.Time = Time;
|
||||
Triangle.Duration = Duration;
|
||||
Triangle.FadeColor = FadeColor;
|
||||
Triangles.Add_GetRef(Triangle);
|
||||
@@ -114,7 +115,7 @@ void FCogDebugDrawImGui::AddTriangleFilled(const ImVec2& P1, const ImVec2& P2, c
|
||||
Triangle.P3 = P3;
|
||||
Triangle.Color = Color;
|
||||
Triangle.Thickness = 0.0f;
|
||||
Triangle.Time = ImGui::GetCurrentContext()->Time;
|
||||
Triangle.Time = Time;
|
||||
Triangle.Duration = Duration;
|
||||
Triangle.FadeColor = FadeColor;
|
||||
TrianglesFilled.Add_GetRef(Triangle);
|
||||
@@ -123,13 +124,14 @@ void FCogDebugDrawImGui::AddTriangleFilled(const ImVec2& P1, const ImVec2& P2, c
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDrawImGui::AddCircle(const ImVec2& Center, float Radius, ImU32 Color, int Segments /*= 0*/, float Thickness /*= 1.0f*/, float Duration /*= 0.0f*/, bool FadeColor /*= false*/)
|
||||
{
|
||||
|
||||
FCircle Circle;
|
||||
Circle.Center = Center;
|
||||
Circle.Radius = Radius > 0.0f ? Radius : 1.0f;
|
||||
Circle.Color = Color;
|
||||
Circle.Segments = Segments;
|
||||
Circle.Thickness = Thickness;
|
||||
Circle.Time = ImGui::GetCurrentContext()->Time;
|
||||
Circle.Time = Time;
|
||||
Circle.Duration = Duration;
|
||||
Circle.FadeColor = FadeColor;
|
||||
Circles.Add_GetRef(Circle);
|
||||
@@ -144,7 +146,7 @@ void FCogDebugDrawImGui::AddCircleFilled(const ImVec2& Center, float Radius, ImU
|
||||
Circle.Color = Color;
|
||||
Circle.Segments = Segments;
|
||||
Circle.Thickness = 0.0f;
|
||||
Circle.Time = ImGui::GetCurrentContext()->Time;
|
||||
Circle.Time = Time;
|
||||
Circle.Duration = Duration;
|
||||
Circle.FadeColor = FadeColor;
|
||||
CirclesFilled.Add_GetRef(Circle);
|
||||
@@ -157,7 +159,7 @@ void FCogDebugDrawImGui::AddText(const ImVec2& Pos, const FString& Text, ImU32 C
|
||||
TextElement.Pos = Pos;
|
||||
TextElement.Text = Text;
|
||||
TextElement.Color = Color;
|
||||
TextElement.Time = ImGui::GetCurrentContext()->Time;
|
||||
TextElement.Time = Time;
|
||||
TextElement.Duration = Duration;
|
||||
TextElement.FadeColor = FadeColor;
|
||||
Texts.Add_GetRef(TextElement);
|
||||
@@ -169,7 +171,7 @@ void FCogDebugDrawImGui::AddText(const ImVec2& Pos, const FString& Text, ImU32 C
|
||||
ShadowTextElement.Text = Text;
|
||||
const float Alpha = ImGui::ColorConvertU32ToFloat4(Color).w; // Keep original Alpha and set to black
|
||||
ShadowTextElement.Color = ImGui::ColorConvertFloat4ToU32(ImVec4(0, 0, 0, Alpha));
|
||||
ShadowTextElement.Time = ImGui::GetCurrentContext()->Time;
|
||||
ShadowTextElement.Time = Time;
|
||||
ShadowTextElement.Duration = Duration;
|
||||
ShadowTextElement.FadeColor = FadeColor;
|
||||
Texts.Add_GetRef(ShadowTextElement);
|
||||
@@ -181,7 +183,7 @@ void FCogDebugDrawImGui::AddText(const ImVec2& Pos, const FString& Text, ImU32 C
|
||||
void FCogDebugDrawImGui::Draw()
|
||||
{
|
||||
ImDrawList* DrawList = ImGui::GetBackgroundDrawList();
|
||||
double Time = ImGui::GetCurrentContext()->Time;
|
||||
Time = ImGui::GetCurrentContext()->Time;
|
||||
|
||||
DrawShapes(Lines, [DrawList](const FLine& Line, const ImColor Color) { DrawList->AddLine(Line.P1, Line.P2, Color, Line.Thickness); });
|
||||
DrawShapes(Rectangles, [DrawList](const FRectangle& Rectangle, const ImColor Color) { DrawList->AddRect(Rectangle.Min, Rectangle.Max, Color, Rectangle.Rounding, Rectangle.Thickness); });
|
||||
|
||||
@@ -74,7 +74,7 @@ float ScreenDistanceToArc(const APlayerController& InPlayerController, const FVe
|
||||
const FVector AxisZ = Matrix.GetScaledAxis(EAxis::Z);
|
||||
|
||||
float CurrentAngle = AngleStartRad;
|
||||
const float AngleStep = (AngleEndRad - AngleStartRad) / float(NumSegments);
|
||||
const float AngleStep = (AngleEndRad - AngleStartRad) / static_cast<float>(NumSegments);
|
||||
|
||||
FVector P0 = Center + Radius * (AxisZ * FMath::Sin(CurrentAngle) + AxisY * FMath::Cos(CurrentAngle));
|
||||
|
||||
@@ -259,7 +259,7 @@ bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerCont
|
||||
const FColor GizmoAxisColorsZHigh[] = { Settings.GizmoAxisColorsZHighX, Settings.GizmoAxisColorsZHighY, Settings.GizmoAxisColorsZHighZ, Settings.GizmoAxisColorsZHighW };
|
||||
const FColor GizmoAxisColorsSelection[] = { Settings.GizmoAxisColorsSelectionX, Settings.GizmoAxisColorsSelectionY, Settings.GizmoAxisColorsSelectionZ, Settings.GizmoAxisColorsSelectionW };
|
||||
|
||||
FCogDebug_GizmoElement GizmoElements[(uint8)ECogDebug_GizmoElementType::MAX];
|
||||
FCogDebug_GizmoElement GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MAX)];
|
||||
for (FCogDebug_GizmoElement& GizmoElement : GizmoElements)
|
||||
{
|
||||
GizmoElement.Type = ECogDebug_GizmoType::MAX;
|
||||
@@ -267,35 +267,35 @@ bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerCont
|
||||
|
||||
if (EnumHasAnyFlags(Flags, ECogDebug_GizmoFlags::NoTranslationAxis) == false)
|
||||
{
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::MoveX] = { ECogDebug_GizmoType::MoveAxis, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, GizmoCenter + UnitAxisX * Settings.GizmoTranslationAxisLength * GizmoScale };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::MoveY] = { ECogDebug_GizmoType::MoveAxis, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, GizmoCenter + UnitAxisY * Settings.GizmoTranslationAxisLength * GizmoScale };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::MoveZ] = { ECogDebug_GizmoType::MoveAxis, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, GizmoCenter + UnitAxisZ * Settings.GizmoTranslationAxisLength * GizmoScale };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MoveX)] = { ECogDebug_GizmoType::MoveAxis, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, GizmoCenter + UnitAxisX * Settings.GizmoTranslationAxisLength * GizmoScale };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MoveY)] = { ECogDebug_GizmoType::MoveAxis, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, GizmoCenter + UnitAxisY * Settings.GizmoTranslationAxisLength * GizmoScale };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MoveZ)] = { ECogDebug_GizmoType::MoveAxis, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, GizmoCenter + UnitAxisZ * Settings.GizmoTranslationAxisLength * GizmoScale };
|
||||
}
|
||||
|
||||
if (EnumHasAnyFlags(Flags, ECogDebug_GizmoFlags::NoTranslationPlane) == false)
|
||||
{
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::MoveXY] = { ECogDebug_GizmoType::MovePlane, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, GizmoCenter + ((UnitAxisX + UnitAxisY) * Settings.GizmoTranslationPlaneOffset * GizmoScale) };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::MoveXZ] = { ECogDebug_GizmoType::MovePlane, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, GizmoCenter + ((UnitAxisX + UnitAxisZ) * Settings.GizmoTranslationPlaneOffset * GizmoScale) };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::MoveYZ] = { ECogDebug_GizmoType::MovePlane, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, GizmoCenter + ((UnitAxisY + UnitAxisZ) * Settings.GizmoTranslationPlaneOffset * GizmoScale) };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MoveXY)] = { ECogDebug_GizmoType::MovePlane, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, GizmoCenter + ((UnitAxisX + UnitAxisY) * Settings.GizmoTranslationPlaneOffset * GizmoScale) };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MoveXZ)] = { ECogDebug_GizmoType::MovePlane, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, GizmoCenter + ((UnitAxisX + UnitAxisZ) * Settings.GizmoTranslationPlaneOffset * GizmoScale) };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::MoveYZ)] = { ECogDebug_GizmoType::MovePlane, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, GizmoCenter + ((UnitAxisY + UnitAxisZ) * Settings.GizmoTranslationPlaneOffset * GizmoScale) };
|
||||
}
|
||||
|
||||
if (EnumHasAnyFlags(Flags, ECogDebug_GizmoFlags::NoRotation) == false)
|
||||
{
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::RotateX] = { ECogDebug_GizmoType::Rotate, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, FVector::ZeroVector };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::RotateY] = { ECogDebug_GizmoType::Rotate, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, FVector::ZeroVector };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::RotateZ] = { ECogDebug_GizmoType::Rotate, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, FVector::ZeroVector };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::RotateX)] = { ECogDebug_GizmoType::Rotate, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, FVector::ZeroVector };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::RotateY)] = { ECogDebug_GizmoType::Rotate, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, FVector::ZeroVector };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::RotateZ)] = { ECogDebug_GizmoType::Rotate, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, FVector::ZeroVector };
|
||||
}
|
||||
|
||||
if (EnumHasAnyFlags(Flags, ECogDebug_GizmoFlags::NoScaleUniform) == false)
|
||||
{
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::ScaleXYZ] = { ECogDebug_GizmoType::ScaleUniform, ECogDebug_GizmoAxis::MAX, FVector::OneVector, FVector::OneVector, RotX, GizmoCenter };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::ScaleXYZ)] = { ECogDebug_GizmoType::ScaleUniform, ECogDebug_GizmoAxis::MAX, FVector::OneVector, FVector::OneVector, RotX, GizmoCenter };
|
||||
}
|
||||
|
||||
if (EnumHasAnyFlags(Flags, ECogDebug_GizmoFlags::NoScaleAxis) == false)
|
||||
{
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::ScaleX] = { ECogDebug_GizmoType::ScaleAxis, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, GizmoCenter + UnitAxisX * Settings.GizmoScaleBoxOffset * GizmoScale };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::ScaleY] = { ECogDebug_GizmoType::ScaleAxis, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, GizmoCenter + UnitAxisY * Settings.GizmoScaleBoxOffset * GizmoScale };
|
||||
GizmoElements[(uint8)ECogDebug_GizmoElementType::ScaleZ] = { ECogDebug_GizmoType::ScaleAxis, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, GizmoCenter + UnitAxisZ * Settings.GizmoScaleBoxOffset * GizmoScale };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::ScaleX)] = { ECogDebug_GizmoType::ScaleAxis, ECogDebug_GizmoAxis::X, FVector::XAxisVector, UnitAxisX, RotX, GizmoCenter + UnitAxisX * Settings.GizmoScaleBoxOffset * GizmoScale };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::ScaleY)] = { ECogDebug_GizmoType::ScaleAxis, ECogDebug_GizmoAxis::Y, FVector::YAxisVector, UnitAxisY, RotY, GizmoCenter + UnitAxisY * Settings.GizmoScaleBoxOffset * GizmoScale };
|
||||
GizmoElements[static_cast<uint8>(ECogDebug_GizmoElementType::ScaleZ)] = { ECogDebug_GizmoType::ScaleAxis, ECogDebug_GizmoAxis::Z, FVector::ZAxisVector, UnitAxisZ, RotZ, GizmoCenter + UnitAxisZ * Settings.GizmoScaleBoxOffset * GizmoScale };
|
||||
}
|
||||
|
||||
ECogDebug_GizmoElementType HoveredElementType = ECogDebug_GizmoElementType::MAX;
|
||||
@@ -306,7 +306,7 @@ bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerCont
|
||||
else if (IO.WantCaptureMouse == false)
|
||||
{
|
||||
float MinDistanceToMouse = FLT_MAX;
|
||||
for (uint8 i = (uint8)ECogDebug_GizmoElementType::MoveX; i < (uint8)ECogDebug_GizmoElementType::MAX; ++i)
|
||||
for (uint8 i = static_cast<uint8>(ECogDebug_GizmoElementType::MoveX); i < static_cast<uint8>(ECogDebug_GizmoElementType::MAX); ++i)
|
||||
{
|
||||
FCogDebug_GizmoElement& Elm = GizmoElements[i];
|
||||
float DistanceToMouse = FLT_MAX;
|
||||
@@ -345,17 +345,17 @@ bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerCont
|
||||
|
||||
if (DistanceToMouse < Settings.GizmoCursorSelectionThreshold && DistanceToMouse < MinDistanceToMouse)
|
||||
{
|
||||
HoveredElementType = (ECogDebug_GizmoElementType)i;
|
||||
HoveredElementType = static_cast<ECogDebug_GizmoElementType>(i);
|
||||
MinDistanceToMouse = DistanceToMouse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 i = (uint8)ECogDebug_GizmoElementType::MoveX; i < (uint8)ECogDebug_GizmoElementType::MAX; ++i)
|
||||
for (uint8 i = static_cast<uint8>(ECogDebug_GizmoElementType::MoveX); i < static_cast<uint8>(ECogDebug_GizmoElementType::MAX); ++i)
|
||||
{
|
||||
const FCogDebug_GizmoElement& Elm = GizmoElements[i];
|
||||
const bool IsClosestToMouse = i == (uint8)HoveredElementType;
|
||||
const uint8 AxisIndex = (uint8)Elm.AxisType;
|
||||
const bool IsClosestToMouse = i == static_cast<uint8>(HoveredElementType);
|
||||
const uint8 AxisIndex = static_cast<uint8>(Elm.AxisType);
|
||||
const FColor ZLowColor = IsClosestToMouse ? GizmoAxisColorsSelection[AxisIndex] : GizmoAxisColorsZLow[AxisIndex];
|
||||
const FColor ZHighColor = IsClosestToMouse ? GizmoAxisColorsSelection[AxisIndex] : GizmoAxisColorsZHigh[AxisIndex];
|
||||
|
||||
@@ -425,7 +425,7 @@ bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerCont
|
||||
}
|
||||
else if (ImGui::IsMouseDragging(ImGuiMouseButton_Left, Settings.GizmoCursorDraggingThreshold))
|
||||
{
|
||||
const FCogDebug_GizmoElement& DraggedElement = GizmoElements[(uint8)DraggedElementType];
|
||||
const FCogDebug_GizmoElement& DraggedElement = GizmoElements[static_cast<uint8>(DraggedElementType)];
|
||||
|
||||
switch (DraggedElement.Type)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ FColor FCogDebugHelper::GetAutoColor(FName Name, const FColor& UserColor)
|
||||
const uint32 Hash = GetTypeHash(Name.ToString());
|
||||
FMath::RandInit(Hash);
|
||||
|
||||
const uint8 Hue = (uint8)(FMath::FRand() * 255);
|
||||
const uint8 Saturation = 255;
|
||||
const uint8 Hue = static_cast<uint8>(FMath::FRand() * 255);
|
||||
constexpr uint8 Saturation = 255;
|
||||
const uint8 Value = FMath::Rand() > 0.5f ? 200 : 255;
|
||||
|
||||
return FLinearColor::MakeFromHSV8(Hue, Saturation, Value).ToFColor(true);
|
||||
@@ -33,9 +33,8 @@ const char* FCogDebugHelper::VerbosityToString(ELogVerbosity::Type Verbosity)
|
||||
case ELogVerbosity::Log: return "Log";
|
||||
case ELogVerbosity::Verbose: return "Verbose";
|
||||
case ELogVerbosity::VeryVerbose: return "Very Verbose";
|
||||
default: return "None";
|
||||
}
|
||||
|
||||
return "None";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -97,16 +97,16 @@ ELogVerbosity::Type FCogDebugLog::GetServerVerbosity(const FName CategoryName)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::SetServerVerbosity(UWorld& World, const FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
void FCogDebugLog::SetServerVerbosity(const UWorld& World, const FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
{
|
||||
if (ACogDebugReplicator* Replicator = ACogDebugReplicator::GetLocalReplicator(World))
|
||||
{
|
||||
Replicator->Server_SetCategoryVerbosity(CategoryName, (ECogLogVerbosity)Verbosity);
|
||||
Replicator->Server_SetCategoryVerbosity(CategoryName, static_cast<ECogLogVerbosity>(Verbosity));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::SetServerVerbosityActive(UWorld& World, const FName CategoryName, const bool Value)
|
||||
void FCogDebugLog::SetServerVerbosityActive(const UWorld& World, const FName CategoryName, const bool Value)
|
||||
{
|
||||
SetServerVerbosity(World, CategoryName, Value ? ELogVerbosity::Verbose : ELogVerbosity::Warning);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, const FCogLog
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// ReSharper disable once CppPassValueParameterByConstReference
|
||||
bool UCogDebugLogBlueprint::IsLogActive(const UObject* WorldContextObject, const FCogLogCategory LogCategory)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -104,9 +104,9 @@ FCogDebugPlotEvent& FCogDebugEventHistory::AddEvent(
|
||||
//----------------------------
|
||||
StopEvent(EventId);
|
||||
|
||||
FCogDebugPlotEvent* Event = nullptr;
|
||||
|
||||
int32 AddedIndex = 0;
|
||||
FCogDebugPlotEvent* Event;
|
||||
int32 AddedIndex;
|
||||
|
||||
if (Events.Num() < Events.Max())
|
||||
{
|
||||
Event = &Events.AddDefaulted_GetRef();
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "CogDebugReplicator.h"
|
||||
|
||||
#include "CogDebug.h"
|
||||
#include "CogDebugDraw.h"
|
||||
#include "CogDebugLog.h"
|
||||
#include "EngineUtils.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "GameFramework/WorldSettings.h"
|
||||
#include "Net/Core/PushModel/PushModel.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -27,17 +25,18 @@ ACogDebugReplicator* ACogDebugReplicator::Spawn(APlayerController* Controller)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ACogDebugReplicator* ACogDebugReplicator::GetLocalReplicator(const UWorld& World)
|
||||
{
|
||||
for (TActorIterator<ACogDebugReplicator> It(&World, StaticClass()); It; ++It)
|
||||
const TActorIterator<ACogDebugReplicator> It(&World, StaticClass());
|
||||
if (It)
|
||||
{
|
||||
ACogDebugReplicator* Replicator = *It;
|
||||
return Replicator;
|
||||
return Replicator;
|
||||
}
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogDebugReplicator::GetRemoteReplicators(UWorld& World, TArray<ACogDebugReplicator*>& Replicators)
|
||||
void ACogDebugReplicator::GetRemoteReplicators(const UWorld& World, TArray<ACogDebugReplicator*>& Replicators)
|
||||
{
|
||||
for (TActorIterator<ACogDebugReplicator> It(&World, ACogDebugReplicator::StaticClass()); It; ++It)
|
||||
{
|
||||
@@ -104,7 +103,7 @@ void ACogDebugReplicator::TickActor(float DeltaTime, enum ELevelTick TickType, F
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
Super::TickActor(DeltaTime, TickType, ThisTickFunction);
|
||||
if (OwnerPlayerController)
|
||||
if (OwnerPlayerController.IsValid())
|
||||
{
|
||||
if (GetWorld()->GetNetMode() == NM_Client)
|
||||
{
|
||||
@@ -128,7 +127,7 @@ void ACogDebugReplicator::Server_SetCategoryVerbosity_Implementation(FName LogCa
|
||||
{
|
||||
if (const FCogDebugLogCategoryInfo* LogCategoryInfo = FCogDebugLog::FindLogCategoryInfo(LogCategoryName))
|
||||
{
|
||||
LogCategoryInfo->LogCategory->SetVerbosity((ELogVerbosity::Type)Verbosity);
|
||||
LogCategoryInfo->LogCategory->SetVerbosity(static_cast<ELogVerbosity::Type>(Verbosity));
|
||||
|
||||
TArray<FCogServerCategoryData> CategoriesData;
|
||||
CategoriesData.Add({ LogCategoryName, Verbosity });
|
||||
@@ -148,7 +147,7 @@ void ACogDebugReplicator::NetMulticast_SendCategoriesVerbosity_Implementation(co
|
||||
{
|
||||
for (const FCogServerCategoryData& Category : Categories)
|
||||
{
|
||||
FCogDebugLog::OnServerVerbosityChanged(Category.LogCategoryName, (ELogVerbosity::Type)Category.Verbosity);
|
||||
FCogDebugLog::OnServerVerbosityChanged(Category.LogCategoryName, static_cast<ELogVerbosity::Type>(Category.Verbosity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +163,7 @@ void ACogDebugReplicator::Client_SendCategoriesVerbosity_Implementation(const TA
|
||||
{
|
||||
for (const FCogServerCategoryData& Category : Categories)
|
||||
{
|
||||
FCogDebugLog::OnServerVerbosityChanged(Category.LogCategoryName, (ELogVerbosity::Type)Category.Verbosity);
|
||||
FCogDebugLog::OnServerVerbosityChanged(Category.LogCategoryName, static_cast<ELogVerbosity::Type>(Category.Verbosity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +187,7 @@ void ACogDebugReplicator::Server_RequestAllCategoriesVerbosity_Implementation()
|
||||
CategoriesData.Add(
|
||||
{
|
||||
CategoryInfo.LogCategory->GetCategoryName(),
|
||||
(ECogLogVerbosity)CategoryInfo.LogCategory->GetVerbosity()
|
||||
static_cast<ECogLogVerbosity>(CategoryInfo.LogCategory->GetVerbosity())
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -248,14 +247,14 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// FCogReplicatorNetPack
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
|
||||
bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParams)
|
||||
{
|
||||
if (DeltaParms.bUpdateUnmappedObjects || Owner == nullptr)
|
||||
if (DeltaParams.bUpdateUnmappedObjects || Owner == nullptr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (DeltaParms.Writer)
|
||||
if (DeltaParams.Writer)
|
||||
{
|
||||
const bool bIsOwnerClient = !Owner->bHasAuthority;
|
||||
if (bIsOwnerClient)
|
||||
@@ -263,10 +262,10 @@ bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms
|
||||
return false;
|
||||
}
|
||||
|
||||
const FCogReplicatorNetState* OldState = static_cast<FCogReplicatorNetState*>(DeltaParms.OldState);
|
||||
const FCogReplicatorNetState* OldState = static_cast<FCogReplicatorNetState*>(DeltaParams.OldState);
|
||||
FCogReplicatorNetState* NewState = new FCogReplicatorNetState();
|
||||
check(DeltaParms.NewState);
|
||||
*DeltaParms.NewState = TSharedPtr<INetDeltaBaseState>(NewState);
|
||||
check(DeltaParams.NewState);
|
||||
*DeltaParams.NewState = TSharedPtr<INetDeltaBaseState>(NewState);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Find delta to replicate
|
||||
@@ -289,7 +288,7 @@ bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms
|
||||
const bool bMissingOldState = (OldState == nullptr);
|
||||
const uint8 ShouldUpdateShapes = bMissingOldState || (OldState->ShapesRepCounter != NewState->ShapesRepCounter);
|
||||
|
||||
FBitWriter& Writer = *DeltaParms.Writer;
|
||||
FBitWriter& Writer = *DeltaParams.Writer;
|
||||
Writer.WriteBit(ShouldUpdateShapes);
|
||||
if (ShouldUpdateShapes)
|
||||
{
|
||||
@@ -297,12 +296,12 @@ bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (DeltaParms.Reader)
|
||||
else if (DeltaParams.Reader)
|
||||
{
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Read
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
FBitReader& Reader = *DeltaParms.Reader;
|
||||
FBitReader& Reader = *DeltaParams.Reader;
|
||||
const uint8 ShouldUpdateShapes = Reader.ReadBit();
|
||||
if (ShouldUpdateShapes)
|
||||
{
|
||||
|
||||
@@ -392,7 +392,7 @@ public:
|
||||
|
||||
static bool GetIsFilteringBySelection();
|
||||
|
||||
static void SetIsFilteringBySelection(UWorld* World, bool Value);
|
||||
static void SetIsFilteringBySelection(const UWorld* World, bool Value);
|
||||
|
||||
static bool GetDebugPersistent(bool bPersistent);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ReSharper disable CppUEBlueprintCallableFunctionUnused
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
#include "CogDebugDrawBlueprint.generated.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
static void DrawHitResults(const UWorld* World, const TArray<FHitResult>& HitResults, const FCogDebugDrawLineTraceParams& Settings);
|
||||
|
||||
static void DrawLineTrace(const UWorld* World, const FVector& Start, const FVector& End, const bool HasHits, TArray<FHitResult>& HitResults, const FCogDebugDrawLineTraceParams& Settings);
|
||||
static void DrawLineTrace(const UWorld* World, const FVector& Start, const FVector& End, const bool HasHits, const TArray<FHitResult>& HitResults, const FCogDebugDrawLineTraceParams& Settings);
|
||||
|
||||
static void DrawSweep(const UWorld* World, const FCollisionShape& Shape, const FVector& Start, const FVector& End, const FQuat& Rotation, const bool HasHits, TArray<FHitResult>& HitResults, const FCogDebugDrawSweepParams& Settings);
|
||||
};
|
||||
|
||||
@@ -77,6 +77,7 @@ private:
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static float Time;
|
||||
static TArray<FLine> Lines;
|
||||
static TArray<FTriangle> Triangles;
|
||||
static TArray<FTriangle> TrianglesFilled;
|
||||
@@ -92,9 +93,6 @@ private:
|
||||
template<typename TShape, typename TDrawFunction>
|
||||
static void DrawShapes(TArray<TShape>& Shapes, TDrawFunction DrawFunction)
|
||||
{
|
||||
ImDrawList* ImDrawList = ImGui::GetBackgroundDrawList();
|
||||
const double Time = ImGui::GetCurrentContext()->Time;
|
||||
|
||||
for (int32 i = 0; i < Shapes.Num(); i++)
|
||||
{
|
||||
const TShape& Shape = Shapes[i];
|
||||
|
||||
@@ -46,13 +46,13 @@ struct COGDEBUG_API FCogDebugLog
|
||||
|
||||
static TMap<FName, FCogDebugLogCategoryInfo>& GetLogCategories() { return LogCategories; }
|
||||
|
||||
static void SetServerVerbosityActive(UWorld& World, FName CategoryName, bool Value);
|
||||
static void SetServerVerbosityActive(const UWorld& World, FName CategoryName, bool Value);
|
||||
|
||||
static bool IsServerVerbosityActive(FName CategoryName);
|
||||
|
||||
static ELogVerbosity::Type GetServerVerbosity(FName CategoryName);
|
||||
|
||||
static void SetServerVerbosity(UWorld& World, FName CategoryName, ELogVerbosity::Type Verbosity);
|
||||
static void SetServerVerbosity(const UWorld& World, FName CategoryName, ELogVerbosity::Type Verbosity);
|
||||
|
||||
static void OnServerVerbosityChanged(FName CategoryName, ELogVerbosity::Type Verbosity);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class COGDEBUG_API FCogDebugModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
static inline FCogDebugModule& Get() { return FModuleManager::LoadModuleChecked<FCogDebugModule>("CogDebug"); }
|
||||
static FCogDebugModule& Get() { return FModuleManager::LoadModuleChecked<FCogDebugModule>("CogDebug"); }
|
||||
|
||||
virtual void StartupModule() override;
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
|
||||
#ifdef ENABLE_COG
|
||||
|
||||
|
||||
#endif //ENABLE_COG
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogCommon.h"
|
||||
#include "imgui.h"
|
||||
#include "implot.h"
|
||||
|
||||
#ifdef ENABLE_COG
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ struct FCogReplicatorNetPack
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
ACogDebugReplicator* Owner = nullptr;
|
||||
TObjectPtr<ACogDebugReplicator> Owner;
|
||||
|
||||
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms);
|
||||
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParams);
|
||||
|
||||
private:
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
static ACogDebugReplicator* GetLocalReplicator(const UWorld& World);
|
||||
|
||||
static void GetRemoteReplicators(UWorld& World, TArray<ACogDebugReplicator*>& Replicators);
|
||||
static void GetRemoteReplicators(const UWorld& World, TArray<ACogDebugReplicator*>& Replicators);
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
protected:
|
||||
friend FCogReplicatorNetPack;
|
||||
|
||||
TObjectPtr<APlayerController> OwnerPlayerController;
|
||||
TWeakObjectPtr<APlayerController> OwnerPlayerController;
|
||||
|
||||
uint32 bHasAuthority : 1;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct COGDEBUG_API FCogDebugShape
|
||||
{
|
||||
ECogDebugShape Type = ECogDebugShape::Invalid;
|
||||
TArray<FVector> ShapeData;
|
||||
FColor Color;
|
||||
FColor Color = FColor::White;
|
||||
bool bPersistent = false;
|
||||
float Thickness = 0.0f;
|
||||
uint8 DepthPriority = 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ private:
|
||||
/** Pin factory for abilities graph; Cached so it can be unregistered */
|
||||
TSharedPtr<FCogGraphPanelPinFactory> GraphPanelPinFactory;
|
||||
|
||||
EAssetTypeCategories::Type AssetCategory;
|
||||
EAssetTypeCategories::Type AssetCategory = EAssetTypeCategories::None;
|
||||
};
|
||||
|
||||
IMPLEMENT_MODULE(FCogDebugEditorModule, CogDebugEditor);
|
||||
|
||||
@@ -64,7 +64,7 @@ void FCogLogCategoryDetails::CustomizeChildren(TSharedRef<IPropertyHandle> Struc
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogLogCategoryDetails::OnLogCategoryChanged(FName SelectedName)
|
||||
void FCogLogCategoryDetails::OnLogCategoryChanged(const FName SelectedName) const
|
||||
{
|
||||
if (NameProperty.IsValid())
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
*/
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
virtual ~SLogCategoryListWidget();
|
||||
virtual ~SLogCategoryListWidget() override;
|
||||
|
||||
private:
|
||||
typedef TTextFilter<const FName&> FLogCategoryTextFilter;
|
||||
@@ -132,10 +132,10 @@ private:
|
||||
void OnFilterTextChanged(const FText& InFilterText);
|
||||
|
||||
/** Creates the row widget when called by Slate when an item appears on the list. */
|
||||
TSharedRef< ITableRow > OnGenerateRowForLogCategoryViewer(TSharedPtr<FLogCategoryViewerNode> Item, const TSharedRef< STableViewBase >& OwnerTable);
|
||||
TSharedRef< ITableRow > OnGenerateRowForLogCategoryViewer(TSharedPtr<FLogCategoryViewerNode> Item, const TSharedRef< STableViewBase >& OwnerTable) const;
|
||||
|
||||
/** Called by Slate when an item is selected from the tree/list. */
|
||||
void OnLogCategorySelectionChanged(TSharedPtr<FLogCategoryViewerNode> Item, ESelectInfo::Type SelectInfo);
|
||||
void OnLogCategorySelectionChanged(TSharedPtr<FLogCategoryViewerNode> Item, ESelectInfo::Type SelectInfo) const;
|
||||
|
||||
/** Updates the list of items in the dropdown menu */
|
||||
TSharedPtr<FLogCategoryViewerNode> UpdatePropertyOptions();
|
||||
@@ -146,7 +146,7 @@ private:
|
||||
/** The search box */
|
||||
TSharedPtr<SSearchBox> SearchBoxPtr;
|
||||
|
||||
/** Holds the Slate List widget which holds the LogCategorys for the LogCategory Viewer. */
|
||||
/** Holds the Slate List widget which holds the LogCategory for the LogCategory Viewer. */
|
||||
TSharedPtr<SListView<TSharedPtr< FLogCategoryViewerNode > >> LogCategoryList;
|
||||
|
||||
/** Array of items that can be selected in the dropdown menu */
|
||||
@@ -229,7 +229,7 @@ void SLogCategoryListWidget::Construct(const FArguments& InArgs)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TSharedRef<ITableRow> SLogCategoryListWidget::OnGenerateRowForLogCategoryViewer(TSharedPtr<FLogCategoryViewerNode> Item, const TSharedRef< STableViewBase >& OwnerTable)
|
||||
TSharedRef<ITableRow> SLogCategoryListWidget::OnGenerateRowForLogCategoryViewer(TSharedPtr<FLogCategoryViewerNode> Item, const TSharedRef< STableViewBase >& OwnerTable) const
|
||||
{
|
||||
TSharedRef< SLogCategoryItem > ReturnRow = SNew(SLogCategoryItem, OwnerTable)
|
||||
.HighlightText(SearchBoxPtr->GetText())
|
||||
@@ -273,7 +273,7 @@ void SLogCategoryListWidget::OnFilterTextChanged(const FText& InFilterText)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void SLogCategoryListWidget::OnLogCategorySelectionChanged(TSharedPtr<FLogCategoryViewerNode> Item, ESelectInfo::Type SelectInfo)
|
||||
void SLogCategoryListWidget::OnLogCategorySelectionChanged(TSharedPtr<FLogCategoryViewerNode> Item, ESelectInfo::Type SelectInfo) const
|
||||
{
|
||||
OnLogCategoryPicked.ExecuteIfBound(Item->Name);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Modules/ModuleInterface.h"
|
||||
@@ -9,7 +8,7 @@ class ICogDebugEditorModule : public IModuleInterface
|
||||
|
||||
public:
|
||||
|
||||
static inline ICogDebugEditorModule& Get() { return FModuleManager::LoadModuleChecked<ICogDebugEditorModule>("CogDebugEditor"); }
|
||||
static ICogDebugEditorModule& Get() { return FModuleManager::LoadModuleChecked<ICogDebugEditorModule>("CogDebugEditor"); }
|
||||
|
||||
static inline bool IsAvailable() { return FModuleManager::Get().IsModuleLoaded("CogDebugEditor"); }
|
||||
static bool IsAvailable() { return FModuleManager::Get().IsModuleLoaded("CogDebugEditor"); }
|
||||
};
|
||||
|
||||
@@ -17,6 +17,6 @@ class FCogGraphPanelPinFactory : public FGraphPanelPinFactory
|
||||
{
|
||||
return SNew(SCogLogCategoryGraphPin, InPin);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,5 +20,5 @@ private:
|
||||
TSharedPtr<IPropertyHandle> NameProperty;
|
||||
TArray<TSharedPtr<FString>> PropertyOptions;
|
||||
|
||||
void OnLogCategoryChanged(FName SelectedName);
|
||||
void OnLogCategoryChanged(FName SelectedName) const;
|
||||
};
|
||||
|
||||
@@ -25,7 +25,8 @@ public class CogEngine : ModuleRules
|
||||
"InputCore",
|
||||
"NetCore",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"SlateCore",
|
||||
"BuildSettings",
|
||||
});
|
||||
|
||||
if (Target.bBuildEditor)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "CogEngineHelper.h"
|
||||
|
||||
#include "CogEngineReplicator.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
@@ -55,4 +54,17 @@ void FCogEngineHelper::ActorContextMenu(AActor& Actor)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineHelper::RenderConfigureMessage(const TWeakObjectPtr<const UCogEngineDataAsset> InAsset)
|
||||
{
|
||||
if (InAsset == nullptr)
|
||||
{
|
||||
ImGui::Text("Create a DataAsset child of '%s' to configure. ", StringCast<ANSICHAR>(*UCogEngineDataAsset::StaticClass()->GetName()).Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("Can be configured in the '%s' DataAsset. ", StringCast<ANSICHAR>(*GetNameSafe(InAsset.Get())).Get());
|
||||
}
|
||||
}
|
||||
@@ -32,12 +32,13 @@ ACogEngineReplicator* ACogEngineReplicator::Spawn(APlayerController* Controller)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ACogEngineReplicator* ACogEngineReplicator::GetLocalReplicator(const UWorld& World)
|
||||
{
|
||||
for (TActorIterator<ACogEngineReplicator> It(&World, StaticClass()); It; ++It)
|
||||
const TActorIterator<ACogEngineReplicator> It(&World, StaticClass());
|
||||
if (It)
|
||||
{
|
||||
ACogEngineReplicator* Replicator = *It;
|
||||
return Replicator;
|
||||
}
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Audio::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window displays audio settings. "
|
||||
);
|
||||
ImGui::Text("This window displays audio settings.");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
#include "CogEngineWindow_BuildInfo.h"
|
||||
|
||||
#include "CogImguiHelper.h"
|
||||
#include "imgui.h"
|
||||
#include "BuildSettings.h"
|
||||
#include "GenericPlatform/GenericPlatformMisc.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_BuildInfo::Initialize()
|
||||
{
|
||||
FCogWindow::Initialize();
|
||||
|
||||
Config = GetConfig<UCogEngineConfig_BuildInfo>();
|
||||
|
||||
BuildText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_BuildInfo::RenderHelp()
|
||||
{
|
||||
ImGui::Text(
|
||||
"This window can be used to display the build information such as the build version, changelist, date, target, and so on."
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_BuildInfo::RenderTick(float DeltaTime)
|
||||
{
|
||||
FCogWindow::RenderTick(DeltaTime);
|
||||
|
||||
if (FApp::GetBuildTargetType() == EBuildTargetType::Editor)
|
||||
{
|
||||
if (Config->ShowInEditor == false)
|
||||
{ return; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config->ShowInPackage == false)
|
||||
{ return;}
|
||||
}
|
||||
|
||||
const auto TextStr = StringCast<ANSICHAR>(*Text);
|
||||
ImDrawList* DrawList = Config->ShowInForeground ? ImGui::GetForegroundDrawList() : ImGui::GetBackgroundDrawList();
|
||||
const ImVec2 WindowPadding = ImGui::GetStyle().WindowPadding;
|
||||
const ImVec2 TextSize = ImGui::CalcTextSize(TextStr.Get(), nullptr, false);
|
||||
const ImVec2 RectSize = TextSize + WindowPadding * 2;
|
||||
const ImVec2 Pos = FCogWindowWidgets::ComputeScreenCornerLocation(Config->Alignment, Config->Padding);
|
||||
const ImVec2 AlignedPos = Pos - (FCogImguiHelper::ToImVec2(Config->Alignment) * RectSize);
|
||||
|
||||
DrawList->AddRectFilled(AlignedPos, AlignedPos + RectSize, FCogImguiHelper::ToImU32(Config->BackgroundColor), Config->Rounding);
|
||||
DrawList->AddRect(AlignedPos, AlignedPos + RectSize, FCogImguiHelper::ToImU32(Config->BorderColor), Config->Rounding);
|
||||
DrawList->AddText(AlignedPos + WindowPadding, FCogImguiHelper::ToImU32(Config->TextColor), TextStr.Get());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_BuildInfo::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
FCogWindowWidgets::ThinSeparatorText("Build Properties");
|
||||
|
||||
if (ImGui::BeginChild("Settings", ImVec2(-1, 100 * GetDpiScale()), ImGuiChildFlags_FrameStyle | ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeY))
|
||||
{
|
||||
if (ImGui::Checkbox("Branch Name", &Config->ShowBranchName)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Build Date", &Config->ShowBuildDate)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Build Configuration", &Config->ShowBuildConfiguration)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Build User", &Config->ShowBuildUser)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Build Machine", &Config->ShowBuildMachine)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Build Target Type", &Config->ShowBuildTargetType)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Current Change list", &Config->ShowCurrentChangelist)) { BuildText(); }
|
||||
if (ImGui::Checkbox("Compatible Change list", &Config->ShowCompatibleChangelist)) { BuildText(); }
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
FCogWindowWidgets::ThinSeparatorText("Display");
|
||||
|
||||
ImGui::Checkbox("Show In Editor", &Config->ShowInEditor);
|
||||
ImGui::Checkbox("Show In Package", &Config->ShowInPackage);
|
||||
ImGui::Checkbox("Show In Foreground", &Config->ShowInForeground);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::SliderFloat2("Alignment", &Config->Alignment.X, 0, 1.0f, "%.2f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::SliderInt2("Padding", &Config->Padding.X, 0, 100);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::SliderInt("Rounding", &Config->Rounding, 0, 12);
|
||||
|
||||
constexpr ImGuiColorEditFlags ColorEditFlags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||
FCogImguiHelper::ColorEdit4("Background Color", Config->BackgroundColor, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Border Color", Config->BorderColor, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Text Color", Config->TextColor, ColorEditFlags);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Reset Settings", ImVec2(-1, 0)))
|
||||
{
|
||||
ResetConfig();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_BuildInfo::BuildText()
|
||||
{
|
||||
FStringBuilderBase S;
|
||||
if (Config->ShowBranchName) { S.Append(BuildSettings::GetBranchName()); S.Append(" "); }
|
||||
if (Config->ShowBuildDate) { S.Append(BuildSettings::GetBuildDate()); S.Append(" "); }
|
||||
if (Config->ShowBuildConfiguration) { S.Append(LexToString(FApp::GetBuildConfiguration())); S.Append(" "); }
|
||||
if (Config->ShowBuildTargetType) { S.Append(LexToString(FApp::GetBuildTargetType())); S.Append(" "); }
|
||||
if (Config->ShowBuildUser) { S.Append(BuildSettings::GetBuildUser()); S.Append(" "); }
|
||||
if (Config->ShowBuildMachine) { S.Append(BuildSettings::GetBuildMachine()); S.Append(" "); }
|
||||
if (Config->ShowCurrentChangelist) { S.Appendf(TEXT("%d"), BuildSettings::GetCurrentChangelist()); S.Append(" "); }
|
||||
if (Config->ShowCompatibleChangelist) { S.Appendf(TEXT("%d"),BuildSettings::GetCompatibleChangelist()); }
|
||||
|
||||
Text = FString(S).TrimEnd();
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CogEngineDataAsset.h"
|
||||
#include "CogEngineReplicator.h"
|
||||
#include "CogCommonAllegianceActorInterface.h"
|
||||
#include "CogEngineHelper.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowConsoleCommandManager.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
@@ -22,14 +23,7 @@ void FCogEngineWindow_Cheats::RenderHelp()
|
||||
" [SHIFT] to apply the cheat to the enemies of the selected actor\n"
|
||||
);
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::Text("Create a DataAsset child of 'CogEngineDataAsset' to configure the cheats. ");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("The cheats can be configured in the '%s' data asset. ", StringCast<ANSICHAR>(*GetNameSafe(Asset.Get())).Get());
|
||||
}
|
||||
FCogEngineHelper::RenderConfigureMessage(Asset);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -46,7 +40,7 @@ void FCogEngineWindow_Cheats::Initialize()
|
||||
TEXT("Cog.Cheat"),
|
||||
TEXT("Apply a cheat to the selection. Cog.Cheat <CheatName> -Allies -Enemies -Controlled"),
|
||||
GetWorld(),
|
||||
FCogWindowConsoleCommandDelegate::CreateLambda([this](const TArray<FString>& InArgs, UWorld* InWorld)
|
||||
FCogWindowConsoleCommandDelegate::CreateLambda([this](const TArray<FString>& InArgs, const UWorld* InWorld)
|
||||
{
|
||||
if (InArgs.Num() > 0)
|
||||
{
|
||||
@@ -60,7 +54,7 @@ void FCogEngineWindow_Cheats::Initialize()
|
||||
ACogEngineReplicator* Replicator = ACogEngineReplicator::GetLocalReplicator(*InWorld);
|
||||
if (Replicator == nullptr)
|
||||
{
|
||||
UE_LOG(LogCogImGui, Warning, TEXT("Cog.Cheat %s | Repliactor not found"), *InArgs[0]);
|
||||
UE_LOG(LogCogImGui, Warning, TEXT("Cog.Cheat %s | Replicator not found"), *InArgs[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,13 +145,12 @@ void FCogEngineWindow_CollisionTester::RenderContent()
|
||||
{
|
||||
CollisionTester->ProfileIndex = i;
|
||||
CollisionTester->ObjectTypesToQuery = 0;
|
||||
SelectedProfile = CollisionProfile->GetProfileByIndex(CollisionTester->ProfileIndex);
|
||||
|
||||
if (Profile->CollisionEnabled != ECollisionEnabled::NoCollision)
|
||||
{
|
||||
for (int j = 0; j < ECC_MAX; ++j)
|
||||
{
|
||||
const ECollisionResponse Response = Profile->ResponseToChannels.GetResponse((ECollisionChannel)j);
|
||||
const ECollisionResponse Response = Profile->ResponseToChannels.GetResponse(static_cast<ECollisionChannel>(j));
|
||||
if (Response != ECR_Ignore)
|
||||
{
|
||||
CollisionTester->ObjectTypesToQuery |= ECC_TO_BITFIELD(j);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "CogDebugDrawHelper.h"
|
||||
#include "CogDebug.h"
|
||||
#include "CogEngineCollisionTester.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Components/PrimitiveComponent.h"
|
||||
@@ -120,7 +119,7 @@ void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||
{
|
||||
for (int j = 0; j < ECC_MAX; ++j)
|
||||
{
|
||||
ECollisionResponse Response = Profile->ResponseToChannels.GetResponse((ECollisionChannel)j);
|
||||
ECollisionResponse Response = Profile->ResponseToChannels.GetResponse(static_cast<ECollisionChannel>(j));
|
||||
if (Response != ECR_Ignore)
|
||||
{
|
||||
Config->ObjectTypesToQuery |= ECC_TO_BITFIELD(j);
|
||||
@@ -182,6 +181,8 @@ void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||
QueryRadius = Config->QueryThickness;
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
static const FName TraceTag(TEXT("FCogWindow_Collision"));
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
#include "CogEngineWindow_Console.h"
|
||||
|
||||
#include "CogCommon.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowManager.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -24,7 +19,6 @@ void FCogEngineWindow_Console::Initialize()
|
||||
|
||||
Config = GetConfig<UCogEngineConfig_Console>();
|
||||
|
||||
bNoPadding = true;
|
||||
bHasMenu = true;
|
||||
bHasWidget = true;
|
||||
bIsWidgetVisible = true;
|
||||
@@ -34,9 +28,16 @@ void FCogEngineWindow_Console::Initialize()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Console::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
void FCogEngineWindow_Console::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
WindowFlags |= ImGuiWindowFlags_NoScrollbar;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Console::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -200,7 +201,7 @@ void FCogEngineWindow_Console::RenderMenu()
|
||||
RefreshCommandList();
|
||||
}
|
||||
|
||||
ImGui::ColorEdit4("History Color", (float*)&Config->HistoryColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("History Color", &Config->HistoryColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
|
||||
FCogWindowWidgets::ThinSeparatorText("Window");
|
||||
|
||||
|
||||
@@ -57,14 +57,14 @@ void FCogEngineWindow_Inspector::SetInspectedObject(UObject* Value)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Inspector::AddFavorite(UObject* Object)
|
||||
{
|
||||
Favorite& Favorite = Favorites.AddDefaulted_GetRef();
|
||||
FFavorite& Favorite = Favorites.AddDefaulted_GetRef();
|
||||
Favorite.Object = Object;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Inspector::AddFavorite(UObject* Object, FCogEngineInspectorApplyFunction ApplyFunction)
|
||||
{
|
||||
Favorite& Favorite = Favorites.AddDefaulted_GetRef();
|
||||
FFavorite& Favorite = Favorites.AddDefaulted_GetRef();
|
||||
Favorite.Object = Object;
|
||||
Favorite.ApplyFunction = ApplyFunction;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void FCogEngineWindow_Inspector::RenderContent()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FCogEngineInspectorApplyFunction FCogEngineWindow_Inspector::FindObjectApplyFunction(const UObject* Object) const
|
||||
{
|
||||
for (const Favorite& Favorite : Favorites)
|
||||
for (const FFavorite& Favorite : Favorites)
|
||||
{
|
||||
if (Favorite.Object == Object)
|
||||
{
|
||||
@@ -172,17 +172,12 @@ void FCogEngineWindow_Inspector::RenderMenu()
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::SetTooltip("Current Inspected Object: %s", InspectedObjectName.Get());
|
||||
ImGui::SetTooltip("%s", InspectedObjectName.Get());
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(1);
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::SetTooltip("%s", InspectedObjectName.Get());
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(1);
|
||||
ImGui::PopStyleVar(1);
|
||||
|
||||
@@ -206,7 +201,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
|
||||
}
|
||||
|
||||
ImGui::PushID("Favorites");
|
||||
for (Favorite& Favorite : Favorites)
|
||||
for (FFavorite& Favorite : Favorites)
|
||||
{
|
||||
const TWeakObjectPtr<UObject>& Object = Favorite.Object;
|
||||
if (ImGui::MenuItem(TCHAR_TO_ANSI(*GetNameSafe(Object.Get()))))
|
||||
@@ -273,7 +268,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
|
||||
|
||||
ImGui::Checkbox("Sort by Name", &Config->bSortByName);
|
||||
ImGui::Checkbox("Show Background", &Config->bShowRowBackground);
|
||||
ImGui::Checkbox("Show Sorders", &Config->bShowBorders);
|
||||
ImGui::Checkbox("Show Borders", &Config->bShowBorders);
|
||||
#if WITH_EDITORONLY_DATA
|
||||
ImGui::Checkbox("Show Display Name", &Config->bShowDisplayName);
|
||||
ImGui::Checkbox("Show Categories", &Config->bShowCategories);
|
||||
@@ -349,7 +344,7 @@ bool FCogEngineWindow_Inspector::RenderInspector()
|
||||
ImGui::SetNextItemOpen(false);
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader(TCHAR_TO_ANSI(*Entry.Key), nullptr, ImGuiTreeNodeFlags_DefaultOpen))
|
||||
if (ImGui::CollapsingHeader(TCHAR_TO_UTF8(*Entry.Key), nullptr, ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
if (RenderBegin())
|
||||
{
|
||||
@@ -456,7 +451,7 @@ bool FCogEngineWindow_Inspector::RenderPropertyList(TArray<const FProperty*>& Pr
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8* PointerToValue, int IndexInArray)
|
||||
bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8* PointerToValue, int IndexInArray, const char* NameSuffix)
|
||||
{
|
||||
bool HasChanged = false;
|
||||
|
||||
@@ -473,6 +468,11 @@ bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8
|
||||
if (IndexInArray != -1)
|
||||
{
|
||||
PropertyName = FString::Printf(TEXT("[%d]"), IndexInArray);
|
||||
if (NameSuffix != nullptr)
|
||||
{
|
||||
PropertyName.Append(" ");
|
||||
PropertyName.Append(NameSuffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -510,7 +510,7 @@ bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("DisplayName:");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(TCHAR_TO_ANSI(*Property->GetDisplayNameText().ToString()));
|
||||
ImGui::Text(TCHAR_TO_UTF8(*Property->GetDisplayNameText().ToString()));
|
||||
#endif // WITH_EDITORONLY_DATA
|
||||
|
||||
ImGui::TableNextRow();
|
||||
@@ -532,7 +532,7 @@ bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8
|
||||
ImGui::TableNextColumn();
|
||||
if (Property->HasMetaData("Tooltip"))
|
||||
{
|
||||
ImGui::Text(TCHAR_TO_ANSI(*Property->GetToolTipText(false).ToString()));
|
||||
ImGui::Text(TCHAR_TO_UTF8(*Property->GetToolTipText(false).ToString()));
|
||||
}
|
||||
#endif // WITH_EDITORONLY_DATA
|
||||
|
||||
@@ -550,7 +550,7 @@ bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
|
||||
ImGui::Text(TCHAR_TO_ANSI(*Property->GetToolTipText(false).ToString()));
|
||||
ImGui::Text(TCHAR_TO_UTF8(*Property->GetToolTipText(false).ToString()));
|
||||
ImGui::Text("Details [CTRL]");
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
@@ -635,6 +635,14 @@ bool FCogEngineWindow_Inspector::RenderProperty(const FProperty* Property, uint8
|
||||
{
|
||||
HasChanged = RenderArray(ArrayProperty, PointerToValue, ShowChildren);
|
||||
}
|
||||
else if (const FSetProperty* SetProperty = CastField<FSetProperty>(Property))
|
||||
{
|
||||
HasChanged = RenderSet(SetProperty, PointerToValue, ShowChildren);
|
||||
}
|
||||
else if (const FMapProperty* MapProperty = CastField<FMapProperty>(Property))
|
||||
{
|
||||
HasChanged = RenderMap(MapProperty, PointerToValue, ShowChildren);
|
||||
}
|
||||
else if (const FDelegateProperty* DelegateProperty = CastField<FDelegateProperty>(Property))
|
||||
{
|
||||
}
|
||||
@@ -680,7 +688,7 @@ bool FCogEngineWindow_Inspector::RenderByte(const FByteProperty* ByteProperty, u
|
||||
if (ImGui::InputInt("##Byte", &Value))
|
||||
{
|
||||
HasChanged = true;
|
||||
ByteProperty->SetPropertyValue(PointerToValue, (uint8)Value);
|
||||
ByteProperty->SetPropertyValue(PointerToValue, static_cast<uint8>(Value));
|
||||
}
|
||||
|
||||
return HasChanged;
|
||||
@@ -695,7 +703,7 @@ bool FCogEngineWindow_Inspector::RenderInt8(const FInt8Property* Int8Property, u
|
||||
if (ImGui::InputInt("##Int8", &Value))
|
||||
{
|
||||
HasChanged = true;
|
||||
Int8Property->SetPropertyValue(PointerToValue, (int8)Value);
|
||||
Int8Property->SetPropertyValue(PointerToValue, static_cast<int8>(Value));
|
||||
}
|
||||
|
||||
return HasChanged;
|
||||
@@ -721,11 +729,11 @@ bool FCogEngineWindow_Inspector::RenderInt64(const FInt64Property* Int64Property
|
||||
{
|
||||
bool HasChanged = false;
|
||||
|
||||
int Value = (int)Int64Property->GetPropertyValue(PointerToValue);
|
||||
int Value = static_cast<int>(Int64Property->GetPropertyValue(PointerToValue));
|
||||
if (ImGui::InputInt("##UInt64", &Value))
|
||||
{
|
||||
HasChanged = true;
|
||||
Int64Property->SetPropertyValue(PointerToValue, (uint64)Value);
|
||||
Int64Property->SetPropertyValue(PointerToValue, static_cast<uint64>(Value));
|
||||
}
|
||||
|
||||
return HasChanged;
|
||||
@@ -736,11 +744,11 @@ bool FCogEngineWindow_Inspector::RenderUInt32(const FUInt32Property* UInt32Prope
|
||||
{
|
||||
bool HasChanged = false;
|
||||
|
||||
int Value = (int)UInt32Property->GetPropertyValue(PointerToValue);
|
||||
int Value = static_cast<int>(UInt32Property->GetPropertyValue(PointerToValue));
|
||||
if (ImGui::InputInt("##UInt32", &Value))
|
||||
{
|
||||
HasChanged = true;
|
||||
UInt32Property->SetPropertyValue(PointerToValue, (uint32)Value);
|
||||
UInt32Property->SetPropertyValue(PointerToValue, static_cast<uint32>(Value));
|
||||
}
|
||||
|
||||
return HasChanged;
|
||||
@@ -819,7 +827,7 @@ bool FCogEngineWindow_Inspector::RenderText(const FTextProperty* TextProperty, u
|
||||
FString Text;
|
||||
TextProperty->ExportTextItem_Direct(Text, PointerToValue, nullptr, nullptr, PPF_None, nullptr);
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*Text));
|
||||
ImGui::Text("%s", TCHAR_TO_UTF8(*Text));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
return false;
|
||||
@@ -869,7 +877,7 @@ bool FCogEngineWindow_Inspector::RenderObject(UObject* Object, bool ShowChildren
|
||||
bool FCogEngineWindow_Inspector::RenderStruct(const FStructProperty* StructProperty, uint8* PointerToValue, bool ShowChildren)
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*StructProperty->Struct->GetClass()->GetName()));
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*StructProperty->Struct->GetStructCPPName()));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
bool HasChanged = false;
|
||||
@@ -936,7 +944,12 @@ bool FCogEngineWindow_Inspector::RenderArray(const FArrayProperty* ArrayProperty
|
||||
const int32 Num = Helper.Num();
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Text("%s [%d]", TCHAR_TO_ANSI(*ArrayProperty->Inner->GetClass()->GetName()), Num);
|
||||
FString ElementPropertyName = ArrayProperty->Inner->GetClass()->GetName();
|
||||
if (const FStructProperty* StructProperty = CastField<FStructProperty>(ArrayProperty->Inner))
|
||||
{
|
||||
ElementPropertyName = StructProperty->Struct->GetStructCPPName();
|
||||
}
|
||||
ImGui::Text("%s [%d]", StringCast<ANSICHAR>(*ElementPropertyName).Get(), Num);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
bool HasChanged = false;
|
||||
@@ -955,6 +968,75 @@ bool FCogEngineWindow_Inspector::RenderArray(const FArrayProperty* ArrayProperty
|
||||
return HasChanged;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogEngineWindow_Inspector::RenderSet(const FSetProperty* SetProperty, uint8* PointerToValue, bool ShowChildren)
|
||||
{
|
||||
FScriptSetHelper Helper(SetProperty, PointerToValue);
|
||||
const int32 Num = Helper.Num();
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
FString ElementPropertyName = SetProperty->GetElementProperty()->GetClass()->GetName();
|
||||
if (const FStructProperty* StructProperty = CastField<FStructProperty>(SetProperty->GetElementProperty()))
|
||||
{
|
||||
ElementPropertyName = StructProperty->Struct->GetStructCPPName();
|
||||
}
|
||||
ImGui::Text("%s {%d}", StringCast<ANSICHAR>(*ElementPropertyName).Get(), Num);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
bool HasChanged = false;
|
||||
|
||||
if (ShowChildren)
|
||||
{
|
||||
for (int32 i = 0; i < Num; ++i)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
HasChanged |= RenderProperty(SetProperty->GetElementProperty(), Helper.GetElementPtr(i), i);
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
return HasChanged;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogEngineWindow_Inspector::RenderMap(const FMapProperty* MapProperty, uint8* PointerToValue, bool ShowChildren)
|
||||
{
|
||||
FScriptMapHelper Helper(MapProperty, PointerToValue);
|
||||
const int32 Num = Helper.Num();
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
FString KeyPropertyName = MapProperty->GetKeyProperty()->GetClass()->GetName();
|
||||
if (const FStructProperty* StructProperty = CastField<FStructProperty>(MapProperty->GetKeyProperty()))
|
||||
{
|
||||
KeyPropertyName = StructProperty->Struct->GetStructCPPName();
|
||||
}
|
||||
FString ValuePropertyName = MapProperty->GetValueProperty()->GetClass()->GetName();
|
||||
if (const FStructProperty* StructProperty = CastField<FStructProperty>(MapProperty->GetValueProperty()))
|
||||
{
|
||||
ValuePropertyName = StructProperty->Struct->GetStructCPPName();
|
||||
}
|
||||
ImGui::Text("%s -> %s [%d]", StringCast<ANSICHAR>(*KeyPropertyName).Get(), StringCast<ANSICHAR>(*ValuePropertyName).Get(), Num);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
bool HasChanged = false;
|
||||
|
||||
if (ShowChildren)
|
||||
{
|
||||
for (int32 i = 0; i < Num; ++i)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
// @todo: refactor this so it's better?
|
||||
HasChanged |= RenderProperty(MapProperty->GetKeyProperty(), Helper.GetKeyPtr(i), i, "Key");
|
||||
HasChanged |= RenderProperty(MapProperty->GetValueProperty(), Helper.GetValuePtr(i), i, "Value");
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
return HasChanged;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogEngineWindow_Inspector::HasPropertyAnyChildren(const FProperty* Property, uint8* PointerToValue)
|
||||
{
|
||||
@@ -963,25 +1045,34 @@ bool FCogEngineWindow_Inspector::HasPropertyAnyChildren(const FProperty* Propert
|
||||
const TFieldIterator<FProperty> It(StructProperty->Struct);
|
||||
return It ? true : false;
|
||||
}
|
||||
else if (const FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Property))
|
||||
|
||||
if (const FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Property))
|
||||
{
|
||||
const FScriptArrayHelper Helper(ArrayProperty, PointerToValue);
|
||||
const int32 Num = Helper.Num();
|
||||
if (Num == 0)
|
||||
{ return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (const FSetProperty* SetProperty = CastField<FSetProperty>(Property))
|
||||
{
|
||||
const FScriptSetHelper Helper(SetProperty, PointerToValue);
|
||||
const int32 Num = Helper.Num();
|
||||
if (Num == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (const FClassProperty* ClassProperty = CastField<FClassProperty>(Property))
|
||||
|
||||
if (const FMapProperty* MapProperty = CastField<FMapProperty>(Property))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (const FObjectProperty* ObjectProperty = CastField<FObjectProperty>(Property))
|
||||
{
|
||||
const UObject* ReferencedObject = ObjectProperty->GetObjectPropertyValue(PointerToValue);
|
||||
if (ReferencedObject == nullptr)
|
||||
const FScriptMapHelper Helper(MapProperty, PointerToValue);
|
||||
const int32 Num = Helper.Num();
|
||||
if (Num == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -989,6 +1080,18 @@ bool FCogEngineWindow_Inspector::HasPropertyAnyChildren(const FProperty* Propert
|
||||
return true;
|
||||
}
|
||||
|
||||
if (const FClassProperty* ClassProperty = CastField<FClassProperty>(Property))
|
||||
{ return false; }
|
||||
|
||||
if (const FObjectProperty* ObjectProperty = CastField<FObjectProperty>(Property))
|
||||
{
|
||||
const UObject* ReferencedObject = ObjectProperty->GetObjectPropertyValue(PointerToValue);
|
||||
if (ReferencedObject == nullptr)
|
||||
{ return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,6 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
|
||||
const bool IsClient = World->GetNetMode() == NM_Client;
|
||||
|
||||
ImGuiStyle& Style = ImGui::GetStyle();
|
||||
|
||||
int Index = 0;
|
||||
for (const auto& Entry : FCogDebugLog::GetLogCategories())
|
||||
{
|
||||
@@ -224,10 +222,10 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("##Server", FCogDebugHelper::VerbosityToString(CurrentVerbosity)))
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
for (int32 i = ELogVerbosity::Error; i <= static_cast<int32>(ELogVerbosity::VeryVerbose); ++i)
|
||||
{
|
||||
const bool IsSelected = i == (int32)CurrentVerbosity;
|
||||
const ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
const bool IsSelected = i == static_cast<int32>(CurrentVerbosity);
|
||||
const ELogVerbosity::Type Verbosity = static_cast<ELogVerbosity::Type>(i);
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
@@ -254,10 +252,10 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("##Local", FCogDebugHelper::VerbosityToString(CurrentVerbosity)))
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
for (int32 i = ELogVerbosity::Error; i <= static_cast<int32>(ELogVerbosity::VeryVerbose); ++i)
|
||||
{
|
||||
const bool IsSelected = i == (int32)CurrentVerbosity;
|
||||
const ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
const bool IsSelected = i == static_cast<int32>(CurrentVerbosity);
|
||||
const ELogVerbosity::Type Verbosity = static_cast<ELogVerbosity::Type>(i);
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
|
||||
@@ -121,7 +121,7 @@ void FCogEngineWindow_Metrics::DrawMetric(FCogDebugMetricEntry& Metric)
|
||||
|
||||
ImGui::Text("Crits");
|
||||
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)));
|
||||
FCogWindowWidgets::ProgressBarCentered(Metric.Count == 0 ? 0.0f : Metric.Crits / static_cast<float>(Metric.Count), ImVec2(-1, 0), TCHAR_TO_ANSI(*FString::Printf(TEXT("%d / %d"), Metric.Crits, Metric.Count)));
|
||||
|
||||
if (FCogDebugMetric::MaxDurationSetting > 0.0f)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ void FCogEngineWindow_NetImgui::RenderTick(float DeltaTime)
|
||||
RunServer();
|
||||
}
|
||||
|
||||
ECogNetImguiAutoConnectionMode AutoConnectMode = ECogNetImguiAutoConnectionMode::NoAutoConnect;
|
||||
ECogNetImguiAutoConnectionMode AutoConnectMode;
|
||||
switch (GetWorld()->GetNetMode())
|
||||
{
|
||||
case NM_Client: AutoConnectMode = Config->AutoConnectOnClient; break;
|
||||
@@ -265,7 +265,7 @@ void FCogEngineWindow_NetImgui::RenderContent()
|
||||
FCogWindowWidgets::InputText("Server Arguments", Config->ServerArguments);
|
||||
ImGui::SetItemTooltip("Argument used when launching the NetImgui server executable.");
|
||||
}
|
||||
#endif // #if NETIMGUI_ENABLED
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -285,7 +285,7 @@ FString FCogEngineWindow_NetImgui::GetClientName() const
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_NetImgui::ConnectTo()
|
||||
void FCogEngineWindow_NetImgui::ConnectTo() const
|
||||
{
|
||||
FCogImGuiContextScope ImGuiContextScope(GetOwner()->GetContext());
|
||||
|
||||
@@ -302,7 +302,7 @@ void FCogEngineWindow_NetImgui::ConnectTo()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_NetImgui::ConnectFrom()
|
||||
void FCogEngineWindow_NetImgui::ConnectFrom() const
|
||||
{
|
||||
FCogImGuiContextScope ImGuiContextScope(GetOwner()->GetContext());
|
||||
|
||||
@@ -318,7 +318,7 @@ void FCogEngineWindow_NetImgui::ConnectFrom()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_NetImgui::Disconnect()
|
||||
void FCogEngineWindow_NetImgui::Disconnect() const
|
||||
{
|
||||
FCogImGuiContextScope ImGuiContextScope(GetOwner()->GetContext());
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
#include "CogCommon.h"
|
||||
#include "CogCommonLogCategory.h"
|
||||
#include "CogDebugDraw.h"
|
||||
#include "CogDebugDrawHelper.h"
|
||||
#include "CogDebugDrawImGui.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Engine/Engine.h"
|
||||
@@ -17,9 +14,9 @@ void FCogEngineWindow_Notifications::Initialize()
|
||||
{
|
||||
Super::Initialize();
|
||||
|
||||
OutputDevice.Notifications = this;
|
||||
|
||||
Config = GetConfig<UCogEngineConfig_Notifications>();
|
||||
|
||||
OutputDevice.Notifications = this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -49,6 +46,9 @@ void FCogEngineWindow_Notifications::AddNotification(const TCHAR* InMessage, ELo
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Notifications::OnLogReceived(const TCHAR* InMessage, ELogVerbosity::Type InVerbosity, const class FName& InCategory)
|
||||
{
|
||||
if (Config == nullptr)
|
||||
{ return; }
|
||||
|
||||
if (Config->DisableNotifications)
|
||||
{ return; }
|
||||
|
||||
@@ -87,23 +87,18 @@ void FCogEngineWindow_Notifications::RenderNotifications()
|
||||
| ImGuiWindowFlags_AlwaysAutoResize
|
||||
| ImGuiWindowFlags_NoSavedSettings
|
||||
| ImGuiWindowFlags_NoFocusOnAppearing
|
||||
| ImGuiWindowFlags_NoNav;
|
||||
|
||||
| ImGuiWindowFlags_NoNav
|
||||
| ImGuiWindowFlags_NoInputs;
|
||||
|
||||
const ImGuiViewport* Viewport = ImGui::GetMainViewport();
|
||||
const ImVec2 ViewportPos = Viewport->WorkPos;
|
||||
const ImVec2 ViewportSize = Viewport->WorkSize;
|
||||
|
||||
const float DpiScale = GetDpiScale();
|
||||
|
||||
ImVec2 WindowPos = FCogWindowWidgets::ComputeScreenCornerLocation(Config->Alignment, Config->Padding);
|
||||
const ImVec2 WindowPadding = ImGui::GetStyle().WindowPadding;
|
||||
const ImVec2 ItemSpacing = ImGui::GetStyle().ItemSpacing;
|
||||
const float MaxHeight = Config->MaxHeight * DpiScale + WindowPadding.y * 2;
|
||||
|
||||
const bool IsRight = static_cast<int32>(Config->Location) & 1;
|
||||
const bool IsBottom = static_cast<int32>(Config->Location) & 2;
|
||||
|
||||
ImVec2 WindowPos;
|
||||
WindowPos.x = ViewportPos.x + (IsRight ? ViewportSize.x - Config->Padding : Config->Padding);
|
||||
WindowPos.y = ViewportPos.y + (IsBottom ? ViewportSize.y - Config->Padding : Config->Padding);
|
||||
|
||||
const ImVec2 WindowPosPivot(IsRight ? 1.0f : 0.0f, IsBottom ? 1.0f : 0.0f);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, Config->Rounding);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, Config->ShowBorder);
|
||||
|
||||
@@ -160,13 +155,13 @@ void FCogEngineWindow_Notifications::RenderNotifications()
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, TextColor);
|
||||
|
||||
const auto Message = StringCast<ANSICHAR>(*Notification.Message);
|
||||
const float WrapWidth = Config->TextWrapping * ImGui::GetFontSize();
|
||||
const float WrapWidth = Config->TextWrapping * DpiScale;
|
||||
|
||||
ImGui::SetNextWindowViewport(Viewport->ID);
|
||||
ImGui::SetNextWindowPos(WindowPos, ImGuiCond_Always, WindowPosPivot);
|
||||
ImGui::SetNextWindowPos(WindowPos, ImGuiCond_Always, FCogImguiHelper::ToImVec2(Config->Alignment));
|
||||
if (Config->UseFixedWidth)
|
||||
{
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(WrapWidth, 0) + WindowPadding * 2, ImVec2(WrapWidth, Config->MaxHeight * ImGui::GetFontSize()) + WindowPadding * 2);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(WrapWidth + WindowPadding.x * 2, 0), ImVec2(WrapWidth + WindowPadding.x * 2, MaxHeight));
|
||||
}
|
||||
|
||||
if (ImGui::Begin(StringCast<ANSICHAR>(*Notification.Id).Get(), nullptr, Flags))
|
||||
@@ -183,8 +178,8 @@ void FCogEngineWindow_Notifications::RenderNotifications()
|
||||
// maybe because the real window size is computed the next frame.
|
||||
//----------------------------------------------------------------------
|
||||
const ImVec2 TextSize = ImGui::CalcTextSize(Message.Get(), nullptr, false, WrapWidth);
|
||||
const float WindowHeight = TextSize.y + (WindowPadding.y * 2);
|
||||
WindowPos.y += (WindowHeight + ItemSpacing.y) * (IsBottom ? -1 : 1);
|
||||
const float WindowHeight = FMath::Min(MaxHeight, TextSize.y + (WindowPadding.y * 2));
|
||||
WindowPos.y += (WindowHeight + ItemSpacing.y) * (Config->Alignment.Y > 0.5f ? -1 : 1);
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@@ -237,19 +232,19 @@ void FCogEngineWindow_Notifications::RenderSettings()
|
||||
FCogWindowWidgets::ThinSeparatorText("Location & Size");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
FCogWindowWidgets::ComboboxEnum("Location", Config->Location);
|
||||
ImGui::SliderFloat2("Alignment", &Config->Alignment.X, 0, 1.0f, "%.2f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::SliderInt2("Padding", &Config->Padding.X, 0, 100);
|
||||
|
||||
ImGui::Checkbox("Use Fixed Width", &Config->UseFixedWidth);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Text Wrapping", &Config->TextWrapping, 1, 0, INT_MAX);
|
||||
ImGui::SliderInt("Text Wrapping", &Config->TextWrapping, 1, 500);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Max Height", &Config->MaxHeight, 1, 0, INT_MAX);
|
||||
ImGui::SliderInt("Max Height", &Config->MaxHeight, 0, 500);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Padding", &Config->Padding, 1, 0, INT_MAX);
|
||||
|
||||
FCogWindowWidgets::ThinSeparatorText("Display");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
#include "CogDebugHelper.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "HAL/PlatformApplicationMisc.h"
|
||||
#include "Math/UnitConversion.h"
|
||||
#include "Misc/StringBuilder.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -53,7 +51,7 @@ void FCogEngineWindow_OutputLog::AddLog(const TCHAR* InMessage, ELogVerbosity::T
|
||||
|
||||
FLogInfo& LogInfo = LogInfos.AddDefaulted_GetRef();
|
||||
LogInfo.Frame = GFrameCounter;
|
||||
LogInfo.Time = Config->UseUTCTime ? FDateTime::UtcNow() : FDateTime::Now();
|
||||
LogInfo.Time = Config != nullptr && Config->UseUTCTime ? FDateTime::UtcNow() : FDateTime::Now();
|
||||
LogInfo.Verbosity = InVerbosity;
|
||||
LogInfo.Category = InCategory;
|
||||
LogInfo.LineStart = TextBuffer.size();
|
||||
@@ -237,12 +235,12 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 9);
|
||||
if (ImGui::BeginCombo("##Verbosity", FCogDebugHelper::VerbosityToString((ELogVerbosity::Type)Config->VerbosityFilter)))
|
||||
if (ImGui::BeginCombo("##Verbosity", FCogDebugHelper::VerbosityToString(static_cast<ELogVerbosity::Type>(Config->VerbosityFilter))))
|
||||
{
|
||||
for (int32 i = ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
for (int32 i = ELogVerbosity::Error; i <= static_cast<int32>(ELogVerbosity::VeryVerbose); ++i)
|
||||
{
|
||||
const bool IsSelected = i == Config->VerbosityFilter;
|
||||
const ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
const ELogVerbosity::Type Verbosity = static_cast<ELogVerbosity::Type>(i);
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
@@ -258,10 +256,10 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
||||
}
|
||||
|
||||
int32 ColumnCount = 1;
|
||||
ColumnCount += (int32)Config->ShowFrame;
|
||||
ColumnCount += (int32)Config->ShowTime;
|
||||
ColumnCount += (int32)Config->ShowCategory;
|
||||
ColumnCount += (int32)Config->ShowVerbosity;
|
||||
ColumnCount += Config->ShowFrame ? 1 : 0;
|
||||
ColumnCount += Config->ShowTime ? 1 : 0;
|
||||
ColumnCount += Config->ShowCategory ? 1 : 0;
|
||||
ColumnCount += Config->ShowVerbosity ? 1 : 0;
|
||||
|
||||
bool IsTableShown = false;
|
||||
if (Config->ShowAsTable)
|
||||
@@ -314,7 +312,7 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
||||
{
|
||||
const FLogInfo& LineInfo = LogInfos[LineIndex];
|
||||
|
||||
if (LineInfo.Verbosity <= (ELogVerbosity::Type)Config->VerbosityFilter)
|
||||
if (LineInfo.Verbosity <= static_cast<ELogVerbosity::Type>(Config->VerbosityFilter))
|
||||
{
|
||||
DrawRow(BufferStart, LineInfo, IsTableShown);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ void FCogEngineWindow_Plots::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
|
||||
Config = GetConfig<UCogEngineConfig_Plots>();
|
||||
|
||||
@@ -48,6 +47,18 @@ void FCogEngineWindow_Plots::RenderTick(float DeltaTime)
|
||||
FCogDebugPlot::IsVisible = GetIsVisible();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::RenderContent()
|
||||
{
|
||||
@@ -714,9 +725,9 @@ void FCogEngineWindow_Plots::RenderEventTooltip(const FCogDebugPlotEvent* Hovere
|
||||
ImGui::Text("Frames");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d [%d-%d]",
|
||||
(int32)(ActualEndFrame - HoveredEvent->StartFrame),
|
||||
(int32)(HoveredEvent->StartFrame % 1000),
|
||||
(int32)(ActualEndFrame % 1000));
|
||||
static_cast<int32>(ActualEndFrame - HoveredEvent->StartFrame),
|
||||
static_cast<int32>(HoveredEvent->StartFrame % 1000),
|
||||
static_cast<int32>(ActualEndFrame % 1000));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -724,7 +735,7 @@ void FCogEngineWindow_Plots::RenderEventTooltip(const FCogDebugPlotEvent* Hovere
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Frame");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", (int32)(HoveredEvent->StartFrame % 1000));
|
||||
ImGui::Text("%d", static_cast<int32>(HoveredEvent->StartFrame % 1000));
|
||||
}
|
||||
|
||||
//------------------------
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "GameFramework/Character.h"
|
||||
#include "HAL/IConsoleManager.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
FString FCogEngineWindow_Selection::ToggleSelectionModeCommand = TEXT("Cog.ToggleSelectionMode");
|
||||
|
||||
@@ -225,8 +225,8 @@ void FCogEngineWindow_Skeleton::RenderBoneEntry(int32 BoneIndex, bool OpenAllChi
|
||||
}
|
||||
FCogWindowWidgets::PopStyleCompact();
|
||||
|
||||
const bool HasCustomVisiblity = BoneInfo.ShowName || BoneInfo.ShowAxes || BoneInfo.ShowLocalVelocity || BoneInfo.ShowTrajectory;
|
||||
if (HasCustomVisiblity)
|
||||
const bool HasCustomVisibility = BoneInfo.ShowName || BoneInfo.ShowAxes || BoneInfo.ShowLocalVelocity || BoneInfo.ShowTrajectory;
|
||||
if (HasCustomVisibility)
|
||||
{
|
||||
BoneInfo.ShowBone = true;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ void FCogEngineWindow_Skeleton::RenderBoneEntry(int32 BoneIndex, bool OpenAllChi
|
||||
// Name
|
||||
//------------------------
|
||||
ImGui::SameLine();
|
||||
ImVec4 NameColor = HasCustomVisiblity ? ImVec4(1.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
ImVec4 NameColor = HasCustomVisibility ? ImVec4(1.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
ImGui::TextColored(NameColor, "%s", BoneName.Get());
|
||||
}
|
||||
|
||||
|
||||
@@ -47,18 +47,19 @@ void FCogEngineWindow_Spawns::RenderContent()
|
||||
return;
|
||||
}
|
||||
|
||||
int32 GroupIndex = 0;
|
||||
for (const FCogEngineSpawnGroup& SpawnGroup : Asset->SpawnGroups)
|
||||
{
|
||||
RenderSpawnGroup(*Replicator, SpawnGroup);
|
||||
RenderSpawnGroup(*Replicator, SpawnGroup, GroupIndex);
|
||||
GroupIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup)
|
||||
void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup, int32 GroupIndex)
|
||||
{
|
||||
if (FCogWindowWidgets::DarkCollapsingHeader(TCHAR_TO_ANSI(*SpawnGroup.Name), ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
int32 GroupIndex = 0;
|
||||
ImGui::PushID(GroupIndex);
|
||||
|
||||
const bool PushColor = (SpawnGroup.Color != FColor::Transparent);
|
||||
@@ -86,7 +87,6 @@ void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator,
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
GroupIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ bool FCogEngineWindow_Spawns::RenderSpawnAsset(ACogEngineReplicator& Replicator,
|
||||
{
|
||||
bool IsPressed = false;
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, IsLastSelected ? ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive) : ImGui::GetStyleColorVec4(ImGuiCol_Button));
|
||||
//ImGui::PushStyleColor(ImGuiCol_Button, IsLastSelected ? ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive) : ImGui::GetStyleColorVec4(ImGuiCol_Button));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
|
||||
|
||||
FString EntryName;
|
||||
@@ -115,7 +115,7 @@ bool FCogEngineWindow_Spawns::RenderSpawnAsset(ACogEngineReplicator& Replicator,
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(1);
|
||||
ImGui::PopStyleColor(1);
|
||||
//ImGui::PopStyleColor(1);
|
||||
|
||||
return IsPressed;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss()
|
||||
const float TotalPacketLost = (OutPacketLost + InPacketLost) / 2;
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, Config->GetPacketLossColor(TotalPacketLost));
|
||||
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%2d%% ###PacketLossButton"), (int32)TotalPacketLost)));
|
||||
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%2d%% ###PacketLossButton"), static_cast<int32>(TotalPacketLost))));
|
||||
const float Width = ImGui::GetItemRectSize().x;
|
||||
ImGui::PopStyleColor(1);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogEngineDataAsset.h"
|
||||
|
||||
class AActor;
|
||||
|
||||
@@ -10,4 +11,5 @@ public:
|
||||
|
||||
static void ActorContextMenu(AActor& Actor);
|
||||
|
||||
static void RenderConfigureMessage(TWeakObjectPtr<const UCogEngineDataAsset> InAsset);
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
FCogEngineSpawnFunction GetSpawnFunction() const { return SpawnFunction; }
|
||||
|
||||
void SetSpawnFunction(FCogEngineSpawnFunction Value) { SpawnFunction = Value; }
|
||||
void SetSpawnFunction(const FCogEngineSpawnFunction& Value) { SpawnFunction = Value; }
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void Server_Spawn(const FCogEngineSpawnEntry& SpawnEntry);
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
UFUNCTION()
|
||||
void OnRep_TimeDilation() const;
|
||||
|
||||
TObjectPtr<APlayerController> OwnerPlayerController;
|
||||
TWeakObjectPtr<APlayerController> OwnerPlayerController;
|
||||
|
||||
uint32 bHasAuthority : 1;
|
||||
uint32 bIsLocal : 1;
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogWindow.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "CogEngineWindow_BuildInfo.generated.h"
|
||||
|
||||
class UCogEngineConfig_BuildInfo;
|
||||
|
||||
class COGENGINE_API FCogEngineWindow_BuildInfo : public FCogWindow
|
||||
{
|
||||
typedef FCogWindow Super;
|
||||
|
||||
public:
|
||||
|
||||
virtual void Initialize() override;
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
protected:
|
||||
|
||||
void BuildText();
|
||||
|
||||
TWeakObjectPtr<UCogEngineConfig_BuildInfo> Config;
|
||||
|
||||
FString Text;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCLASS(Config = Cog)
|
||||
class UCogEngineConfig_BuildInfo : public UCogCommonConfig
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowInEditor = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowInPackage = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowBranchName = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowBuildDate = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowCurrentChangelist = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowCompatibleChangelist = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowBuildConfiguration = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowBuildUser = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowBuildMachine = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowBuildTargetType = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool ShowInForeground = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
FVector2f Alignment = { 0, 1 };
|
||||
|
||||
UPROPERTY(Config)
|
||||
FIntVector2 Padding = { 10, 10 };
|
||||
|
||||
UPROPERTY(Config)
|
||||
int32 Rounding = 6;
|
||||
|
||||
UPROPERTY(Config)
|
||||
FColor BackgroundColor = FColor(0, 0, 0, 80);
|
||||
|
||||
UPROPERTY(Config)
|
||||
FColor BorderColor = FColor(255, 255, 255, 50);
|
||||
|
||||
UPROPERTY(Config)
|
||||
FColor TextColor = FColor(255, 255, 255, 100);
|
||||
|
||||
virtual void Reset() override
|
||||
{
|
||||
Super::Reset();
|
||||
|
||||
ShowInEditor = false;
|
||||
ShowInPackage = true;
|
||||
ShowInForeground = true;
|
||||
ShowBranchName = false;
|
||||
ShowBuildDate = true;
|
||||
ShowCurrentChangelist = true;
|
||||
ShowCompatibleChangelist = false;
|
||||
ShowBuildConfiguration = true;
|
||||
ShowBuildUser = false;
|
||||
ShowBuildMachine = false;
|
||||
ShowBuildTargetType = true;
|
||||
Alignment = { 0, 1 };
|
||||
Padding = { 10, 10 };
|
||||
Rounding = 6;
|
||||
BackgroundColor = FColor(0, 0, 0, 80);
|
||||
BorderColor = FColor(255, 255, 255, 50);
|
||||
TextColor = FColor(255, 255, 255, 100);
|
||||
}
|
||||
};
|
||||
@@ -35,11 +35,12 @@ protected:
|
||||
FColor Color;
|
||||
};
|
||||
|
||||
FChannel Channels[ECC_MAX];
|
||||
|
||||
TObjectPtr<UCogEngineConfig_CollisionTester> Config = nullptr;
|
||||
|
||||
FChannel Channels[ECC_MAX] = {};
|
||||
|
||||
FCogDebug_Gizmo StartGizmo;
|
||||
|
||||
FCogDebug_Gizmo EndGizmo;
|
||||
};
|
||||
|
||||
@@ -90,11 +91,6 @@ public:
|
||||
UPROPERTY(Config)
|
||||
FVector ShapeExtent;
|
||||
|
||||
UCogEngineConfig_CollisionTester()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
virtual void Reset() override
|
||||
{
|
||||
Super::Reset();
|
||||
|
||||
@@ -17,7 +17,9 @@ protected:
|
||||
|
||||
virtual void Initialize() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
virtual void PreBegin(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void PostBegin() override;
|
||||
|
||||
virtual void RenderMainMenuWidget() override;
|
||||
|
||||
@@ -115,12 +117,6 @@ public:
|
||||
UPROPERTY(Config)
|
||||
FVector4f HistoryColor = FVector4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
|
||||
UCogEngineConfig_Console()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
virtual void Reset() override
|
||||
{
|
||||
Super::Reset();
|
||||
|
||||
@@ -7,8 +7,6 @@ class COGENGINE_API FCogEngineWindow_ImGui : public FCogWindow
|
||||
{
|
||||
typedef FCogWindow Super;
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
@@ -44,7 +44,7 @@ protected:
|
||||
|
||||
virtual bool RenderPropertyList(TArray<const FProperty*>& Properties, uint8* PointerToValue);
|
||||
|
||||
virtual bool RenderProperty(const FProperty* Property, uint8* PointerToValue, int IndexInArray);
|
||||
virtual bool RenderProperty(const FProperty* Property, uint8* PointerToValue, int IndexInArray, const char* NameSuffix = nullptr);
|
||||
|
||||
virtual bool RenderBool(const FBoolProperty* BoolProperty, uint8* PointerToValue);
|
||||
|
||||
@@ -79,12 +79,16 @@ protected:
|
||||
virtual bool RenderObject(UObject* Object, bool ShowChildren);
|
||||
|
||||
virtual bool RenderArray(const FArrayProperty* ArrayProperty, uint8* PointerToValue, bool ShowChildren);
|
||||
|
||||
virtual bool RenderSet(const FSetProperty* SetProperty, uint8* PointerToValue, bool ShowChildren);
|
||||
|
||||
virtual bool RenderMap(const FMapProperty* MapProperty, uint8* PointerToValue, bool ShowChildren);
|
||||
|
||||
virtual FString GetPropertyName(const FProperty& Property);
|
||||
|
||||
FCogEngineInspectorApplyFunction FindObjectApplyFunction(const UObject* Object) const;
|
||||
|
||||
struct Favorite
|
||||
struct FFavorite
|
||||
{
|
||||
TWeakObjectPtr<UObject> Object = nullptr;
|
||||
|
||||
@@ -99,7 +103,7 @@ protected:
|
||||
|
||||
bool bCollapseAllCategories = false;
|
||||
|
||||
TArray<Favorite> Favorites;
|
||||
TArray<FFavorite> Favorites;
|
||||
|
||||
TArray<TWeakObjectPtr<UObject>> History;
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ protected:
|
||||
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
void ConnectTo();
|
||||
void ConnectTo() const;
|
||||
|
||||
void ConnectFrom();
|
||||
void ConnectFrom() const;
|
||||
|
||||
void Disconnect();
|
||||
void Disconnect() const;
|
||||
|
||||
void RunServer();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogCommonConfig.h"
|
||||
#include "CogWindow.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui.h"
|
||||
#include "Misc/OutputDevice.h"
|
||||
#include "CogEngineWindow_Notifications.generated.h"
|
||||
@@ -23,16 +24,6 @@ public:
|
||||
FCogEngineWindow_Notifications* Notifications = nullptr;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UENUM()
|
||||
enum class ECogEngineNotificationLocation : uint8
|
||||
{
|
||||
TopLeft = 0,
|
||||
TopRight = 1,
|
||||
BottomLeft = 2,
|
||||
BottomRight = 3,
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
class COGENGINE_API FCogEngineWindow_Notifications : public FCogWindow
|
||||
{
|
||||
@@ -126,19 +117,19 @@ public:
|
||||
FColor TextErrorColor = FColor::White;
|
||||
|
||||
UPROPERTY(Config)
|
||||
ECogEngineNotificationLocation Location = ECogEngineNotificationLocation::BottomRight;
|
||||
FVector2f Alignment = FVector2f(1.0f, 1.0f);
|
||||
|
||||
UPROPERTY(Config)
|
||||
int Padding = 10;
|
||||
FIntVector2 Padding = FIntVector2(10, 10);
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool UseFixedWidth = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int32 MaxHeight = 10;
|
||||
int32 MaxHeight = 100;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int32 TextWrapping = 20;
|
||||
int32 TextWrapping = 200;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int32 Rounding = 6;
|
||||
@@ -166,11 +157,11 @@ public:
|
||||
BorderWarningColor = FColor(255, 200, 0, 100);
|
||||
BorderErrorColor = FColor(240, 77, 77, 100);
|
||||
|
||||
Location = ECogEngineNotificationLocation::BottomRight;
|
||||
Padding = 10;
|
||||
Alignment = { 1, 1 };
|
||||
Padding = { 10, 10 };
|
||||
UseFixedWidth = true;
|
||||
TextWrapping = 20;
|
||||
MaxHeight = 10;
|
||||
TextWrapping = 200;
|
||||
MaxHeight = 100;
|
||||
Rounding = 6;
|
||||
ShowBorder = true;
|
||||
Duration = 5.0f;
|
||||
|
||||
@@ -28,6 +28,10 @@ protected:
|
||||
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
virtual void PreBegin(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void PostBegin() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void RenderAllEntriesNames(const ImVec2& InSize);
|
||||
|
||||
@@ -18,11 +18,11 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp();
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup);
|
||||
virtual void RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup, int32 GroupIndex);
|
||||
|
||||
virtual bool RenderSpawnAsset(ACogEngineReplicator& Replicator, const FCogEngineSpawnEntry& SpawnEntry, bool IsLastSelected);
|
||||
|
||||
|
||||
@@ -22,17 +22,17 @@ protected:
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
bool RenderComponent(const char* Label, double* Value, float Speed, double Min, double Max, double Reset);
|
||||
virtual bool RenderComponent(const char* Label, double* Value, float Speed, double Min, double Max, double Reset);
|
||||
|
||||
void RenderSnap(const char* CheckboxLabel, const char* InputLabel, bool* SnapEnable, float* Snap);
|
||||
virtual void RenderSnap(const char* CheckboxLabel, const char* InputLabel, bool* SnapEnable, float* Snap);
|
||||
|
||||
bool RenderLocation(FTransform& InOutTransform);
|
||||
virtual bool RenderLocation(FTransform& InOutTransform);
|
||||
|
||||
bool RenderRotation(FTransform& InOutTransform);
|
||||
virtual bool RenderRotation(FTransform& InOutTransform);
|
||||
|
||||
bool RenderScale(FTransform& InOutTransform);
|
||||
virtual bool RenderScale(FTransform& InOutTransform);
|
||||
|
||||
bool RenderTransform(FTransform& InOutTransform);
|
||||
virtual bool RenderTransform(FTransform& InOutTransform);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ReSharper disable CppUnusedIncludeDirective
|
||||
#include "CogImguiConfig.h"
|
||||
|
||||
THIRD_PARTY_INCLUDES_START
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "Framework/Application/SlateApplication.h"
|
||||
#include "Framework/Application/SlateUser.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "GameFramework/PlayerInput.h"
|
||||
#include "HAL/PlatformApplicationMisc.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
@@ -24,10 +23,8 @@
|
||||
#include "Widgets/SViewport.h"
|
||||
#include "Widgets/SWindow.h"
|
||||
|
||||
static UPlayerInput* GetPlayerInput(const UWorld* World);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FCogImGuiContextScope::FCogImGuiContextScope(FCogImguiContext& CogImguiContext)
|
||||
FCogImGuiContextScope::FCogImGuiContextScope(const FCogImguiContext& CogImguiContext)
|
||||
{
|
||||
PrevContext = ImGui::GetCurrentContext();
|
||||
PrevPlotContext = ImPlot::GetCurrentContext();
|
||||
@@ -244,7 +241,7 @@ bool FCogImguiContext::BeginFrame(float InDeltaTime)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
// Skip the first frame, to let the main widget update its TickSpaceGeometry which is returned by the
|
||||
// plateform callback ImGui_GetWindowPos. When using viewports Imgui needs to know the main viewport
|
||||
// platform callback ImGui_GetWindowPos. When using viewports Imgui needs to know the main viewport
|
||||
// absolute position to correctly place the initial imgui windows.
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
if (bIsFirstFrame)
|
||||
@@ -367,7 +364,7 @@ bool FCogImguiContext::BeginFrame(float InDeltaTime)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec2 FCogImguiContext::GetImguiMousePos()
|
||||
ImVec2 FCogImguiContext::GetImguiMousePos() const
|
||||
{
|
||||
const FVector2D& MousePosition = FSlateApplication::Get().GetCursorPos();
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
@@ -686,41 +683,18 @@ void FCogImguiContext::ImGui_SetClipboardTextFn(ImGuiContext* InImGuiContext, co
|
||||
static APlayerController* GetLocalPlayerController(const UWorld* World)
|
||||
{
|
||||
if (World == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
{ return nullptr; }
|
||||
|
||||
APlayerController* PlayerController = nullptr;
|
||||
for (FConstPlayerControllerIterator Iterator = World->GetPlayerControllerIterator(); Iterator; ++Iterator)
|
||||
{
|
||||
APlayerController* ItPlayerController = Iterator->Get();
|
||||
if (ItPlayerController->IsLocalController())
|
||||
{
|
||||
return ItPlayerController;
|
||||
}
|
||||
{ return ItPlayerController; }
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
static UPlayerInput* GetPlayerInput(const UWorld* World)
|
||||
{
|
||||
if (World == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
APlayerController* PlayerController = GetLocalPlayerController(World);
|
||||
if (PlayerController == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UPlayerInput* PlayerInput = PlayerController->PlayerInput;
|
||||
return PlayerInput;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogImguiContext::SetEnableInput(bool Value)
|
||||
{
|
||||
@@ -891,7 +865,7 @@ bool FCogImguiContext::IsConsoleOpened() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogImguiContext::DrawDebug()
|
||||
void FCogImguiContext::DrawDebug() const
|
||||
{
|
||||
if (ImGui::Begin("ImGui Integration Debug"))
|
||||
{
|
||||
|
||||
@@ -56,10 +56,10 @@ FColor FCogImguiHelper::ToFColor(ImU32 Color)
|
||||
{
|
||||
return FColor
|
||||
{
|
||||
(uint8)((Color >> IM_COL32_R_SHIFT) & 0xFF),
|
||||
(uint8)((Color >> IM_COL32_G_SHIFT) & 0xFF),
|
||||
(uint8)((Color >> IM_COL32_B_SHIFT) & 0xFF),
|
||||
(uint8)((Color >> IM_COL32_A_SHIFT) & 0xFF)
|
||||
static_cast<uint8>((Color >> IM_COL32_R_SHIFT) & 0xFF),
|
||||
static_cast<uint8>((Color >> IM_COL32_G_SHIFT) & 0xFF),
|
||||
static_cast<uint8>((Color >> IM_COL32_B_SHIFT) & 0xFF),
|
||||
static_cast<uint8>((Color >> IM_COL32_A_SHIFT) & 0xFF)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,6 +87,17 @@ ImVec2 FCogImguiHelper::ToImVec2(const FVector2D& Value)
|
||||
return ImVec2(Value.X, Value.Y);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec2 FCogImguiHelper::ToImVec2(const FIntVector2& Value)
|
||||
{
|
||||
return ImVec2(Value.X, Value.Y);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec2 FCogImguiHelper::ToImVec2(const FVector2f& Value)
|
||||
{
|
||||
return ImVec2(Value.X, Value.Y);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImColor FCogImguiHelper::ToImColor(const FColor& Value)
|
||||
{
|
||||
@@ -118,11 +129,16 @@ ImVec4 FCogImguiHelper::ToImVec4(const FVector4f& Value)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImU32 FCogImguiHelper::ToImU32(const FColor& Value)
|
||||
ImU32 FCogImguiHelper::ToImU32(const FLinearColor& Value)
|
||||
{
|
||||
return (ImU32)ToImColor(Value);
|
||||
return ToImColor(Value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImU32 FCogImguiHelper::ToImU32(const FColor& Value)
|
||||
{
|
||||
return ToImColor(Value);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImU32 FCogImguiHelper::ToImU32(const FVector4f& Value)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CogImguiInputCatcherWidget.h"
|
||||
|
||||
#include "CogImguiContext.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "Engine/GameViewportClient.h"
|
||||
#include "imgui.h"
|
||||
@@ -17,11 +18,6 @@ void SCogImguiInputCatcherWidget::Construct(const FArguments& InArgs)
|
||||
}
|
||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
SCogImguiInputCatcherWidget::~SCogImguiInputCatcherWidget()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void SCogImguiInputCatcherWidget::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
|
||||
{
|
||||
@@ -91,7 +87,7 @@ FReply SCogImguiInputCatcherWidget::OnMouseButtonUp(const FGeometry& MyGeometry,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FReply SCogImguiInputCatcherWidget::HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down)
|
||||
FReply SCogImguiInputCatcherWidget::HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down) const
|
||||
{
|
||||
FCogImGuiContextScope ImGuiContextScope(*Context);
|
||||
|
||||
@@ -132,19 +128,19 @@ FReply SCogImguiInputCatcherWidget::OnMouseMove(const FGeometry& MyGeometry, con
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void SCogImguiInputCatcherWidget::RefreshVisibility()
|
||||
{
|
||||
EVisibility DesiredVisiblity = EVisibility::SelfHitTestInvisible;
|
||||
EVisibility DesiredVisibility;
|
||||
|
||||
if (Context->GetEnableInput() && Context->GetShareMouseWithGameplay() == false)
|
||||
{
|
||||
DesiredVisiblity = EVisibility::Visible;
|
||||
DesiredVisibility = EVisibility::Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
DesiredVisiblity = EVisibility::SelfHitTestInvisible;
|
||||
DesiredVisibility = EVisibility::SelfHitTestInvisible;
|
||||
}
|
||||
|
||||
if (DesiredVisiblity != GetVisibility())
|
||||
if (DesiredVisibility != GetVisibility())
|
||||
{
|
||||
SetVisibility(DesiredVisiblity);
|
||||
SetVisibility(DesiredVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "CogImguiInputHelper.h"
|
||||
|
||||
#include <ThirdParty/SPIRV-Reflect/SPIRV-Reflect/spirv_reflect.h>
|
||||
|
||||
#include "CogImguiKeyInfo.h"
|
||||
#include "Engine/World.h"
|
||||
#include "Framework/Application/SlateApplication.h"
|
||||
@@ -50,14 +48,14 @@ UPlayerInput* FCogImguiInputHelper::GetPlayerInput(const UWorld& World)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogImguiInputHelper::IsTopPriorityKey(UWorld* InWorld, const FKey& InKey)
|
||||
bool FCogImguiInputHelper::IsTopPriorityKey(const UWorld* InWorld, const FKey& InKey)
|
||||
{
|
||||
FKeyEvent KeyEvent(InKey, FModifierKeysState(), 0, false, 0, 0);
|
||||
return IsTopPriorityKeyEvent(InWorld, KeyEvent);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogImguiInputHelper::IsTopPriorityKeyEvent(UWorld* InWorld, const FKeyEvent& InKeyEvent)
|
||||
bool FCogImguiInputHelper::IsTopPriorityKeyEvent(const UWorld* InWorld, const FKeyEvent& InKeyEvent)
|
||||
{
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// We want the user to be able to use Cog shortcuts when imgui has the input.
|
||||
@@ -202,7 +200,7 @@ bool FCogImguiInputHelper::IsKeyBindMatchingKeyInfo(const FKeyBind& InKeyBind, c
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogImguiInputHelper::WasKeyInfoJustPressed(APlayerController& PlayerController, const FCogImGuiKeyInfo& KeyInfo)
|
||||
bool FCogImguiInputHelper::WasKeyInfoJustPressed(const APlayerController& PlayerController, const FCogImGuiKeyInfo& KeyInfo)
|
||||
{
|
||||
if (PlayerController.WasInputKeyJustPressed(KeyInfo.Key))
|
||||
{
|
||||
@@ -221,7 +219,7 @@ bool FCogImguiInputHelper::WasKeyInfoJustPressed(APlayerController& PlayerContro
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogImguiInputHelper::IsKeyBoundToCommand(UWorld* World, const FKeyEvent& KeyEvent)
|
||||
bool FCogImguiInputHelper::IsKeyBoundToCommand(const UWorld* World, const FKeyEvent& KeyEvent)
|
||||
{
|
||||
if (World == nullptr)
|
||||
{
|
||||
@@ -452,7 +450,7 @@ bool FCogImguiInputHelper::IsKeyBoundToCommand(const UPlayerInput* InPlayerInput
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogImguiInputHelper::IsMouseInsideMainViewport()
|
||||
{
|
||||
if (ImGuiViewportP* Viewport = (ImGuiViewportP*)ImGui::GetMainViewport())
|
||||
if (ImGuiViewportP* Viewport = static_cast<ImGuiViewportP*>(ImGui::GetMainViewport()))
|
||||
{
|
||||
ImGuiIO& IO = ImGui::GetIO();
|
||||
const bool Result = Viewport->GetMainRect().Contains(IO.MousePos);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CogImguiWidget.h"
|
||||
|
||||
#include "CogImguiContext.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "Engine/GameViewportClient.h"
|
||||
#include "imgui.h"
|
||||
@@ -17,11 +18,6 @@ void SCogImguiWidget::Construct(const FArguments& InArgs)
|
||||
}
|
||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
SCogImguiWidget::~SCogImguiWidget()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void SCogImguiWidget::SetDrawData(const ImDrawData* InDrawData)
|
||||
{
|
||||
@@ -143,7 +139,7 @@ FReply SCogImguiWidget::OnKeyUp(const FGeometry& MyGeometry, const FKeyEvent& Ke
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FReply SCogImguiWidget::HandleKeyEvent(const FKeyEvent& KeyEvent, bool Down)
|
||||
FReply SCogImguiWidget::HandleKeyEvent(const FKeyEvent& KeyEvent, bool Down) const
|
||||
{
|
||||
FCogImGuiContextScope ImGuiContextScope(*Context);
|
||||
|
||||
@@ -212,7 +208,7 @@ FReply SCogImguiWidget::OnMouseButtonUp(const FGeometry& MyGeometry, const FPoin
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FReply SCogImguiWidget::HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down)
|
||||
FReply SCogImguiWidget::HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down) const
|
||||
{
|
||||
FCogImGuiContextScope ImGuiContextScope(*Context);
|
||||
|
||||
@@ -278,26 +274,26 @@ FReply SCogImguiWidget::OnFocusReceived(const FGeometry& MyGeometry, const FFocu
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void SCogImguiWidget::RefreshVisibility()
|
||||
{
|
||||
EVisibility DesiredVisiblity = EVisibility::SelfHitTestInvisible;
|
||||
EVisibility DesiredVisibility;
|
||||
|
||||
if (Context->GetEnableInput())
|
||||
{
|
||||
if (Context->GetShareMouse() && Context->GetWantCaptureMouse() == false)
|
||||
{
|
||||
DesiredVisiblity = EVisibility::SelfHitTestInvisible;
|
||||
DesiredVisibility = EVisibility::SelfHitTestInvisible;
|
||||
}
|
||||
else
|
||||
{
|
||||
DesiredVisiblity = EVisibility::Visible;
|
||||
DesiredVisibility = EVisibility::Visible;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DesiredVisiblity = EVisibility::SelfHitTestInvisible;
|
||||
DesiredVisibility = EVisibility::SelfHitTestInvisible;
|
||||
}
|
||||
|
||||
if (DesiredVisiblity != GetVisibility())
|
||||
if (DesiredVisibility != GetVisibility())
|
||||
{
|
||||
SetVisibility(DesiredVisiblity);
|
||||
SetVisibility(DesiredVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ struct COGIMGUI_API FCogImGuiViewportData
|
||||
|
||||
struct COGIMGUI_API FCogImGuiContextScope
|
||||
{
|
||||
UE_NODISCARD_CTOR explicit FCogImGuiContextScope(FCogImguiContext& CogImguiContext);
|
||||
UE_NODISCARD_CTOR explicit FCogImGuiContextScope(const FCogImguiContext& CogImguiContext);
|
||||
UE_NODISCARD_CTOR explicit FCogImGuiContextScope(ImGuiContext* GuiCtx, ImPlotContext* PlotCtx);
|
||||
~FCogImGuiContextScope();
|
||||
|
||||
@@ -65,8 +65,6 @@ public:
|
||||
|
||||
bool BeginFrame(float InDeltaTime);
|
||||
|
||||
void GetCursorPos(ImGuiIO& IO);
|
||||
|
||||
void EndFrame();
|
||||
|
||||
float GetDpiScale() const { return DpiScale; }
|
||||
@@ -77,7 +75,7 @@ public:
|
||||
|
||||
void SetSkipRendering(bool Value);
|
||||
|
||||
ImVec2 GetImguiMousePos();
|
||||
ImVec2 GetImguiMousePos() const;
|
||||
|
||||
TObjectPtr<const UGameViewportClient> GetGameViewport() const { return GameViewport; }
|
||||
|
||||
@@ -93,7 +91,7 @@ private:
|
||||
|
||||
bool IsConsoleOpened() const;
|
||||
|
||||
void DrawDebug();
|
||||
void DrawDebug() const;
|
||||
|
||||
void BuildFont();
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "imgui.h"
|
||||
#include "Rendering/RenderingCommon.h"
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ public:
|
||||
|
||||
static ImVec2 ToImVec2(const FVector2D& Value);
|
||||
|
||||
static ImVec2 ToImVec2(const FIntVector2& Value);
|
||||
|
||||
static ImVec2 ToImVec2(const FVector2f& Value);
|
||||
|
||||
static ImColor ToImColor(const FColor& Value);
|
||||
|
||||
static ImColor ToImColor(const FLinearColor& Value);
|
||||
@@ -46,6 +50,8 @@ public:
|
||||
|
||||
static ImVec4 ToImVec4(const FVector4f& Value);
|
||||
|
||||
static ImU32 ToImU32(const FLinearColor& Value);
|
||||
|
||||
static ImU32 ToImU32(const FColor& Value);
|
||||
|
||||
static ImU32 ToImU32(const FVector4f& Value);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogImguiDrawList.h"
|
||||
#include "Rendering/RenderingCommon.h"
|
||||
#include "UObject/WeakObjectPtr.h"
|
||||
#include "Widgets/DeclarativeSyntaxSupport.h"
|
||||
@@ -24,8 +23,6 @@ public:
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
~SCogImguiInputCatcherWidget();
|
||||
|
||||
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
|
||||
|
||||
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& WidgetStyle, bool bParentEnabled) const override;
|
||||
@@ -58,9 +55,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
FReply HandleKeyEvent(const FKeyEvent& KeyEvent, bool Down);
|
||||
|
||||
FReply HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down);
|
||||
FReply HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down) const;
|
||||
|
||||
void RefreshVisibility();
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ public:
|
||||
|
||||
static UPlayerInput* GetPlayerInput(const UWorld& World);
|
||||
|
||||
static bool IsTopPriorityKey(UWorld* InWorld, const FKey& InKey);
|
||||
static bool IsTopPriorityKey(const UWorld* InWorld, const FKey& InKey);
|
||||
|
||||
static bool IsTopPriorityKeyEvent(UWorld* InWorld, const FKeyEvent& InKeyEvent);
|
||||
static bool IsTopPriorityKeyEvent(const UWorld* InWorld, const FKeyEvent& InKeyEvent);
|
||||
|
||||
static bool WasKeyInfoJustPressed(APlayerController& PlayerController, const FCogImGuiKeyInfo& KeyInfo);
|
||||
static bool WasKeyInfoJustPressed(const APlayerController& PlayerController, const FCogImGuiKeyInfo& KeyInfo);
|
||||
|
||||
static bool IsCheckBoxStateMatchingValue(ECheckBoxState CheckBoxState, bool bValue);
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
static bool IsConsoleEvent(const FKeyEvent& KeyEvent);
|
||||
|
||||
static bool IsKeyBoundToCommand(UWorld* World, const FKeyEvent& KeyEvent);
|
||||
static bool IsKeyBoundToCommand(const UWorld* World, const FKeyEvent& KeyEvent);
|
||||
|
||||
static bool IsStopPlaySessionEvent(const FKeyEvent& KeyEvent);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class COGIMGUI_API FCogImguiModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
static inline FCogImguiModule& Get()
|
||||
static FCogImguiModule& Get()
|
||||
{
|
||||
return FModuleManager::LoadModuleChecked<FCogImguiModule>("CogImgui");
|
||||
}
|
||||
@@ -18,6 +18,4 @@ public:
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@@ -24,8 +24,6 @@ public:
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
~SCogImguiWidget();
|
||||
|
||||
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
|
||||
|
||||
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& WidgetStyle, bool bParentEnabled) const override;
|
||||
@@ -58,13 +56,13 @@ public:
|
||||
|
||||
TSharedPtr<const SWindow> GetWindow() const { return Window; }
|
||||
|
||||
void SetWindow(TSharedPtr<SWindow> Value) { Window = Value; }
|
||||
void SetWindow(const TSharedPtr<SWindow>& Value) { Window = Value; }
|
||||
|
||||
protected:
|
||||
|
||||
FReply HandleKeyEvent(const FKeyEvent& KeyEvent, bool Down);
|
||||
FReply HandleKeyEvent(const FKeyEvent& KeyEvent, bool Down) const;
|
||||
|
||||
FReply HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down);
|
||||
FReply HandleMouseButtonEvent(const FPointerEvent& MouseEvent, bool Down) const;
|
||||
|
||||
void RefreshVisibility();
|
||||
|
||||
|
||||
@@ -59,6 +59,12 @@ bool FCogWindow::CheckEditorVisibility()
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow::RenderContextMenu()
|
||||
{
|
||||
RenderSettings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow::RenderSettings()
|
||||
{
|
||||
if (bHasMenu)
|
||||
{
|
||||
@@ -75,46 +81,32 @@ void FCogWindow::RenderContextMenu()
|
||||
void FCogWindow::Render(float DeltaTime)
|
||||
{
|
||||
ImGuiWindowFlags WindowFlags = 0;
|
||||
PreRender(WindowFlags);
|
||||
|
||||
const FString WindowTitle = GetTitle() + "##" + Name;
|
||||
|
||||
if (bHasMenu && bShowMenu)
|
||||
{
|
||||
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
||||
}
|
||||
|
||||
if (bNoPadding)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
PreBegin(WindowFlags);
|
||||
|
||||
if (ImGui::Begin(TCHAR_TO_ANSI(*WindowTitle), &bIsVisible, WindowFlags))
|
||||
const FString WindowTitle = GetTitle() + "##" + Name;
|
||||
const bool IsOpen = ImGui::Begin(StringCast<ANSICHAR>(*WindowTitle).Get(), &bIsVisible, WindowFlags);
|
||||
|
||||
PostBegin();
|
||||
|
||||
if (IsOpen)
|
||||
{
|
||||
if (bNoPadding)
|
||||
{
|
||||
ImGui::PopStyleVar(1);
|
||||
}
|
||||
RenderContent();
|
||||
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
RenderContextMenu();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
RenderContent();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bNoPadding)
|
||||
{
|
||||
ImGui::PopStyleVar(1);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
PostRender();
|
||||
|
||||
PostEnd();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -223,7 +215,7 @@ void FCogWindow::ResetConfig()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
const UObject* FCogWindow::GetAsset(const TSubclassOf<UObject> AssetClass) const
|
||||
const UObject* FCogWindow::GetAsset(const TSubclassOf<UObject>& AssetClass) const
|
||||
{
|
||||
return GetOwner()->GetAsset(AssetClass);
|
||||
}
|
||||
@@ -240,3 +232,9 @@ bool FCogWindow::IsWindowRenderedInMainMenu()
|
||||
return Owner->IsRenderingMainMenu();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
float FCogWindow::GetDpiScale() const
|
||||
{
|
||||
return GetOwner()->GetContext().GetDpiScale();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "imgui.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
const UObject* FCogWindowHelper::GetFirstAssetByClass(const TSubclassOf<UObject> AssetClass)
|
||||
const UObject* FCogWindowHelper::GetFirstAssetByClass(const TSubclassOf<UObject>& AssetClass)
|
||||
{
|
||||
const IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")).Get();
|
||||
|
||||
|
||||
@@ -368,8 +368,6 @@ UCogWindowManager::FMenu* UCogWindowManager::AddMenu(const FString& Name)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::RenderMainMenu()
|
||||
{
|
||||
const UPlayerInput* PlayerInput = FCogImguiInputHelper::GetPlayerInput(*GetWorld());
|
||||
|
||||
IsRenderingInMainMenu = true;
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
@@ -623,7 +621,7 @@ void UCogWindowManager::SettingsHandler_ClearAll(ImGuiContext* Context, ImGuiSet
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::SettingsHandler_ApplyAll(ImGuiContext* Context, ImGuiSettingsHandler* Handler)
|
||||
{
|
||||
UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||
UCogWindowManager* Manager = static_cast<UCogWindowManager*>(Handler->UserData);
|
||||
|
||||
Manager->Widgets.Sort([](const FCogWindow& Window1, const FCogWindow& Window2)
|
||||
{
|
||||
@@ -636,15 +634,15 @@ void* UCogWindowManager::SettingsHandler_ReadOpen(ImGuiContext* Context, ImGuiSe
|
||||
{
|
||||
if (strcmp(Name, "Windows") == 0)
|
||||
{
|
||||
return (void*)1;
|
||||
return reinterpret_cast<void*>(1);
|
||||
}
|
||||
|
||||
if (strcmp(Name, "Widgets") == 0)
|
||||
{
|
||||
UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||
UCogWindowManager* Manager = static_cast<UCogWindowManager*>(Handler->UserData);
|
||||
Manager->WidgetsOrderIndex = 0;
|
||||
|
||||
return (void*)2;
|
||||
return reinterpret_cast<void*>(2);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -656,7 +654,7 @@ void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSet
|
||||
//-----------------------------------------------------------------------------------
|
||||
// Load the visibility of windows.
|
||||
//-----------------------------------------------------------------------------------
|
||||
if (Entry == (void*)1)
|
||||
if (Entry == reinterpret_cast<void*>(1))
|
||||
{
|
||||
ImGuiID Id;
|
||||
int32 ShowMenu;
|
||||
@@ -666,7 +664,7 @@ void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSet
|
||||
if (sscanf(Line, "0x%08X", &Id) == 1)
|
||||
#endif
|
||||
{
|
||||
UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||
UCogWindowManager* Manager = static_cast<UCogWindowManager*>(Handler->UserData);
|
||||
if (FCogWindow* Window = Manager->FindWindowByID(Id))
|
||||
{
|
||||
Window->SetIsVisible(true);
|
||||
@@ -677,7 +675,7 @@ void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSet
|
||||
//-----------------------------------------------------------------------------------
|
||||
// Load which widgets are present in the main menu bar and with what order.
|
||||
//-----------------------------------------------------------------------------------
|
||||
else if (Entry == (void*)2)
|
||||
else if (Entry == reinterpret_cast<void*>(2))
|
||||
{
|
||||
ImGuiID Id;
|
||||
int32 Visible = false;
|
||||
@@ -687,7 +685,7 @@ void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSet
|
||||
if (sscanf(Line, "0x%08X %d", &Id, &Visible) == 2)
|
||||
#endif
|
||||
{
|
||||
UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||
UCogWindowManager* Manager = static_cast<UCogWindowManager*>(Handler->UserData);
|
||||
if (FCogWindow* Window = Manager->FindWindowByID(Id))
|
||||
{
|
||||
Window->SetWidgetOrderIndex(Manager->WidgetsOrderIndex);
|
||||
@@ -702,7 +700,7 @@ void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSet
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::SettingsHandler_WriteAll(ImGuiContext* Context, ImGuiSettingsHandler* Handler, ImGuiTextBuffer* Buffer)
|
||||
{
|
||||
const UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||
const UCogWindowManager* Manager = static_cast<UCogWindowManager*>(Handler->UserData);
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
// Save the visibility of windows. Example:
|
||||
@@ -715,7 +713,7 @@ void UCogWindowManager::SettingsHandler_WriteAll(ImGuiContext* Context, ImGuiSet
|
||||
{
|
||||
if (Window->GetIsVisible())
|
||||
{
|
||||
Buffer->appendf("0x%08X %d\n", Window->GetID(), (int32)Window->bShowMenu);
|
||||
Buffer->appendf("0x%08X %d\n", Window->GetID(), static_cast<int32>(Window->bShowMenu));
|
||||
}
|
||||
}
|
||||
Buffer->append("\n");
|
||||
|
||||
@@ -129,7 +129,6 @@ void FCogWindowWidgets::ProgressBarCentered(float Fraction, const ImVec2& Size,
|
||||
Fraction = ImSaturate(Fraction);
|
||||
ImGui::RenderFrame(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
||||
bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize));
|
||||
const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, Fraction), bb.Max.y);
|
||||
ImGui::RenderRectFilledRangeH(window->DrawList, bb, ImGui::GetColorU32(ImGuiCol_PlotHistogram), 0.0f, Fraction, style.FrameRounding);
|
||||
|
||||
// Default displaying the fraction as percentage string, but user can override it
|
||||
@@ -140,7 +139,7 @@ void FCogWindowWidgets::ProgressBarCentered(float Fraction, const ImVec2& Size,
|
||||
Overlay = overlay_buf;
|
||||
}
|
||||
|
||||
ImVec2 overlay_size = ImGui::CalcTextSize(Overlay, NULL);
|
||||
ImVec2 overlay_size = ImGui::CalcTextSize(Overlay, nullptr);
|
||||
if (overlay_size.x > 0.0f)
|
||||
{
|
||||
|
||||
@@ -148,17 +147,16 @@ void FCogWindowWidgets::ProgressBarCentered(float Fraction, const ImVec2& Size,
|
||||
ImVec2 pos2(pos1.x + 1, pos1.y + 1);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 255));
|
||||
ImGui::RenderTextClipped(pos2, bb.Max, Overlay, NULL, &overlay_size, ImVec2(0.0f, 0.5f), &bb);
|
||||
ImGui::RenderTextClipped(pos2, bb.Max, Overlay, nullptr, &overlay_size, ImVec2(0.0f, 0.5f), &bb);
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
ImGui::RenderTextClipped(pos1, bb.Max, Overlay, NULL, &overlay_size, ImVec2(0.0f, 0.5f), &bb);
|
||||
ImGui::RenderTextClipped(pos1, bb.Max, Overlay, nullptr, &overlay_size, ImVec2(0.0f, 0.5f), &bb);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogWindowWidgets::ToggleMenuButton(bool* Value, const char* Text, const ImVec4& TrueColor)
|
||||
{
|
||||
bool IsPressed = false;
|
||||
bool IsTrue = *Value;
|
||||
if (IsTrue)
|
||||
{
|
||||
@@ -171,7 +169,7 @@ bool FCogWindowWidgets::ToggleMenuButton(bool* Value, const char* Text, const Im
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
IsPressed = ImGui::Button(Text);
|
||||
bool IsPressed = ImGui::Button(Text);
|
||||
if (IsPressed)
|
||||
{
|
||||
*Value = !*Value;
|
||||
@@ -270,9 +268,9 @@ void FCogWindowWidgets::HelpMarker(const char* Text)
|
||||
void FCogWindowWidgets::PushStyleCompact()
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.WindowPadding.x * 0.60f, (float)(int)(style.WindowPadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(style.FramePadding.x * 0.60f, (float)(int)(style.FramePadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 0.60f, (float)(int)(style.ItemSpacing.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.WindowPadding.x * 0.60f, static_cast<int>(style.WindowPadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(style.FramePadding.x * 0.60f, static_cast<int>(style.FramePadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 0.60f, static_cast<int>(style.ItemSpacing.y * 0.60f)));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -344,7 +342,7 @@ float FCogWindowWidgets::GetFontWidth()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogWindowWidgets::ComboboxEnum(const char* Label, UObject* Object, const char* FieldName, uint8* PointerToEnumValue)
|
||||
bool FCogWindowWidgets::ComboboxEnum(const char* Label, const UObject* Object, const char* FieldName, uint8* PointerToEnumValue)
|
||||
{
|
||||
const FEnumProperty* EnumProperty = CastField<FEnumProperty>(Object->GetClass()->FindPropertyByName(FName(FieldName)));
|
||||
if (EnumProperty == nullptr)
|
||||
@@ -374,7 +372,7 @@ bool FCogWindowWidgets::ComboboxEnum(const char* Label, const FEnumProperty* Enu
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogWindowWidgets::ComboboxEnum(const char* Label, UEnum* Enum, int64 CurrentValue, int64& NewValue)
|
||||
bool FCogWindowWidgets::ComboboxEnum(const char* Label, const UEnum* Enum, int64 CurrentValue, int64& NewValue)
|
||||
{
|
||||
bool HasChanged = false;
|
||||
|
||||
@@ -666,9 +664,9 @@ bool FCogWindowWidgets::MultiChoiceButton(const char* Label, bool IsSelected, co
|
||||
bool FCogWindowWidgets::MultiChoiceButtonsInt(TArray<int32>& InValues, int32& InCurrentValue, const ImVec2& InSize, bool InInline)
|
||||
{
|
||||
ImGuiStyle& Style = ImGui::GetStyle();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, (float)(int)(Style.WindowPadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(Style.FramePadding.x * 0.40f, (float)(int)(Style.FramePadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(Style.ItemSpacing.x * 0.30f, (float)(int)(Style.ItemSpacing.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, static_cast<int>(Style.WindowPadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(Style.FramePadding.x * 0.40f, static_cast<int>(Style.FramePadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(Style.ItemSpacing.x * 0.30f, static_cast<int>(Style.ItemSpacing.y * 0.60f)));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 255, 255, 180));
|
||||
|
||||
bool IsPressed = false;
|
||||
@@ -711,9 +709,9 @@ FString FCogWindowWidgets::FormatSmallFloat(float InValue)
|
||||
bool FCogWindowWidgets::MultiChoiceButtonsFloat(TArray<float>& InValues, float& InValue, const ImVec2& InSize, bool InInline)
|
||||
{
|
||||
ImGuiStyle& Style = ImGui::GetStyle();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, (float)(int)(Style.WindowPadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(Style.FramePadding.x * 0.40f, (float)(int)(Style.FramePadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(Style.ItemSpacing.x * 0.30f, (float)(int)(Style.ItemSpacing.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, static_cast<int>(Style.WindowPadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(Style.FramePadding.x * 0.40f, static_cast<int>(Style.FramePadding.y * 0.60f)));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(Style.ItemSpacing.x * 0.30f, static_cast<int>(Style.ItemSpacing.y * 0.60f)));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 255, 255, 180));
|
||||
|
||||
bool IsPressed = false;
|
||||
@@ -759,7 +757,7 @@ bool FCogWindowWidgets::ComboCollisionChannel(const char* Label, ECollisionChann
|
||||
bool Result = false;
|
||||
if (ImGui::BeginCombo(Label, TCHAR_TO_ANSI(*SelectedChannelName.ToString()), ImGuiComboFlags_HeightLarge))
|
||||
{
|
||||
for (int32 ChannelIndex = 0; ChannelIndex < (int32)ECC_OverlapAll_Deprecated; ++ChannelIndex)
|
||||
for (int32 ChannelIndex = 0; ChannelIndex < static_cast<int32>(ECC_OverlapAll_Deprecated); ++ChannelIndex)
|
||||
{
|
||||
FColor Color = ChannelColors[ChannelIndex];
|
||||
if (Color == FColor::Transparent)
|
||||
@@ -778,7 +776,7 @@ bool FCogWindowWidgets::ComboCollisionChannel(const char* Label, ECollisionChann
|
||||
{
|
||||
if (ImGui::Selectable(TCHAR_TO_ANSI(*ChannelName.ToString())))
|
||||
{
|
||||
Channel = (ECollisionChannel)ChannelIndex;
|
||||
Channel = static_cast<ECollisionChannel>(ChannelIndex);
|
||||
Result = true;
|
||||
}
|
||||
}
|
||||
@@ -832,7 +830,7 @@ bool FCogWindowWidgets::CollisionProfileChannels(int32& Channels)
|
||||
|
||||
bool Result = false;
|
||||
|
||||
for (int32 ChannelIndex = 0; ChannelIndex < (int32)ECC_OverlapAll_Deprecated; ++ChannelIndex)
|
||||
for (int32 ChannelIndex = 0; ChannelIndex < static_cast<int32>(ECC_OverlapAll_Deprecated); ++ChannelIndex)
|
||||
{
|
||||
FColor Color = ChannelColors[ChannelIndex];
|
||||
if (Color == FColor::Transparent)
|
||||
@@ -905,7 +903,7 @@ bool FCogWindowWidgets::ActorsListWithFilters(AActor*& NewSelection, const UWorl
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogWindowWidgets::ActorsList(AActor*& NewSelection, const UWorld& World, const TSubclassOf<AActor> ActorClass, const ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction)
|
||||
bool FCogWindowWidgets::ActorsList(AActor*& NewSelection, const UWorld& World, const TSubclassOf<AActor>& ActorClass, const ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction)
|
||||
{
|
||||
TArray<AActor*> Actors;
|
||||
for (TActorIterator It(&World, ActorClass); It; ++It)
|
||||
@@ -977,12 +975,11 @@ bool FCogWindowWidgets::ActorsList(AActor*& NewSelection, const UWorld& World, c
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogWindowWidgets::MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, TSubclassOf<AActor> ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction)
|
||||
bool FCogWindowWidgets::MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, const TSubclassOf<AActor>& ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction)
|
||||
{
|
||||
int32 SelectedActorClassIndex = 0;
|
||||
const TArray ActorClasses = { ActorClass };
|
||||
|
||||
AActor* Actor = nullptr;
|
||||
return MenuActorsCombo(StrID, NewSelection, World, ActorClasses, SelectedActorClassIndex, nullptr, nullptr, ContextMenuFunction);
|
||||
}
|
||||
|
||||
@@ -1367,4 +1364,25 @@ bool FCogWindowWidgets::PickButton(const char* InLabel, const ImVec2& InSize, Im
|
||||
window->DrawList->AddCircleFilled(center, radius * 0.15f, text_col);
|
||||
|
||||
return pressed;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec2 FCogWindowWidgets::ComputeScreenCornerLocation(const FVector2f& InAlignment, const FIntVector2& InPadding)
|
||||
{
|
||||
return ComputeScreenCornerLocation(FCogImguiHelper::ToImVec2(InAlignment), FCogImguiHelper::ToImVec2(InPadding));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec2 FCogWindowWidgets::ComputeScreenCornerLocation(const ImVec2& InAlignment, const ImVec2& InPadding)
|
||||
{
|
||||
const ImGuiViewport* Viewport = ImGui::GetMainViewport();
|
||||
if (Viewport == nullptr)
|
||||
{ return ImVec2(0, 0); }
|
||||
|
||||
// +Padding for left, 0 for center, -Padding for left
|
||||
// +Padding for top, 0 for center, -Padding for bottom
|
||||
const ImVec2 Offset = (InAlignment * 2 - ImVec2(1.0f, 1.0f)) * InPadding;
|
||||
|
||||
ImVec2 Position = Viewport->WorkPos + (InAlignment * Viewport->WorkSize) - Offset;
|
||||
return Position;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#include "CogWindow_Inputs.h"
|
||||
|
||||
@@ -290,7 +290,7 @@ void FCogWindow_Settings::SetDPIScale(float Value) const
|
||||
{
|
||||
Config->DPIScale = Value;
|
||||
GetOwner()->GetContext().SetDPIScale(Config->DPIScale);
|
||||
COG_NOTIFY(TEXT("DPI Scale: %0.2f"), Value);
|
||||
//COG_NOTIFY(TEXT("DPI Scale: %0.2f"), Value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "CogWindow_Spacing.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow_Spacing::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
void FCogWindow_Spacing::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow_Spacing::PostRender()
|
||||
void FCogWindow_Spacing::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleColor(1);
|
||||
}
|
||||
|
||||
@@ -34,11 +34,12 @@ public:
|
||||
/** Called every frame with a valid imgui context even if the window is hidden. */
|
||||
virtual void RenderTick(float DeltaTime);
|
||||
|
||||
/** Called every frame without a valid imgui context (outside of the imgui NewFrame/EndFrame) even if the window is hidden. */
|
||||
/** Called every frame without a valid imgui context (outside the imgui NewFrame/EndFrame) even if the window is hidden. */
|
||||
virtual void GameTick(float DeltaTime);
|
||||
|
||||
/** */
|
||||
virtual void RenderMainMenuWidget();
|
||||
void RenderSettings();
|
||||
|
||||
ImGuiID GetID() const { return ID; }
|
||||
|
||||
@@ -72,6 +73,8 @@ public:
|
||||
|
||||
UCogWindowManager* GetOwner() const { return Owner; }
|
||||
|
||||
float GetDpiScale() const;
|
||||
|
||||
template<class T>
|
||||
T* GetConfig(bool InResetConfigOnRequest = true) const { return Cast<T>(GetConfig(T::StaticClass(), InResetConfigOnRequest)); }
|
||||
|
||||
@@ -80,7 +83,7 @@ public:
|
||||
template<class T>
|
||||
const T* GetAsset() const { return Cast<T>(GetAsset(T::StaticClass())); }
|
||||
|
||||
const UObject* GetAsset(const TSubclassOf<UObject> AssetClass) const;
|
||||
const UObject* GetAsset(const TSubclassOf<UObject>& AssetClass) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -92,9 +95,11 @@ protected:
|
||||
|
||||
virtual void RenderHelp();
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) {}
|
||||
virtual void PreBegin(ImGuiWindowFlags& WindowFlags) {}
|
||||
|
||||
virtual void PostRender() {}
|
||||
virtual void PostBegin() {}
|
||||
|
||||
virtual void PostEnd() {}
|
||||
|
||||
virtual void RenderContent() {}
|
||||
|
||||
@@ -118,8 +123,6 @@ protected:
|
||||
|
||||
bool bShowMenu = true;
|
||||
|
||||
bool bNoPadding = false;
|
||||
|
||||
bool bHasMenu = false;
|
||||
|
||||
bool bIsVisible = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
template<typename T>
|
||||
static const T* GetFirstAssetByClass();
|
||||
|
||||
static const UObject* GetFirstAssetByClass(const TSubclassOf<UObject> AssetClass);
|
||||
static const UObject* GetFirstAssetByClass(const TSubclassOf<UObject>& AssetClass);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -126,8 +126,6 @@ protected:
|
||||
|
||||
static void SettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf);
|
||||
|
||||
static void DisableConflictingCommand(UPlayerInput* InPlayerInput, const FCogImGuiKeyInfo& InShortcut);
|
||||
|
||||
static FString ToggleInputCommand;
|
||||
|
||||
static FString DisableInputCommand;
|
||||
|
||||
@@ -13,5 +13,4 @@ public:
|
||||
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@ struct FKeyBind;
|
||||
|
||||
using FCogWindowActorContextMenuFunction = TFunction<void(AActor& Actor)>;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
class COGWINDOW_API FCogWindowWidgets
|
||||
{
|
||||
public:
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
|
||||
static void PopStyleCompact();
|
||||
|
||||
static void AddTextWithShadow(ImDrawList* DrawList, const ImVec2& Position, ImU32 Color, const char* TextBegin, const char* TextEnd = NULL);
|
||||
static void AddTextWithShadow(ImDrawList* DrawList, const ImVec2& Position, ImU32 Color, const char* TextBegin, const char* TextEnd = nullptr);
|
||||
|
||||
static bool SearchBar(const char* InLabel, ImGuiTextFilter& InFilter, float InWidth = -1.0f);
|
||||
|
||||
@@ -83,9 +84,9 @@ public:
|
||||
template<typename EnumType>
|
||||
static bool ComboboxEnum(const char* Label, EnumType& Value);
|
||||
|
||||
static bool ComboboxEnum(const char* Label, UEnum* Enum, int64 CurrentValue, int64& NewValue);
|
||||
static bool ComboboxEnum(const char* Label, const UEnum* Enum, int64 CurrentValue, int64& NewValue);
|
||||
|
||||
static bool ComboboxEnum(const char* Label, UObject* Object, const char* FieldName, uint8* PointerToEnumValue);
|
||||
static bool ComboboxEnum(const char* Label, const UObject* Object, const char* FieldName, uint8* PointerToEnumValue);
|
||||
|
||||
static bool ComboboxEnum(const char* Label, const FEnumProperty* EnumProperty, uint8* PointerToEnumValue);
|
||||
|
||||
@@ -107,13 +108,13 @@ public:
|
||||
|
||||
static bool CollisionProfileChannels(int32& Channels);
|
||||
|
||||
static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, TSubclassOf<AActor> ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
|
||||
static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, const TSubclassOf<AActor>& ActorClass, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
|
||||
|
||||
static bool MenuActorsCombo(const char* StrID, AActor*& NewSelection, const UWorld& World, const TArray<TSubclassOf<AActor>>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
|
||||
|
||||
static bool ActorsListWithFilters(AActor*& NewSelection, const UWorld& World, const TArray<TSubclassOf<AActor>>& ActorClasses, int32& SelectedActorClassIndex, ImGuiTextFilter* Filter, const APawn* LocalPlayerPawn, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
|
||||
|
||||
static bool ActorsList(AActor*& NewSelection, const UWorld& World, const TSubclassOf<AActor> ActorClass, const ImGuiTextFilter* Filter = nullptr, const APawn* LocalPlayerPawn = nullptr, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
|
||||
static bool ActorsList(AActor*& NewSelection, const UWorld& World, const TSubclassOf<AActor>& ActorClass, const ImGuiTextFilter* Filter = nullptr, const APawn* LocalPlayerPawn = nullptr, const FCogWindowActorContextMenuFunction& ContextMenuFunction = nullptr);
|
||||
|
||||
static void ActorContextMenu(AActor& Selection, const FCogWindowActorContextMenuFunction& ContextMenuFunction);
|
||||
|
||||
@@ -153,15 +154,19 @@ public:
|
||||
|
||||
template<typename T>
|
||||
static bool ScalarArray(const char* InLabel, ImGuiDataType InDataType, TArray<T>& InArray, int32 InMaxEntries = 0, const ImVec2& Size = ImVec2(0, 0));
|
||||
|
||||
static ImVec2 ComputeScreenCornerLocation(const FVector2f& InAlignment, const FIntVector2& InPadding);
|
||||
|
||||
static ImVec2 ComputeScreenCornerLocation(const ImVec2& InAlignment, const ImVec2& InPadding);
|
||||
};
|
||||
|
||||
template<typename EnumType>
|
||||
bool FCogWindowWidgets::ComboboxEnum(const char* Label, const EnumType CurrentValue, EnumType& NewValue)
|
||||
{
|
||||
int64 NewValueInt;
|
||||
if (ComboboxEnum(Label, StaticEnum<EnumType>(), (int64)CurrentValue, NewValueInt))
|
||||
if (ComboboxEnum(Label, StaticEnum<EnumType>(), static_cast<int64>(CurrentValue), NewValueInt))
|
||||
{
|
||||
NewValue = (EnumType)NewValueInt;
|
||||
NewValue = static_cast<EnumType>(NewValueInt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#pragma once
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "CogCommonConfig.h"
|
||||
#include "CogImguiKeyInfo.h"
|
||||
#include "CogWindow.h"
|
||||
#include "GameFramework/PlayerInput.h"
|
||||
#include "CogWindow_Settings.generated.h"
|
||||
|
||||
class UCogEngineConfig_Settings;
|
||||
|
||||
@@ -7,14 +7,10 @@ class COGWINDOW_API FCogWindow_Spacing : public FCogWindow
|
||||
{
|
||||
typedef FCogWindow Super;
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
virtual void PreBegin(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void PostRender() override;
|
||||
virtual void PostBegin() override;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@@ -135,8 +135,8 @@ void FCogAIWindow_BehaviorTree::RenderContent()
|
||||
{
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
{
|
||||
ImGui::ColorEdit4("Active Color", (float*)&Config->ActiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Inactive Color", (float*)&Config->InactiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Active Color", &Config->ActiveColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Inactive Color", &Config->InactiveColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ void FCogAIWindow_BehaviorTree::RenderNode(UBehaviorTreeComponent& BehaviorTreeC
|
||||
ImGui::TableSetupColumn("Property");
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
const ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
//------------------------
|
||||
// Name
|
||||
|
||||
@@ -12,7 +12,6 @@ void FCogAIWindow_Blackboard::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
|
||||
Config = GetConfig<UCogAIConfig_Blackboard>();
|
||||
}
|
||||
@@ -25,6 +24,19 @@ void FCogAIWindow_Blackboard::RenderHelp()
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAIWindow_Blackboard::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
WindowFlags |= ImGuiWindowFlags_NoScrollbar;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAIWindow_Blackboard::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAIWindow_Blackboard::RenderContent()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,10 @@ protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreBegin(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void PostBegin() override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "CogAbilityConfig_Alignment.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindow.h"
|
||||
#include "MeshPaintVisualize.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityCheat_Execution_ApplyEffect::Execute_Implementation(const UObject* WorldContextObject, const AActor* Instigator, const TArray<AActor*>& Targets) const
|
||||
|
||||
@@ -86,62 +86,53 @@ FVector4f UCogAbilityConfig_Alignment::GetEffectModifierColor(float ModifierValu
|
||||
{
|
||||
switch (ModifierOp)
|
||||
{
|
||||
case EGameplayModOp::Additive:
|
||||
case EGameplayModOp::AddBase:
|
||||
case EGameplayModOp::AddFinal:
|
||||
{
|
||||
if (ModifierValue > 0.0f)
|
||||
{
|
||||
return PositiveColor;
|
||||
}
|
||||
{ return PositiveColor; }
|
||||
|
||||
if (ModifierValue < 0.0f)
|
||||
{
|
||||
return NegativeColor;
|
||||
}
|
||||
break;
|
||||
{ return NegativeColor; }
|
||||
|
||||
return NeutralColor;
|
||||
}
|
||||
|
||||
case EGameplayModOp::Multiplicitive:
|
||||
case EGameplayModOp::MultiplyAdditive:
|
||||
case EGameplayModOp::MultiplyCompound:
|
||||
{
|
||||
if (ModifierValue > 1.0f)
|
||||
{
|
||||
return PositiveColor;
|
||||
}
|
||||
else if (ModifierValue < 1.0f)
|
||||
{
|
||||
return NegativeColor;
|
||||
}
|
||||
break;
|
||||
{ return PositiveColor; }
|
||||
|
||||
if (ModifierValue < 1.0f)
|
||||
{ return NegativeColor; }
|
||||
|
||||
return NeutralColor;
|
||||
}
|
||||
|
||||
case EGameplayModOp::Division:
|
||||
case EGameplayModOp::DivideAdditive:
|
||||
{
|
||||
if (ModifierValue < 1.0f)
|
||||
{
|
||||
return PositiveColor;
|
||||
}
|
||||
{ return PositiveColor; }
|
||||
|
||||
if (ModifierValue > 1.0f)
|
||||
{
|
||||
return NegativeColor;
|
||||
}
|
||||
break;
|
||||
{ return NegativeColor; }
|
||||
|
||||
return NeutralColor;
|
||||
}
|
||||
|
||||
case EGameplayModOp::Override:
|
||||
{
|
||||
if (ModifierValue > BaseValue)
|
||||
{
|
||||
return PositiveColor;
|
||||
}
|
||||
{ return PositiveColor; }
|
||||
|
||||
if (ModifierValue < BaseValue)
|
||||
{
|
||||
return NegativeColor;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
{ return NegativeColor; }
|
||||
|
||||
return NeutralColor;
|
||||
return NeutralColor;
|
||||
}
|
||||
|
||||
default: return NeutralColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "CogAbilityHelper.h"
|
||||
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "imgui.h"
|
||||
@@ -56,4 +57,17 @@ void FCogAbilityHelper::RenderTagContainer(
|
||||
ImGui::SameLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityHelper::RenderConfigureMessage(const TWeakObjectPtr<const UCogAbilityDataAsset> InAsset)
|
||||
{
|
||||
if (InAsset == nullptr)
|
||||
{
|
||||
ImGui::Text("Create a DataAsset child of '%s' to configure. ", StringCast<ANSICHAR>(*UCogAbilityDataAsset::StaticClass()->GetName()).Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("Can be configured in the '%s' DataAsset. ", StringCast<ANSICHAR>(*GetNameSafe(InAsset.Get())).Get());
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ void FCogAbilityWindow_Abilities::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
|
||||
Asset = GetAsset<UCogAbilityDataAsset>();
|
||||
Config = GetConfig<UCogAbilityConfig_Abilities>();
|
||||
@@ -32,8 +31,20 @@ void FCogAbilityWindow_Abilities::RenderHelp()
|
||||
"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(Asset.Get())));
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Abilities::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
WindowFlags |= ImGuiWindowFlags_NoScrollbar;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Abilities::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -185,12 +196,12 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesMenuFilters()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Abilities::RenderAbilitiesMenuColorSettings()
|
||||
{
|
||||
ImGui::ColorEdit4("Active Color", (float*)&Config->ActiveAbilityColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Inactive Color", (float*)&Config->InactiveAbilityColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Blocked Color", (float*)&Config->BlockedAbilityColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Default Tag Color", (float*)&Config->DefaultTagsColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Blocked Tag Color", (float*)&Config->BlockedTagsColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Input Pressed Color", (float*)&Config->InputPressedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Active Color", &Config->ActiveAbilityColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Inactive Color", &Config->InactiveAbilityColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Blocked Color", &Config->BlockedAbilityColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Default Tag Color", &Config->DefaultTagsColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Blocked Tag Color", &Config->BlockedTagsColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Input Pressed Color", &Config->InputPressedColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -17,7 +17,6 @@ void FCogAbilityWindow_Attributes::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
|
||||
Config = GetConfig<UCogAbilityConfig_Attributes>();
|
||||
AlignmentConfig = GetConfig<UCogAbilityConfig_Alignment>();
|
||||
@@ -35,6 +34,18 @@ void FCogAbilityWindow_Attributes::RenderHelp()
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Attributes::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Attributes::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Attributes::RenderTick(float DeltaTime)
|
||||
{
|
||||
@@ -87,11 +98,11 @@ void FCogAbilityWindow_Attributes::RenderContent()
|
||||
ImGui::SetItemTooltip("Prefixes to remove from the attribute set name. Separate multiple prefixes with the semicolon character ';'");
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::ColorEdit4("Positive Color", (float*)&AlignmentConfig->PositiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Negative Color", (float*)&AlignmentConfig->NegativeColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Neutral Color", (float*)&AlignmentConfig->NeutralColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("AttributeSet Color", (float*)&Config->AttributeSetColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Category Color", (float*)&Config->CategoryColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Positive Color", &AlignmentConfig->PositiveColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Negative Color", &AlignmentConfig->NegativeColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Neutral Color", &AlignmentConfig->NeutralColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("AttributeSet Color", &Config->AttributeSetColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Category Color", &Config->CategoryColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Reset"))
|
||||
{
|
||||
@@ -108,7 +119,7 @@ void FCogAbilityWindow_Attributes::RenderContent()
|
||||
const bool bGroupByAttributeSetValue = Filter.IsActive() == false && Config->ShowOnlyModified == false && Config->GroupByAttributeSet;
|
||||
const bool bGroupByCategoryValue = Filter.IsActive() == false && Config->ShowOnlyModified == false && Config->GroupByCategory;
|
||||
const float bShowGroup = bGroupByAttributeSetValue | bGroupByCategoryValue;
|
||||
const float FirstColWidth = ((int32)bGroupByAttributeSetValue + (int32)bGroupByCategoryValue) * ImGui::GetFontSize() * 2;
|
||||
const float FirstColWidth = (static_cast<int32>(bGroupByAttributeSetValue) + static_cast<int32>(bGroupByCategoryValue)) * ImGui::GetFontSize() * 2;
|
||||
|
||||
if (ImGui::BeginTable("Attributes", 5, ImGuiTableFlags_SizingFixedFit
|
||||
| ImGuiTableFlags_Resizable
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Cheats::RenderHelp()
|
||||
{
|
||||
ImGui::TextDisabled("This window is deprecated. Please use the CogEngineWindow_Cheat instead as it provide more functionnalities.");
|
||||
ImGui::TextDisabled("This window is deprecated. Please use the CogEngineWindow_Cheat instead as it provide more functionalities.");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -16,7 +16,6 @@ void FCogAbilityWindow_Effects::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
|
||||
Asset = GetAsset<UCogAbilityDataAsset>();
|
||||
Config = GetConfig<UCogAbilityConfig_Effects>();
|
||||
@@ -40,6 +39,19 @@ void FCogAbilityWindow_Effects::RenderTick(float DeltaTime)
|
||||
RenderOpenEffects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::RenderContent()
|
||||
{
|
||||
@@ -53,9 +65,9 @@ void FCogAbilityWindow_Effects::RenderContent()
|
||||
ImGui::Checkbox("Sort by Alignment", &Config->SortByAlignment);
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::ColorEdit4("Positive Color", (float*)&AlignmentConfig->PositiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Negative Color", (float*)&AlignmentConfig->NegativeColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Neutral Color", (float*)&AlignmentConfig->NeutralColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Positive Color", &AlignmentConfig->PositiveColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Negative Color", &AlignmentConfig->NegativeColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Neutral Color", &AlignmentConfig->NeutralColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Reset"))
|
||||
@@ -128,7 +140,6 @@ void FCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
}
|
||||
}
|
||||
|
||||
bool AlignmentOrder = false;
|
||||
if (Config->SortByAlignment && Asset != nullptr)
|
||||
{
|
||||
const FGameplayTagContainer& Tags1 = Effect1->GetAssetTags();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "AbilitySystemGlobals.h"
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogAbilityHelper.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui_internal.h"
|
||||
@@ -18,11 +19,8 @@ void FCogAbilityWindow_Pools::Initialize()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Pools::RenderHelp()
|
||||
{
|
||||
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(Asset.Get()))
|
||||
);
|
||||
ImGui::Text("This window displays attributes of the selected actor as pools. ");
|
||||
FCogAbilityHelper::RenderConfigureMessage(Asset);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -87,13 +85,13 @@ void FCogAbilityWindow_Pools::DrawPool(const UAbilitySystemComponent* AbilitySys
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// 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
|
||||
const char* Format;
|
||||
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);
|
||||
ImFormatString(Buffer, IM_ARRAYSIZE(Buffer), Format, Value, Max);
|
||||
|
||||
const float Ratio = Max > 0.0f ? Value / Max : 0.0f;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ void FCogAbilityWindow_Tags::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -20,6 +19,18 @@ void FCogAbilityWindow_Tags::RenderHelp()
|
||||
ImGui::Text("This window displays gameplay tags of the selected actor. ");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Tags::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Tags::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Tags::RenderContent()
|
||||
{
|
||||
@@ -145,7 +156,7 @@ void FCogAbilityWindow_Tags::RenderTag(const UAbilitySystemComponent& AbilitySys
|
||||
{
|
||||
if (ImGui::BeginTable("Tag", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
const ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
ImGui::TableSetupColumn("Property");
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
@@ -14,7 +14,6 @@ void FCogAbilityWindow_Tasks::Initialize()
|
||||
Super::Initialize();
|
||||
|
||||
bHasMenu = true;
|
||||
bNoPadding = true;
|
||||
|
||||
Config = GetConfig<UCogAbilityConfig_Tasks>();
|
||||
}
|
||||
@@ -27,9 +26,15 @@ void FCogAbilityWindow_Tasks::RenderHelp()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Tasks::RenderTick(float DetlaTime)
|
||||
void FCogAbilityWindow_Tasks::PreBegin(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
Super::RenderTick(DetlaTime);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Tasks::PostBegin()
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -74,11 +79,11 @@ void FCogAbilityWindow_Tasks::RenderTaskMenu(AActor* Selection)
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::ColorEdit4("Uninitialized Color", (float*)&Config->UninitializedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Awaiting Activation Color", (float*)&Config->AwaitingActivationColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Active Color", (float*)&Config->ActiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Paused Color", (float*)&Config->PausedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Finished Color", (float*)&Config->FinishedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Uninitialized Color", &Config->UninitializedColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Awaiting Activation Color", &Config->AwaitingActivationColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Active Color", &Config->ActiveColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Paused Color", &Config->PausedColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Finished Color", &Config->FinishedColor.X, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
@@ -102,8 +107,6 @@ void FCogAbilityWindow_Tasks::RenderTasksTable(UAbilitySystemComponent& AbilityS
|
||||
TArray<const UGameplayTask*> FilteredTasks;
|
||||
FilteredTasks.Reserve(16);
|
||||
|
||||
const AActor* Selection = GetSelection();
|
||||
|
||||
for (FConstGameplayTaskIterator it = AbilitySystemComponent.GetKnownTaskIterator(); it; ++it)
|
||||
{
|
||||
const UGameplayTask* Task = Cast<const UGameplayTask>(*it);
|
||||
@@ -311,7 +314,7 @@ void FCogAbilityWindow_Tasks::RenderTaskInfo(const UGameplayTask* Task)
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Priority");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", (int32)Task->GetPriority());
|
||||
ImGui::Text("%d", static_cast<int32>(Task->GetPriority()));
|
||||
|
||||
//------------------------
|
||||
// IsTicking
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user