mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 08:02:23 -07:00
Merge branch 'new-windows' of https://github.com/arnaud-jamin/Cog into new-windows
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
|
||||
#include "CogDebugDrawHelper.h"
|
||||
#include "CogDebugDrawImGui.h"
|
||||
#include "CogDebugHelper.h"
|
||||
#include "CogDebugLog.h"
|
||||
#include "CogDebugModule.h"
|
||||
#include "CogDebugReplicator.h"
|
||||
#include "CogDebug.h"
|
||||
#include "CogDebugShape.h"
|
||||
@@ -20,7 +18,7 @@
|
||||
#if ENABLE_COG
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::String2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FString& Text, const FVector2D& Location, const FColor& Color, bool Persistent)
|
||||
void FCogDebugDraw::String2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FString& Text, const FVector2D& Location, const FColor& Color, const bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
@@ -37,7 +35,7 @@ void FCogDebugDraw::String2D(const FLogCategoryBase& LogCategory, const UObject*
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Segment2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& SegmentStart, const FVector2D& SegmentEnd, const FColor& Color, bool Persistent)
|
||||
void FCogDebugDraw::Segment2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& SegmentStart, const FVector2D& SegmentEnd, const FColor& Color, const bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
@@ -54,7 +52,7 @@ void FCogDebugDraw::Segment2D(const FLogCategoryBase& LogCategory, const UObject
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Circle2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Location, float Radius, const FColor& Color, bool Persistent)
|
||||
void FCogDebugDraw::Circle2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Location, const float Radius, const FColor& Color, const bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
@@ -73,7 +71,7 @@ void FCogDebugDraw::Circle2D(const FLogCategoryBase& LogCategory, const UObject*
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugDraw::Rect2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Min, const FVector2D& Max, const FColor& Color, bool Persistent)
|
||||
void FCogDebugDraw::Rect2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Min, const FVector2D& Max, const FColor& Color, const bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
@@ -98,7 +96,7 @@ void FCogDebugDraw::String(const FLogCategoryBase& LogCategory, const UObject* W
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -126,7 +124,7 @@ void FCogDebugDraw::Point(const FLogCategoryBase& LogCategory, const UObject* Wo
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -153,7 +151,7 @@ void FCogDebugDraw::Segment(const FLogCategoryBase& LogCategory, const UObject*
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -183,7 +181,7 @@ void FCogDebugDraw::Bone(const FLogCategoryBase& LogCategory, const UObject* Wor
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -222,7 +220,7 @@ void FCogDebugDraw::Arrow(const FLogCategoryBase& LogCategory, const UObject* Wo
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -246,20 +244,20 @@ void FCogDebugDraw::Arrow(const FLogCategoryBase& LogCategory, const UObject* Wo
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Axis(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& AxisLoc, const FRotator& AxisRot, float Scale, const bool Persistent, const uint8 DepthPriority)
|
||||
void FCogDebugDraw::Axis(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& AxisLoc, const FRotator& AxisRot, const float Scale, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FRotationMatrix R(AxisRot);
|
||||
const FRotationMatrix R(AxisRot);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::X) * Scale, FColor::Red, TEXT_EMPTY);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::Y) * Scale, FColor::Green, TEXT_EMPTY);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::Z) * Scale, FColor::Blue, TEXT_EMPTY);
|
||||
@@ -285,7 +283,7 @@ void FCogDebugDraw::Circle(const FLogCategoryBase& LogCategory, const UObject* W
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -312,14 +310,14 @@ void FCogDebugDraw::Circle(const FLogCategoryBase& LogCategory, const UObject* W
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::CircleArc(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
void FCogDebugDraw::CircleArc(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, const float InnerRadius, const float OuterRadius, const float Angle, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -353,7 +351,7 @@ void FCogDebugDraw::FlatCapsule(const FLogCategoryBase& LogCategory, const UObje
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -379,14 +377,14 @@ void FCogDebugDraw::FlatCapsule(const FLogCategoryBase& LogCategory, const UObje
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Sphere(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Location, float Radius, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
void FCogDebugDraw::Sphere(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Location, const float Radius, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -417,7 +415,7 @@ void FCogDebugDraw::Box(const FLogCategoryBase& LogCategory, const UObject* Worl
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -448,7 +446,7 @@ void FCogDebugDraw::SolidBox(const FLogCategoryBase& LogCategory, const UObject*
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -476,14 +474,14 @@ void FCogDebugDraw::SolidBox(const FLogCategoryBase& LogCategory, const UObject*
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Frustrum(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, const float Angle, const float AspectRatio, const float NearPlane, const float FarPlane, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
void FCogDebugDraw::Frustum(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, const float Angle, const float AspectRatio, const float NearPlane, const float FarPlane, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -515,7 +513,7 @@ void FCogDebugDraw::Capsule(const FLogCategoryBase& LogCategory, const UObject*
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -540,29 +538,29 @@ void FCogDebugDraw::Capsule(const FLogCategoryBase& LogCategory, const UObject*
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Points(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const TArray<FVector>& Points, float Radius, const FColor& StartColor, const FColor& EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
void FCogDebugDraw::Points(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const TArray<FVector>& Points, const float Radius, const FColor& StartColor, const FColor& EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
{
|
||||
int32 index = 0;
|
||||
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 / (float)(Points.Num() - 1));
|
||||
Sphere(LogCategory, WorldContextObject, Point, Radius, Color.ToFColor(true), Persistent, DepthPriority);
|
||||
index++;
|
||||
Index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Path(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const TArray<FVector>& Points, float PointSize, const FColor& StartColor, const FColor& EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
void FCogDebugDraw::Path(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const TArray<FVector>& Points, const float PointSize, const FColor& StartColor, const FColor& EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -594,7 +592,7 @@ void FCogDebugDraw::Path(const FLogCategoryBase& LogCategory, const UObject* Wor
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeletalMeshComponent* Skeleton, const FColor& Color, bool DrawSecondaryBones, uint8 DepthPriority)
|
||||
void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeletalMeshComponent* Skeleton, const FColor& Color, const bool DrawSecondaryBones, const uint8 DepthPriority)
|
||||
{
|
||||
if (Skeleton == nullptr)
|
||||
{
|
||||
@@ -614,7 +612,7 @@ void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeleta
|
||||
{
|
||||
if (DrawSecondaryBones == false)
|
||||
{
|
||||
FName BoneName = ReferenceSkeleton.GetBoneName(BoneIndex);
|
||||
const FName BoneName = ReferenceSkeleton.GetBoneName(BoneIndex);
|
||||
if (FCogDebug::IsSecondarySkeletonBone(BoneName))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "CogDebugLogCategory.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawString(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector Location, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawString(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FString& Text, const FVector Location, const FLinearColor Color, const bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -15,7 +15,7 @@ void UCogDebugDrawBlueprint::DebugDrawString(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawPoint(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Size, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawPoint(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector Location, const float Size, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -26,7 +26,7 @@ void UCogDebugDrawBlueprint::DebugDrawPoint(const UObject* WorldContextObject, F
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawSegment(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSegment(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -37,7 +37,7 @@ void UCogDebugDrawBlueprint::DebugDrawSegment(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawArrow(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawArrow(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -48,7 +48,7 @@ void UCogDebugDrawBlueprint::DebugDrawArrow(const UObject* WorldContextObject, F
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawAxis(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, const FRotator Rotation, float Scale, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawAxis(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector Location, const FRotator Rotation, const float Scale, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -59,7 +59,7 @@ void UCogDebugDrawBlueprint::DebugDrawAxis(const UObject* WorldContextObject, FC
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawSphere(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSphere(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector Location, const float Radius, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -70,7 +70,7 @@ void UCogDebugDrawBlueprint::DebugDrawSphere(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawBox(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -81,7 +81,7 @@ void UCogDebugDrawBlueprint::DebugDrawBox(const UObject* WorldContextObject, FCo
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawSolidBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSolidBox(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -92,7 +92,7 @@ void UCogDebugDrawBlueprint::DebugDrawSolidBox(const UObject* WorldContextObject
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawCapsule(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const float HalfHeight, const float Radius, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCapsule(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector Center, const float HalfHeight, const float Radius, const FQuat Rotation, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -103,7 +103,7 @@ void UCogDebugDrawBlueprint::DebugDrawCapsule(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircle(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircle(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FMatrix& Matrix, const float Radius, const FLinearColor Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -114,7 +114,7 @@ void UCogDebugDrawBlueprint::DebugDrawCircle(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircleArc(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircleArc(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FMatrix& Matrix, const float InnerRadius, const float OuterRadius, const float Angle, const FLinearColor Color, const bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -125,7 +125,7 @@ void UCogDebugDrawBlueprint::DebugDrawCircleArc(const UObject* WorldContextObjec
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawPoints(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float Radius, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawPoints(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const TArray<FVector>& Points, const float Radius, const FLinearColor StartColor, const FLinearColor EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -136,7 +136,7 @@ void UCogDebugDrawBlueprint::DebugDrawPoints(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawPath(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float PointSize, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawPath(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const TArray<FVector>& Points, const float PointSize, const FLinearColor StartColor, const FLinearColor EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -147,7 +147,7 @@ void UCogDebugDrawBlueprint::DebugDrawPath(const UObject* WorldContextObject, FC
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawString2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector2D Location, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawString2D(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FString& Text, const FVector2D Location, const FLinearColor Color, const bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -158,7 +158,7 @@ void UCogDebugDrawBlueprint::DebugDrawString2D(const UObject* WorldContextObject
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawSegment2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D SegmentStart, const FVector2D SegmentEnd, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSegment2D(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector2D SegmentStart, const FVector2D SegmentEnd, const FLinearColor Color, const bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -169,7 +169,7 @@ void UCogDebugDrawBlueprint::DebugDrawSegment2D(const UObject* WorldContextObjec
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircle2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Location, float Radius, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircle2D(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector2D Location, const float Radius, const FLinearColor Color, const bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -180,7 +180,7 @@ void UCogDebugDrawBlueprint::DebugDrawCircle2D(const UObject* WorldContextObject
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugDrawRect2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Min, const FVector2D Max, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawRect2D(const UObject* WorldContextObject, const FCogLogCategory LogCategory, const FVector2D Min, const FVector2D Max, const FLinearColor Color, const bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
namespace
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
ULineBatchComponent* GetDebugLineBatcher(const UWorld* InWorld, bool bPersistentLines, float LifeTime, bool bDepthIsForeground)
|
||||
ULineBatchComponent* GetDebugLineBatcher(const UWorld* InWorld, const bool bPersistentLines, const float LifeTime, const bool bDepthIsForeground)
|
||||
{
|
||||
return (InWorld ? (bDepthIsForeground ? InWorld->ForegroundLineBatcher : ((bPersistentLines || (LifeTime > 0.f)) ? InWorld->PersistentLineBatcher : InWorld->LineBatcher)) : nullptr);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static float GetLineLifeTime(ULineBatchComponent* LineBatcher, float LifeTime, bool bPersistent)
|
||||
static float GetLineLifeTime(const ULineBatchComponent* LineBatcher, const float LifeTime, const bool bPersistent)
|
||||
{
|
||||
return bPersistent ? -1.0f : ((LifeTime > 0.f) ? LifeTime : LineBatcher->DefaultLifeTime);
|
||||
}
|
||||
@@ -154,8 +154,8 @@ void FCogDebugDrawHelper::DrawFlatCapsule(
|
||||
const uint8 DepthPriority,
|
||||
const float Thickness)
|
||||
{
|
||||
FVector2D Forward = (End - Start).GetSafeNormal();
|
||||
FVector2D Right = FVector2D(-Forward.Y, Forward.X);
|
||||
const FVector2D Forward = (End - Start).GetSafeNormal();
|
||||
const FVector2D Right = FVector2D(-Forward.Y, Forward.X);
|
||||
|
||||
::DrawDebugLine(InWorld, FVector(Start - Right * Radius, Z), FVector(End - Right * Radius, Z), Color, bPersistentLines, LifeTime, DepthPriority, Thickness);
|
||||
::DrawDebugLine(InWorld, FVector(Start + Right * Radius, Z), FVector(End + Right * Radius, Z), Color, bPersistentLines, LifeTime, DepthPriority, Thickness);
|
||||
|
||||
@@ -9,7 +9,7 @@ FColor FCogDebugHelper::GetAutoColor(FName Name, const FColor& UserColor)
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 Hash = GetTypeHash(Name.ToString());
|
||||
const uint32 Hash = GetTypeHash(Name.ToString());
|
||||
FMath::RandInit(Hash);
|
||||
|
||||
const uint8 Hue = (uint8)(FMath::FRand() * 255);
|
||||
@@ -41,7 +41,7 @@ const char* FCogDebugHelper::VerbosityToString(ELogVerbosity::Type Verbosity)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FString FCogDebugHelper::ShortenEnumName(FString EnumNameString)
|
||||
{
|
||||
int32 ScopeIndex = EnumNameString.Find(TEXT("::"), ESearchCase::CaseSensitive);
|
||||
const int32 ScopeIndex = EnumNameString.Find(TEXT("::"), ESearchCase::CaseSensitive);
|
||||
if (ScopeIndex != INDEX_NONE)
|
||||
{
|
||||
return EnumNameString.Mid(ScopeIndex + 2);
|
||||
|
||||
@@ -34,7 +34,7 @@ FString FCogDebugLogCategoryInfo::GetDisplayName() const
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// FCogDebugLogCategoryManager
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName, const FString& Description, bool bVisible)
|
||||
void FCogDebugLog::AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName, const FString& Description, const bool bVisible)
|
||||
{
|
||||
LogCategories.Add(LogCategory.GetCategoryName(),
|
||||
FCogDebugLogCategoryInfo
|
||||
@@ -48,7 +48,7 @@ void FCogDebugLog::AddLogCategory(FLogCategoryBase& LogCategory, const FString&
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugLog::IsVerbosityActive(ELogVerbosity::Type Verbosity)
|
||||
bool FCogDebugLog::IsVerbosityActive(const ELogVerbosity::Type Verbosity)
|
||||
{
|
||||
return Verbosity >= ELogVerbosity::Verbose;
|
||||
}
|
||||
@@ -60,9 +60,9 @@ bool FCogDebugLog::IsLogCategoryActive(const FLogCategoryBase& LogCategory)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugLog::IsLogCategoryActive(FName CategoryName)
|
||||
bool FCogDebugLog::IsLogCategoryActive(const FName CategoryName)
|
||||
{
|
||||
if (FLogCategoryBase* LogCategory = FindLogCategory(CategoryName))
|
||||
if (const FLogCategoryBase* LogCategory = FindLogCategory(CategoryName))
|
||||
{
|
||||
return IsVerbosityActive(LogCategory->GetVerbosity());
|
||||
}
|
||||
@@ -71,13 +71,13 @@ bool FCogDebugLog::IsLogCategoryActive(FName CategoryName)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::SetLogCategoryActive(FLogCategoryBase& LogCategory, bool Value)
|
||||
void FCogDebugLog::SetLogCategoryActive(FLogCategoryBase& LogCategory, const bool Value)
|
||||
{
|
||||
LogCategory.SetVerbosity(Value ? ELogVerbosity::Verbose : ELogVerbosity::Warning);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::OnServerVerbosityChanged(FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
void FCogDebugLog::OnServerVerbosityChanged(const FName CategoryName, const ELogVerbosity::Type Verbosity)
|
||||
{
|
||||
if (FCogDebugLogCategoryInfo* LogCategoryInfo = FindLogCategoryInfo(CategoryName))
|
||||
{
|
||||
@@ -86,9 +86,9 @@ void FCogDebugLog::OnServerVerbosityChanged(FName CategoryName, ELogVerbosity::T
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ELogVerbosity::Type FCogDebugLog::GetServerVerbosity(FName CategoryName)
|
||||
ELogVerbosity::Type FCogDebugLog::GetServerVerbosity(const FName CategoryName)
|
||||
{
|
||||
if (FCogDebugLogCategoryInfo* LogCategoryInfo = FindLogCategoryInfo(CategoryName))
|
||||
if (const FCogDebugLogCategoryInfo* LogCategoryInfo = FindLogCategoryInfo(CategoryName))
|
||||
{
|
||||
return LogCategoryInfo->ServerVerbosity;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ ELogVerbosity::Type FCogDebugLog::GetServerVerbosity(FName CategoryName)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::SetServerVerbosity(UWorld& World, FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
void FCogDebugLog::SetServerVerbosity(UWorld& World, const FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
{
|
||||
if (ACogDebugReplicator* Replicator = ACogDebugReplicator::GetLocalReplicator(World))
|
||||
{
|
||||
@@ -106,27 +106,27 @@ void FCogDebugLog::SetServerVerbosity(UWorld& World, FName CategoryName, ELogVer
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::SetServerVerbosityActive(UWorld& World, FName CategoryName, bool Value)
|
||||
void FCogDebugLog::SetServerVerbosityActive(UWorld& World, const FName CategoryName, const bool Value)
|
||||
{
|
||||
SetServerVerbosity(World, CategoryName, Value ? ELogVerbosity::Verbose : ELogVerbosity::Warning);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugLog::IsServerVerbosityActive(FName CategoryName)
|
||||
bool FCogDebugLog::IsServerVerbosityActive(const FName CategoryName)
|
||||
{
|
||||
return IsVerbosityActive(GetServerVerbosity(CategoryName));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FCogDebugLogCategoryInfo* FCogDebugLog::FindLogCategoryInfo(FName CategoryName)
|
||||
FCogDebugLogCategoryInfo* FCogDebugLog::FindLogCategoryInfo(const FName CategoryName)
|
||||
{
|
||||
return LogCategories.Find(CategoryName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FLogCategoryBase* FCogDebugLog::FindLogCategory(FName CategoryName)
|
||||
FLogCategoryBase* FCogDebugLog::FindLogCategory(const FName CategoryName)
|
||||
{
|
||||
if (FCogDebugLogCategoryInfo* LogCategoryInfo = FindLogCategoryInfo(CategoryName))
|
||||
if (const FCogDebugLogCategoryInfo* LogCategoryInfo = FindLogCategoryInfo(CategoryName))
|
||||
{
|
||||
return LogCategoryInfo->LogCategory;
|
||||
}
|
||||
@@ -139,9 +139,9 @@ FLogCategoryBase* FCogDebugLog::FindLogCategory(FName CategoryName)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLog::DeactivateAllLogCateories(UWorld& World)
|
||||
void FCogDebugLog::DeactivateAllLogCategories(UWorld& World)
|
||||
{
|
||||
FString ToggleStr = TEXT("Log LogCogNone Only");
|
||||
const FString ToggleStr = TEXT("Log LogCogNone Only");
|
||||
GEngine->Exec(&World, *ToggleStr);
|
||||
|
||||
if (APlayerController* PlayerController = World.GetFirstPlayerController())
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "CogDebugLogCategory.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text)
|
||||
void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, const FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -30,7 +30,7 @@ void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, FCogLogCatego
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool UCogDebugLogBlueprint::IsLogActive(const UObject* WorldContextObject, FCogLogCategory LogCategory)
|
||||
bool UCogDebugLogBlueprint::IsLogActive(const UObject* WorldContextObject, const FCogLogCategory LogCategory)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ FLogCategoryBase* FCogLogCategory::GetLogCategory() const
|
||||
|
||||
if (LogCategory == nullptr)
|
||||
{
|
||||
if (FCogDebugLogCategoryInfo* CategoryInfo = FCogDebugLog::GetLogCategories().Find(Name))
|
||||
if (const FCogDebugLogCategoryInfo* CategoryInfo = FCogDebugLog::GetLogCategories().Find(Name))
|
||||
{
|
||||
LogCategory = CategoryInfo->LogCategory;
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ void ACogDebugReplicator::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
const UWorld* World = GetWorld();
|
||||
check(World);
|
||||
const ENetMode NetMode = World->GetNetMode();
|
||||
bHasAuthority = NetMode != NM_Client;
|
||||
|
||||
OwnerPlayerController = Cast<APlayerController>(GetOwner());
|
||||
|
||||
if (OwnerPlayerController->IsLocalController())
|
||||
if (OwnerPlayerController != nullptr && OwnerPlayerController->IsLocalController())
|
||||
{
|
||||
Server_RequestAllCategoriesVerbosity();
|
||||
Server_SetSelection(FCogDebug::GetSelection());
|
||||
@@ -122,10 +122,10 @@ void ACogDebugReplicator::Server_SetCategoryVerbosity_Implementation(FName LogCa
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
ENetMode NetMode = GetWorld()->GetNetMode();
|
||||
const ENetMode NetMode = GetWorld()->GetNetMode();
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_ListenServer)
|
||||
{
|
||||
if (FCogDebugLogCategoryInfo* LogCategoryInfo = FCogDebugLog::FindLogCategoryInfo(LogCategoryName))
|
||||
if (const FCogDebugLogCategoryInfo* LogCategoryInfo = FCogDebugLog::FindLogCategoryInfo(LogCategoryName))
|
||||
{
|
||||
LogCategoryInfo->LogCategory->SetVerbosity((ELogVerbosity::Type)Verbosity);
|
||||
|
||||
@@ -175,13 +175,13 @@ void ACogDebugReplicator::Server_RequestAllCategoriesVerbosity_Implementation()
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
ENetMode NetMode = GetWorld()->GetNetMode();
|
||||
const ENetMode NetMode = GetWorld()->GetNetMode();
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_ListenServer)
|
||||
{
|
||||
TArray<FCogServerCategoryData> CategoriesData;
|
||||
for (auto& Entry : FCogDebugLog::GetLogCategories())
|
||||
{
|
||||
FCogDebugLogCategoryInfo& CategoryInfo = Entry.Value;
|
||||
const FCogDebugLogCategoryInfo& CategoryInfo = Entry.Value;
|
||||
if (CategoryInfo.LogCategory != nullptr)
|
||||
{
|
||||
CategoriesData.Add(
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
|
||||
virtual bool IsStateEqual(INetDeltaBaseState* OtherState) override
|
||||
{
|
||||
FCogReplicatorNetState* Other = static_cast<FCogReplicatorNetState*>(OtherState);
|
||||
const FCogReplicatorNetState* Other = static_cast<FCogReplicatorNetState*>(OtherState);
|
||||
return (ShapesRepCounter == Other->ShapesRepCounter);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms
|
||||
return false;
|
||||
}
|
||||
|
||||
FCogReplicatorNetState* OldState = static_cast<FCogReplicatorNetState*>(DeltaParms.OldState);
|
||||
const FCogReplicatorNetState* OldState = static_cast<FCogReplicatorNetState*>(DeltaParms.OldState);
|
||||
FCogReplicatorNetState* NewState = new FCogReplicatorNetState();
|
||||
check(DeltaParms.NewState);
|
||||
*DeltaParms.NewState = TSharedPtr<INetDeltaBaseState>(NewState);
|
||||
|
||||
@@ -48,7 +48,7 @@ struct COGDEBUG_API FCogDebugDraw
|
||||
|
||||
static void Path(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const TArray<FVector>& Points, float PointSize, const FColor& StartColor, const FColor& EndColor, const bool Persistent, const uint8 DepthPriority = 0U);
|
||||
|
||||
static void Frustrum(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, const float Angle, const float AspectRatio, const float NearPlane, const float FarPlane, const FColor& Color, const bool Persistent, const uint8 DepthPriority = 0U);
|
||||
static void Frustum(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, const float Angle, const float AspectRatio, const float NearPlane, const float FarPlane, const FColor& Color, const bool Persistent, const uint8 DepthPriority = 0U);
|
||||
|
||||
static void Skeleton(const FLogCategoryBase& LogCategory, const USkeletalMeshComponent* Skeleton, const FColor& Color, bool DrawSecondaryBones = false, const uint8 DepthPriority = 1);
|
||||
|
||||
|
||||
@@ -36,23 +36,23 @@ struct COGDEBUG_API FCogDebugLog
|
||||
|
||||
static void SetLogCategoryActive(FLogCategoryBase& LogCategory, bool Value);
|
||||
|
||||
static FLogCategoryBase* FindLogCategory(FName LogCategory);
|
||||
static FLogCategoryBase* FindLogCategory(FName CategoryName);
|
||||
|
||||
static FCogDebugLogCategoryInfo* FindLogCategoryInfo(FName LogCategory);
|
||||
static FCogDebugLogCategoryInfo* FindLogCategoryInfo(FName CategoryName);
|
||||
|
||||
static TMap<FName, FCogDebugLogCategoryInfo>& GetLogCategories() { return LogCategories; }
|
||||
|
||||
static void SetServerVerbosityActive(UWorld& World, FName LogCategory, bool Value);
|
||||
static void SetServerVerbosityActive(UWorld& World, FName CategoryName, bool Value);
|
||||
|
||||
static bool IsServerVerbosityActive(FName LogCategory);
|
||||
static bool IsServerVerbosityActive(FName CategoryName);
|
||||
|
||||
static ELogVerbosity::Type GetServerVerbosity(FName LogCategory);
|
||||
static ELogVerbosity::Type GetServerVerbosity(FName CategoryName);
|
||||
|
||||
static void SetServerVerbosity(UWorld& World, FName LogCategory, ELogVerbosity::Type Verbosity);
|
||||
static void SetServerVerbosity(UWorld& World, FName CategoryName, ELogVerbosity::Type Verbosity);
|
||||
|
||||
static void OnServerVerbosityChanged(FName LogCategory, ELogVerbosity::Type Verbosity);
|
||||
static void OnServerVerbosityChanged(FName CategoryName, ELogVerbosity::Type Verbosity);
|
||||
|
||||
static void DeactivateAllLogCateories(UWorld& World);
|
||||
static void DeactivateAllLogCategories(UWorld& World);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -30,6 +30,6 @@ public:
|
||||
static void Log(const UObject* WorldContextObject, FCogLogCategory LogCategory, ECogLogVerbosity Verbosity = ECogLogVerbosity::Verbose, const FString& Text = FString(""));
|
||||
|
||||
UFUNCTION(BlueprintPure, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static bool IsLogActive(const UObject* WorldContextObject, FCogLogCategory LogCategory);
|
||||
static bool IsLogActive(const UObject* WorldContextObject, const FCogLogCategory LogCategory);
|
||||
|
||||
};
|
||||
@@ -4,13 +4,8 @@
|
||||
#include "CogDebugLog.h"
|
||||
#include "DetailWidgetRow.h"
|
||||
#include "Editor.h"
|
||||
#include "IPropertyUtilities.h"
|
||||
#include "Misc/TextFilter.h"
|
||||
#include "PropertyHandle.h"
|
||||
#include "SCogDebugLogCategoryWidget.h"
|
||||
#include "SlateOptMacros.h"
|
||||
#include "Widgets/Input/SSearchBox.h"
|
||||
#include "Widgets/Layout/SSeparator.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "AttributeDetailsCustomization"
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "CogDebugLogCategory.h"
|
||||
#include "ScopedTransaction.h"
|
||||
#include "SCogDebugLogCategoryWidget.h"
|
||||
#include "UObject/CoreRedirects.h"
|
||||
#include "UObject/UObjectIterator.h"
|
||||
#include "Widgets/SBoxPanel.h"
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ ACogEngineReplicator* ACogEngineReplicator::Spawn(APlayerController* Controller)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ACogEngineReplicator* ACogEngineReplicator::GetLocalReplicator(UWorld& World)
|
||||
ACogEngineReplicator* ACogEngineReplicator::GetLocalReplicator(const UWorld& World)
|
||||
{
|
||||
for (TActorIterator<ACogEngineReplicator> It(&World, ACogEngineReplicator::StaticClass()); It; ++It)
|
||||
for (TActorIterator<ACogEngineReplicator> It(&World, StaticClass()); It; ++It)
|
||||
{
|
||||
ACogEngineReplicator* Replicator = *It;
|
||||
return Replicator;
|
||||
@@ -42,9 +42,9 @@ ACogEngineReplicator* ACogEngineReplicator::GetLocalReplicator(UWorld& World)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogEngineReplicator::GetRemoteReplicators(UWorld& World, TArray<ACogEngineReplicator*>& Replicators)
|
||||
void ACogEngineReplicator::GetRemoteReplicators(const UWorld& World, TArray<ACogEngineReplicator*>& Replicators)
|
||||
{
|
||||
for (TActorIterator<ACogEngineReplicator> It(&World, ACogEngineReplicator::StaticClass()); It; ++It)
|
||||
for (TActorIterator<ACogEngineReplicator> It(&World, StaticClass()); It; ++It)
|
||||
{
|
||||
ACogEngineReplicator* Replicator = Cast<ACogEngineReplicator>(*It);
|
||||
Replicators.Add(Replicator);
|
||||
@@ -73,7 +73,7 @@ void ACogEngineReplicator::BeginPlay()
|
||||
|
||||
Super::BeginPlay();
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
const UWorld* World = GetWorld();
|
||||
check(World);
|
||||
const ENetMode NetMode = World->GetNetMode();
|
||||
bHasAuthority = NetMode != NM_Client;
|
||||
@@ -114,7 +114,7 @@ void ACogEngineReplicator::Server_Spawn_Implementation(const FCogEngineSpawnEntr
|
||||
else
|
||||
{
|
||||
FTransform Transform(FTransform::Identity);
|
||||
if (APawn* Pawn = GetPlayerController()->GetPawn())
|
||||
if (const APawn* Pawn = GetPlayerController()->GetPawn())
|
||||
{
|
||||
Transform = Pawn->GetTransform();
|
||||
Transform.SetLocation(Transform.GetLocation() + Transform.GetUnitAxis(EAxis::X) * 200.0f);
|
||||
@@ -165,11 +165,11 @@ void ACogEngineReplicator::Server_SetTimeDilation_Implementation(float Value)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogEngineReplicator::OnRep_TimeDilation()
|
||||
void ACogEngineReplicator::OnRep_TimeDilation() const
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
const UWorld* World = GetWorld();
|
||||
if (World == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ void FCogEngineWindow_CommandBindings::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
APlayerController* PlayerController = GetLocalPlayerController();
|
||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||
if (PlayerController == nullptr)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -90,7 +90,7 @@ void FCogEngineWindow_Inspector::RenderContent()
|
||||
return;
|
||||
}
|
||||
|
||||
FCogEngineInspectorApplyFunction ApplyFunction = FindObjectApplyFunction(InspectedObject.Get());
|
||||
const FCogEngineInspectorApplyFunction ApplyFunction = FindObjectApplyFunction(InspectedObject.Get());
|
||||
|
||||
ImGui::BeginChild("Inspector", ImVec2(-1, ApplyFunction != nullptr ? -ImGui::GetFrameHeightWithSpacing() : -1), false);
|
||||
|
||||
@@ -135,7 +135,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
|
||||
int32 NewHistoryIndex = INDEX_NONE;
|
||||
|
||||
//-----------------------------------
|
||||
// Backward / Foward
|
||||
// Backward / Forward
|
||||
//-----------------------------------
|
||||
{
|
||||
if (ImGui::ArrowButton("##Backward", ImGuiDir_Left))
|
||||
@@ -147,7 +147,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
|
||||
ImGui::SetTooltip("Backward");
|
||||
}
|
||||
|
||||
if (ImGui::ArrowButton("##Foward", ImGuiDir_Right))
|
||||
if (ImGui::ArrowButton("##Forward", ImGuiDir_Right))
|
||||
{
|
||||
NewHistoryIndex = FMath::Min(History.Num(), HistoryIndex + 1);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
|
||||
// Current Inspected Object
|
||||
//-----------------------------------
|
||||
const auto InspectedObjectName = StringCast<ANSICHAR>(*GetNameSafe(InspectedObject.Get()));
|
||||
ImVec2 Pos = ImGui::GetCursorScreenPos();
|
||||
const ImVec2 Pos = ImGui::GetCursorScreenPos();
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
|
||||
ImGui::SameLine();
|
||||
@@ -906,7 +906,7 @@ bool FCogEngineWindow_Inspector::RenderClass(const FClassProperty* ClassProperty
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogEngineWindow_Inspector::RenderInterface(const FInterfaceProperty* InterfaceProperty)
|
||||
{
|
||||
UClass* Class = InterfaceProperty->InterfaceClass;
|
||||
const UClass* Class = InterfaceProperty->InterfaceClass;
|
||||
if (Class == nullptr)
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
@@ -927,7 +927,7 @@ bool FCogEngineWindow_Inspector::RenderInterface(const FInterfaceProperty* Inter
|
||||
bool FCogEngineWindow_Inspector::RenderArray(const FArrayProperty* ArrayProperty, uint8* PointerToValue, bool ShowChildren)
|
||||
{
|
||||
FScriptArrayHelper Helper(ArrayProperty, PointerToValue);
|
||||
int32 Num = Helper.Num();
|
||||
const int32 Num = Helper.Num();
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Text("%s [%d]", TCHAR_TO_ANSI(*ArrayProperty->Inner->GetClass()->GetName()), Num);
|
||||
@@ -963,8 +963,8 @@ bool FCogEngineWindow_Inspector::HasPropertyAnyChildren(const FProperty* Propert
|
||||
}
|
||||
else if (const FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Property))
|
||||
{
|
||||
FScriptArrayHelper Helper(ArrayProperty, PointerToValue);
|
||||
int32 Num = Helper.Num();
|
||||
const FScriptArrayHelper Helper(ArrayProperty, PointerToValue);
|
||||
const int32 Num = Helper.Num();
|
||||
if (Num == 0)
|
||||
{
|
||||
return false;
|
||||
@@ -978,7 +978,7 @@ bool FCogEngineWindow_Inspector::HasPropertyAnyChildren(const FProperty* Propert
|
||||
}
|
||||
else if (const FObjectProperty* ObjectProperty = CastField<FObjectProperty>(Property))
|
||||
{
|
||||
UObject* ReferencedObject = ObjectProperty->GetObjectPropertyValue(PointerToValue);
|
||||
const UObject* ReferencedObject = ObjectProperty->GetObjectPropertyValue(PointerToValue);
|
||||
if (ReferencedObject == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -34,7 +34,7 @@ void FCogEngineWindow_LogCategories::ResetConfig()
|
||||
{
|
||||
Super::ResetConfig();
|
||||
|
||||
FCogDebugLog::DeactivateAllLogCateories(*GetWorld());
|
||||
FCogDebugLog::DeactivateAllLogCategories(*GetWorld());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -56,7 +56,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
{
|
||||
if (ImGui::MenuItem("Deactivate All"))
|
||||
{
|
||||
FCogDebugLog::DeactivateAllLogCateories(*World);
|
||||
FCogDebugLog::DeactivateAllLogCategories(*World);
|
||||
}
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
@@ -103,6 +103,12 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
if (FCogDebugLog::GetLogCategories().Num() == 0)
|
||||
{
|
||||
ImGui::Text("No log categories have been added.");
|
||||
return;
|
||||
}
|
||||
|
||||
const bool IsClient = World->GetNetMode() == NM_Client;
|
||||
|
||||
ImGuiStyle& Style = ImGui::GetStyle();
|
||||
@@ -110,7 +116,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
int Index = 0;
|
||||
for (const auto& Entry : FCogDebugLog::GetLogCategories())
|
||||
{
|
||||
FName CategoryName = Entry.Key;
|
||||
const FName CategoryName = Entry.Key;
|
||||
const FCogDebugLogCategoryInfo& CategoryInfo = Entry.Value;
|
||||
if (CategoryInfo.bVisible == false)
|
||||
{
|
||||
@@ -128,7 +134,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
const bool IsControlDown = ImGui::GetIO().KeyCtrl;
|
||||
if (IsClient)
|
||||
{
|
||||
ELogVerbosity::Type Verbosity = FCogDebugLog::GetServerVerbosity(CategoryName);
|
||||
const ELogVerbosity::Type Verbosity = FCogDebugLog::GetServerVerbosity(CategoryName);
|
||||
bool IsActive = FCogDebugLog::IsVerbosityActive(Verbosity);
|
||||
|
||||
if (Verbosity == ELogVerbosity::VeryVerbose)
|
||||
@@ -169,7 +175,7 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
}
|
||||
|
||||
{
|
||||
ELogVerbosity::Type Verbosity = Category->GetVerbosity();
|
||||
const ELogVerbosity::Type Verbosity = Category->GetVerbosity();
|
||||
bool IsActive = FCogDebugLog::IsVerbosityActive(Verbosity);
|
||||
|
||||
if (Verbosity == ELogVerbosity::VeryVerbose)
|
||||
@@ -214,14 +220,14 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
{
|
||||
if (IsClient)
|
||||
{
|
||||
ELogVerbosity::Type CurrentVerbosity = FCogDebugLog::GetServerVerbosity(CategoryName);
|
||||
const ELogVerbosity::Type CurrentVerbosity = FCogDebugLog::GetServerVerbosity(CategoryName);
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("##Server", FCogDebugHelper::VerbosityToString(CurrentVerbosity)))
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
{
|
||||
bool IsSelected = i == (int32)CurrentVerbosity;
|
||||
ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
const bool IsSelected = i == (int32)CurrentVerbosity;
|
||||
const ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
@@ -244,14 +250,14 @@ void FCogEngineWindow_LogCategories::RenderContent()
|
||||
}
|
||||
|
||||
{
|
||||
ELogVerbosity::Type CurrentVerbosity = Category->GetVerbosity();
|
||||
const ELogVerbosity::Type CurrentVerbosity = Category->GetVerbosity();
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("##Local", FCogDebugHelper::VerbosityToString(CurrentVerbosity)))
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
{
|
||||
bool IsSelected = i == (int32)CurrentVerbosity;
|
||||
ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
const bool IsSelected = i == (int32)CurrentVerbosity;
|
||||
const ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "CogEngineWindow_Metrics.h"
|
||||
|
||||
#include "CogDebugMetric.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui.h"
|
||||
#include "Engine/World.h"
|
||||
@@ -63,9 +62,7 @@ void FCogEngineWindow_Metrics::RenderContent()
|
||||
{
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
{
|
||||
bool bSettingModified = false;
|
||||
|
||||
FCogWindowWidgets::PushStyleCompact();
|
||||
FCogWindowWidgets::PushStyleCompact();
|
||||
ImGui::DragFloat("Auto Restart Delay", &FCogDebugMetric::RestartDelaySetting, 0.1f, 0.0f, FLT_MAX, "%0.1f");
|
||||
FCogWindowWidgets::PopStyleCompact();
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "Engine/Engine.h"
|
||||
#include "Misc/StringBuilder.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// UCogEngineWindow_OutputLog
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_OutputLog::Initialize()
|
||||
{
|
||||
@@ -67,7 +65,7 @@ void FCogEngineWindow_OutputLog::AddLog(const TCHAR* Message, ELogVerbosity::Typ
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_OutputLog::DrawRow(const char* BufferStart, const FLineInfo& LineInfo, bool IsTableShown)
|
||||
void FCogEngineWindow_OutputLog::DrawRow(const char* BufferStart, const FLineInfo& LineInfo, bool IsTableShown) const
|
||||
{
|
||||
ImU32 Color;
|
||||
switch (LineInfo.Verbosity)
|
||||
@@ -175,8 +173,8 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
||||
{
|
||||
for (int32 i = (int32)ELogVerbosity::Error; i <= (int32)ELogVerbosity::VeryVerbose; ++i)
|
||||
{
|
||||
bool IsSelected = i == Config->VerbosityFilter;
|
||||
ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
const bool IsSelected = i == Config->VerbosityFilter;
|
||||
const ELogVerbosity::Type Verbosity = (ELogVerbosity::Type)i;
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
@@ -316,7 +314,7 @@ FCogLogOutputDevice::~FCogLogOutputDevice()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogLogOutputDevice::Serialize(const TCHAR* Message, ELogVerbosity::Type Verbosity, const class FName& Category)
|
||||
void FCogLogOutputDevice::Serialize(const TCHAR* Message, const ELogVerbosity::Type Verbosity, const FName& Category)
|
||||
{
|
||||
if (OutputLog != nullptr)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "CogEngineWindow_Plots.h"
|
||||
|
||||
#include "CogDebugPlot.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Engine/World.h"
|
||||
#include "imgui.h"
|
||||
#include "implot_internal.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::Initialize()
|
||||
@@ -169,7 +167,7 @@ void FCogEngineWindow_Plots::RenderPlotsList(TArray<FCogDebugPlotEntry*>& Visibl
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots)
|
||||
void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots) const
|
||||
{
|
||||
if (ImGui::BeginChild("Graph", ImVec2(0, -1)))
|
||||
{
|
||||
@@ -186,14 +184,14 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
|
||||
ImPlotAxisFlags HasPlotOnAxisY2 = false;
|
||||
ImPlotAxisFlags HasPlotOnAxisY3 = false;
|
||||
|
||||
for (FCogDebugPlotEntry* PlotPtr : VisiblePlots)
|
||||
for (const FCogDebugPlotEntry* PlotPtr : VisiblePlots)
|
||||
{
|
||||
HasPlotOnAxisY1 |= PlotPtr->CurrentYAxis == ImAxis_Y1 && PlotPtr->CurrentRow == PlotIndex;
|
||||
HasPlotOnAxisY2 |= PlotPtr->CurrentYAxis == ImAxis_Y2 && PlotPtr->CurrentRow == PlotIndex;
|
||||
HasPlotOnAxisY3 |= PlotPtr->CurrentYAxis == ImAxis_Y3 && PlotPtr->CurrentRow == PlotIndex;
|
||||
}
|
||||
|
||||
ImPlot::SetupAxis(ImAxis_X1, NULL, ImPlotAxisFlags_NoTickLabels | ImPlotAxisFlags_NoGridLines);
|
||||
ImPlot::SetupAxis(ImAxis_X1, nullptr, ImPlotAxisFlags_NoTickLabels | ImPlotAxisFlags_NoGridLines);
|
||||
ImPlot::SetupAxis(ImAxis_Y1, HasPlotOnAxisY1 ? "" : "[drop here]", (HasPlotOnAxisY1 ? ImPlotAxisFlags_None : (ImPlotAxisFlags_NoTickLabels | ImPlotAxisFlags_NoGridLines)) | ImPlotAxisFlags_AutoFit);
|
||||
ImPlot::SetupAxis(ImAxis_Y2, HasPlotOnAxisY2 ? "" : "[drop here]", (HasPlotOnAxisY2 ? ImPlotAxisFlags_None : (ImPlotAxisFlags_NoTickLabels | ImPlotAxisFlags_NoGridLines)) | ImPlotAxisFlags_AutoFit | ImPlotAxisFlags_Opposite);
|
||||
ImPlot::SetupAxis(ImAxis_Y3, HasPlotOnAxisY3 ? "" : "[drop here]", (HasPlotOnAxisY3 ? ImPlotAxisFlags_None : (ImPlotAxisFlags_NoTickLabels | ImPlotAxisFlags_NoGridLines)) | ImPlotAxisFlags_AutoFit | ImPlotAxisFlags_Opposite);
|
||||
@@ -259,7 +257,7 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
|
||||
&& Mouse.y < PlotMax.y
|
||||
&& ImGui::GetDragDropPayload() == nullptr)
|
||||
{
|
||||
ImVec2 Drag = ImGui::GetMouseDragDelta(0);
|
||||
const ImVec2 Drag = ImGui::GetMouseDragDelta(0);
|
||||
if (FMath::Abs(Drag.x) > 10)
|
||||
{
|
||||
FCogDebugPlot::Pause = true;
|
||||
@@ -354,7 +352,7 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::RenderTimeMarker()
|
||||
void FCogEngineWindow_Plots::RenderTimeMarker() const
|
||||
{
|
||||
const ImVec2 PlotMin = ImPlot::GetPlotPos();
|
||||
const ImVec2 PlotSize = ImPlot::GetPlotSize();
|
||||
@@ -410,7 +408,7 @@ void FCogEngineWindow_Plots::RenderValues(FCogDebugPlotEntry& Entry, const char*
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Plots::RenderEvents(FCogDebugPlotEntry& Entry, const char* Label, const ImVec2& PlotMin, const ImVec2& PlotMax)
|
||||
void FCogEngineWindow_Plots::RenderEvents(FCogDebugPlotEntry& Entry, const char* Label, const ImVec2& PlotMin, const ImVec2& PlotMax) const
|
||||
{
|
||||
const ImVec2 Mouse = ImGui::GetMousePos();
|
||||
ImDrawList* PlotDrawList = ImPlot::GetPlotDrawList();
|
||||
@@ -444,7 +442,7 @@ void FCogEngineWindow_Plots::RenderEvents(FCogDebugPlotEntry& Entry, const char*
|
||||
const bool IsInstant = Event.StartTime == Event.EndTime;
|
||||
if (IsInstant)
|
||||
{
|
||||
const float Radius = 10.0f;
|
||||
constexpr float Radius = 10.0f;
|
||||
PlotDrawList->AddNgon(PosMid, 10, Event.BorderColor, 4);
|
||||
PlotDrawList->AddNgonFilled(PosMid, 10, Event.FillColor, 4);
|
||||
PlotDrawList->AddText(ImVec2(PosMid.x + 15, PosMid.y - 6), IM_COL32(255, 255, 255, 255), TCHAR_TO_ANSI(*Event.DisplayName));
|
||||
@@ -461,7 +459,7 @@ void FCogEngineWindow_Plots::RenderEvents(FCogDebugPlotEntry& Entry, const char*
|
||||
const ImVec2 Min = ImVec2(PosBot.x, PosBot.y);
|
||||
const ImVec2 Max = ImVec2(PosEnd.x, PosTop.y);
|
||||
|
||||
ImDrawFlags Flags = Event.EndTime == 0.0f ? ImDrawFlags_RoundCornersLeft : ImDrawFlags_RoundCornersAll;
|
||||
const ImDrawFlags Flags = Event.EndTime == 0.0f ? ImDrawFlags_RoundCornersLeft : ImDrawFlags_RoundCornersAll;
|
||||
PlotDrawList->AddRect(Min, Max, Event.BorderColor, 6.0f, Flags);
|
||||
PlotDrawList->AddRectFilled(Min, Max, Event.FillColor, 6.0f, Flags);
|
||||
PlotDrawList->PushClipRect(ImMax(Min, PlotMin), ImMin(Max, PlotMax));
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#include "CogEngineWindow_Scalability.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Scalability.h"
|
||||
|
||||
|
||||
#define SCALABILITY_NUM_LEVELS 5
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Scalability::RenderHelp()
|
||||
{
|
||||
@@ -24,7 +21,7 @@ void FCogEngineWindow_Scalability::RenderContent()
|
||||
Super::RenderContent();
|
||||
|
||||
Scalability::FQualityLevels Levels = Scalability::GetQualityLevels();
|
||||
FString CurrentQualityName = Scalability::GetQualityLevelText(Levels.GetMinQualityLevel(), SCALABILITY_NUM_LEVELS).ToString();
|
||||
const FString CurrentQualityName = Scalability::GetQualityLevelText(Levels.GetMinQualityLevel(), SCALABILITY_NUM_LEVELS).ToString();
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
if (ImGui::BeginCombo("Scalability", TCHAR_TO_ANSI(*CurrentQualityName)))
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "CogEngineReplicator.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "CogImguiModule.h"
|
||||
#include "CogWindowManager.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Components/PrimitiveComponent.h"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "CogDebug.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Components/LineBatchComponent.h"
|
||||
#include "Components/SkeletalMeshComponent.h"
|
||||
#include "DrawDebugHelpers.h"
|
||||
#include "Engine/SkeletalMesh.h"
|
||||
|
||||
@@ -31,7 +31,7 @@ void FCogEngineWindow_Slate::RenderContent()
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
if (ImGui::BeginCombo("##User", TCHAR_TO_ANSI(*FString::Printf(TEXT("%d"), SelectedUserIndex))))
|
||||
{
|
||||
SlateApp.ForEachUser([this](FSlateUser& User)
|
||||
SlateApp.ForEachUser([this](const FSlateUser& User)
|
||||
{
|
||||
if (ImGui::Selectable(TCHAR_TO_ANSI(*FString::Printf(TEXT("%d"), SelectedUserIndex)), false))
|
||||
{
|
||||
@@ -41,7 +41,7 @@ void FCogEngineWindow_Slate::RenderContent()
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (TSharedPtr<FSlateUser> User = SlateApp.GetUser(SelectedUserIndex))
|
||||
if (const TSharedPtr<FSlateUser> User = SlateApp.GetUser(SelectedUserIndex))
|
||||
{
|
||||
RenderUser(*User.Get());
|
||||
}
|
||||
@@ -54,7 +54,7 @@ void FCogEngineWindow_Slate::RenderUser(FSlateUser& User)
|
||||
|
||||
if (ImGui::BeginTable("SlateUser", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
const ImVec4 LabelColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
constexpr ImVec4 LabelColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
ImGui::TableSetupColumn("Property");
|
||||
ImGui::TableSetupColumn("Value");
|
||||
@@ -68,7 +68,7 @@ void FCogEngineWindow_Slate::RenderUser(FSlateUser& User)
|
||||
ImGui::TextColored(LabelColor, "Focused Widget");
|
||||
ImGui::TableNextColumn();
|
||||
FString FocusedWidgetText = "None";
|
||||
if (TSharedPtr<SWidget> FocusedWidget = User.GetFocusedWidget())
|
||||
if (const TSharedPtr<SWidget> FocusedWidget = User.GetFocusedWidget())
|
||||
{
|
||||
FocusedWidgetText = FocusedWidget->ToString();
|
||||
}
|
||||
@@ -81,12 +81,12 @@ void FCogEngineWindow_Slate::RenderUser(FSlateUser& User)
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(LabelColor, "Cursor Captor");
|
||||
ImGui::TableNextColumn();
|
||||
FString CursorCaptoreWidgetText = "None";
|
||||
if (TSharedPtr<SWidget> CursorCaptoreWidget = User.GetCursorCaptor())
|
||||
FString CursorCaptorWidgetText = "None";
|
||||
if (const TSharedPtr<SWidget> CursorCaptorWidget = User.GetCursorCaptor())
|
||||
{
|
||||
CursorCaptoreWidgetText = CursorCaptoreWidget->ToString();
|
||||
CursorCaptorWidgetText = CursorCaptorWidget->ToString();
|
||||
}
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*CursorCaptoreWidgetText));
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*CursorCaptorWidgetText));
|
||||
|
||||
//------------------------
|
||||
// Cursor Position
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "CogEngineDataAsset.h"
|
||||
#include "CogEngineReplicator.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -31,27 +30,40 @@ void FCogEngineWindow_Spawns::RenderContent()
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid Asset");
|
||||
return;
|
||||
}
|
||||
|
||||
ACogEngineReplicator* Replicator = ACogEngineReplicator::GetLocalReplicator(*GetWorld());
|
||||
if (Replicator == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid Replicator");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Asset->SpawnGroups.Num() == 0)
|
||||
{
|
||||
ImGui::TextDisabled("No spawn group have been defined");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const FCogEngineSpawnGroup& SpawnGroup : Asset->SpawnGroups)
|
||||
{
|
||||
RenderSpawnGroup(SpawnGroup);
|
||||
RenderSpawnGroup(*Replicator, SpawnGroup);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Spawns::RenderSpawnGroup(const FCogEngineSpawnGroup& SpawnGroup)
|
||||
void FCogEngineWindow_Spawns::RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup)
|
||||
{
|
||||
int32 GroupIndex = 0;
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79));
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(66, 66, 66, 79));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(62, 62, 62, 204));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, IM_COL32(86, 86, 86, 255));
|
||||
|
||||
if (ImGui::CollapsingHeader(TCHAR_TO_ANSI(*SpawnGroup.Name), ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::PushID(GroupIndex);
|
||||
int32 GroupIndex = 0;
|
||||
ImGui::PushID(GroupIndex);
|
||||
|
||||
const bool PushColor = (SpawnGroup.Color != FColor::Transparent);
|
||||
if (PushColor)
|
||||
@@ -64,7 +76,7 @@ void FCogEngineWindow_Spawns::RenderSpawnGroup(const FCogEngineSpawnGroup& Spawn
|
||||
|
||||
for (const FCogEngineSpawnEntry& SpawnEntry : SpawnGroup.Spawns)
|
||||
{
|
||||
if (RenderSpawnAsset(SpawnEntry, SelectedAssetIndex == GroupIndex))
|
||||
if (RenderSpawnAsset(Replicator, SpawnEntry, SelectedAssetIndex == GroupIndex))
|
||||
{
|
||||
SelectedAssetIndex = AssetIndex;
|
||||
}
|
||||
@@ -85,7 +97,7 @@ void FCogEngineWindow_Spawns::RenderSpawnGroup(const FCogEngineSpawnGroup& Spawn
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogEngineWindow_Spawns::RenderSpawnAsset(const FCogEngineSpawnEntry& SpawnEntry, bool IsLastSelected)
|
||||
bool FCogEngineWindow_Spawns::RenderSpawnAsset(ACogEngineReplicator& Replicator, const FCogEngineSpawnEntry& SpawnEntry, bool IsLastSelected)
|
||||
{
|
||||
bool IsPressed = false;
|
||||
|
||||
@@ -104,10 +116,8 @@ bool FCogEngineWindow_Spawns::RenderSpawnAsset(const FCogEngineSpawnEntry& Spawn
|
||||
|
||||
if (ImGui::Button(TCHAR_TO_ANSI(*EntryName), ImVec2(-1, 0)))
|
||||
{
|
||||
if (ACogEngineReplicator* Replicator = ACogEngineReplicator::GetLocalReplicator(*GetWorld()))
|
||||
{
|
||||
Replicator->Server_Spawn(SpawnEntry);
|
||||
}
|
||||
IsPressed = true;
|
||||
Replicator.Server_Spawn(SpawnEntry);
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(1);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "GameFramework/Controller.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include "Net/NetPing.h"
|
||||
|
||||
ImVec4 StatRedColor(1.0f, 0.4f, 0.3f, 1.0f);
|
||||
ImVec4 StatOrangeColor(1.0f, 0.7f, 0.4f, 1.0f);
|
||||
@@ -49,7 +48,7 @@ void FCogEngineWindow_Stats::RenderContent()
|
||||
ImGui::TextColored(GetPingColor(Ping), "%0.0fms", Ping);
|
||||
}
|
||||
|
||||
if (UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||
if (const UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||
{
|
||||
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||
ImGui::Text("Packet Loss Out ");
|
||||
@@ -65,12 +64,12 @@ void FCogEngineWindow_Stats::RenderContent()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
float FCogEngineWindow_Stats::GetMainMenuWidgetWidth(int32 WidgetIndex, float MaxWidth)
|
||||
float FCogEngineWindow_Stats::GetMainMenuWidgetWidth(const int32 SubWidgetIndex, float MaxWidth)
|
||||
{
|
||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||
const UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
||||
|
||||
switch (WidgetIndex)
|
||||
switch (SubWidgetIndex)
|
||||
{
|
||||
case 0: return FCogWindowWidgets::GetFontWidth() * 8;
|
||||
case 1: return Connection != nullptr ? FCogWindowWidgets::GetFontWidth() * 7 : 0.0f;
|
||||
@@ -81,9 +80,9 @@ float FCogEngineWindow_Stats::GetMainMenuWidgetWidth(int32 WidgetIndex, float Ma
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidget(int32 WidgetIndex, float Width)
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidget(const int32 SubWidgetIndex, const float Width)
|
||||
{
|
||||
switch (WidgetIndex)
|
||||
switch (SubWidgetIndex)
|
||||
{
|
||||
case 0: RenderMainMenuWidgetFramerate(Width); break;
|
||||
case 1: RenderMainMenuWidgetPing(Width); break;
|
||||
@@ -92,10 +91,10 @@ void FCogEngineWindow_Stats::RenderMainMenuWidget(int32 WidgetIndex, float Width
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetFramerate(float Width)
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetFramerate(const float Width)
|
||||
{
|
||||
extern ENGINE_API float GAverageFPS;
|
||||
int32 Fps = (int32)GAverageFPS;
|
||||
const int32 Fps = (int32)GAverageFPS;
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
|
||||
@@ -129,7 +128,7 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetFramerate(float Width)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetPing(float Width)
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetPing(const float Width)
|
||||
{
|
||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||
const APlayerState* PlayerState = PlayerController != nullptr ? PlayerController->GetPlayerState<APlayerState>() : nullptr;
|
||||
@@ -164,7 +163,7 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetPing(float Width)
|
||||
ImGui::Text("Ping");
|
||||
ImGui::SameLine();
|
||||
|
||||
FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
||||
const FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
||||
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
||||
TArray<int32> Values{ 0, 50, 100, 200, 500, 1000 };
|
||||
if (FCogWindowWidgets::MultiChoiceButtonsInt(Values, Settings.PktIncomingLagMin, ImVec2(4.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
||||
@@ -178,10 +177,10 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetPing(float Width)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss(float Width)
|
||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss(const float Width)
|
||||
{
|
||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||
UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
||||
const UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
||||
if (Connection == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -216,7 +215,7 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss(float Width)
|
||||
ImGui::Text("Packet Loss");
|
||||
ImGui::SameLine();
|
||||
|
||||
FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
||||
const FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
||||
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
||||
|
||||
TArray<int32> Values{ 0, 5, 10, 20, 30, 40, 50 };
|
||||
@@ -232,7 +231,7 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss(float Width)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec4 FCogEngineWindow_Stats::GetFpsColor(float Value, float Good /*= 50.0f*/, float Medium /*= 30.0f*/)
|
||||
ImVec4 FCogEngineWindow_Stats::GetFpsColor(const float Value, const float Good /*= 50.0f*/, const float Medium /*= 30.0f*/)
|
||||
{
|
||||
if (Value > Good)
|
||||
{
|
||||
@@ -248,7 +247,7 @@ ImVec4 FCogEngineWindow_Stats::GetFpsColor(float Value, float Good /*= 50.0f*/,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec4 FCogEngineWindow_Stats::GetPingColor(float Value, float Good /*= 100.0f*/, float Medium /*= 200.0f*/)
|
||||
ImVec4 FCogEngineWindow_Stats::GetPingColor(const float Value, const float Good /*= 100.0f*/, const float Medium /*= 200.0f*/)
|
||||
{
|
||||
if (Value > Medium)
|
||||
{
|
||||
@@ -264,7 +263,7 @@ ImVec4 FCogEngineWindow_Stats::GetPingColor(float Value, float Good /*= 100.0f*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ImVec4 FCogEngineWindow_Stats::GetPacketLossColor(float Value, float Good /*= 10.0f*/, float Medium /*= 20.0f*/)
|
||||
ImVec4 FCogEngineWindow_Stats::GetPacketLossColor(const float Value, const float Good /*= 10.0f*/, const float Medium /*= 20.0f*/)
|
||||
{
|
||||
if (Value > Medium)
|
||||
{
|
||||
|
||||
@@ -34,19 +34,13 @@ void FCogEngineWindow_TimeScale::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ACogEngineReplicator* Replicator = ACogEngineReplicator::GetLocalReplicator(*World);
|
||||
ACogEngineReplicator* Replicator = ACogEngineReplicator::GetLocalReplicator(*GetWorld());
|
||||
if (Replicator == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid Replicator");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float Value = Replicator->GetTimeDilation();
|
||||
if (FCogWindowWidgets::MultiChoiceButtonsFloat(TimingScales, Value, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
||||
{
|
||||
|
||||
@@ -22,9 +22,9 @@ public:
|
||||
|
||||
static ACogEngineReplicator* Spawn(APlayerController* Controller);
|
||||
|
||||
static ACogEngineReplicator* GetLocalReplicator(UWorld& World);
|
||||
static ACogEngineReplicator* GetLocalReplicator(const UWorld& World);
|
||||
|
||||
static void GetRemoteReplicators(UWorld& World, TArray<ACogEngineReplicator*>& Replicators);
|
||||
static void GetRemoteReplicators(const UWorld& World, TArray<ACogEngineReplicator*>& Replicators);
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
void Server_SetTimeDilation(float Value);
|
||||
|
||||
UFUNCTION()
|
||||
void OnRep_TimeDilation();
|
||||
void OnRep_TimeDilation() const;
|
||||
|
||||
TObjectPtr<APlayerController> OwnerPlayerController;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ private:
|
||||
FName Category;
|
||||
};
|
||||
|
||||
void DrawRow(const char* BufferStart, const FLineInfo& Info, bool IsTableShown);
|
||||
void DrawRow(const char* BufferStart, const FLineInfo& Info, bool IsTableShown) const;
|
||||
|
||||
ImGuiTextBuffer TextBuffer;
|
||||
|
||||
|
||||
@@ -25,20 +25,20 @@ protected:
|
||||
virtual void RenderTick(float DeltaTime) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
void RenderPlotsList(TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
||||
|
||||
void RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
||||
static void RenderPlotsList(TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
||||
|
||||
void RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots) const;
|
||||
|
||||
void RenderMenu();
|
||||
|
||||
void RenderTimeMarker();
|
||||
void RenderTimeMarker() const;
|
||||
|
||||
void RenderValues(FCogDebugPlotEntry& Entry, const char* Label);
|
||||
static void RenderValues(FCogDebugPlotEntry& Entry, const char* Label);
|
||||
|
||||
void RenderEvents(FCogDebugPlotEntry& Entry, const char* Label, const ImVec2& PlotMin, const ImVec2& PlotMax);
|
||||
void RenderEvents(FCogDebugPlotEntry& Entry, const char* Label, const ImVec2& PlotMin, const ImVec2& PlotMax) const;
|
||||
|
||||
void RenderEventTooltip(const FCogDebugPlotEvent* HoveredEvent, FCogDebugPlotEntry& Entry);
|
||||
static void RenderEventTooltip(const FCogDebugPlotEvent* HoveredEvent, FCogDebugPlotEntry& Entry);
|
||||
|
||||
TObjectPtr<UCogEngineConfig_Plots> Config = nullptr;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogEngineReplicator.h"
|
||||
#include "CogWindow.h"
|
||||
|
||||
class UCogEngineDataAsset;
|
||||
@@ -21,9 +22,9 @@ protected:
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void RenderSpawnGroup(const FCogEngineSpawnGroup& SpawnGroup);
|
||||
virtual void RenderSpawnGroup(ACogEngineReplicator& Replicator, const FCogEngineSpawnGroup& SpawnGroup);
|
||||
|
||||
virtual bool RenderSpawnAsset(const FCogEngineSpawnEntry& SpawnEntry, bool IsLastSelected);
|
||||
virtual bool RenderSpawnAsset(ACogEngineReplicator& Replicator, const FCogEngineSpawnEntry& SpawnEntry, bool IsLastSelected);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "CogImguiWidget.h"
|
||||
#include "CogImguiContext.h"
|
||||
#include "GameFramework/PlayerInput.h"
|
||||
#include "imgui.h"
|
||||
#include "Framework/Application/SlateApplication.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "Application/ThrottleManager.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "CogImGuiInputProcessor.h"
|
||||
#include "CogImguiWidget.h"
|
||||
#include "Engine/Console.h"
|
||||
#include "Engine/Engine.h"
|
||||
@@ -327,7 +326,7 @@ void FCogImguiContext::ImGui_CreateWindow(ImGuiViewport* Viewport)
|
||||
return;
|
||||
}
|
||||
|
||||
FCogImguiContext* Context = ParentViewportData->Context.Get();
|
||||
FCogImguiContext* Context = ParentViewportData->Context;
|
||||
|
||||
const bool bTooltipWindow = (Viewport->Flags & ImGuiViewportFlags_TopMost);
|
||||
const bool bPopupWindow = (Viewport->Flags & ImGuiViewportFlags_NoTaskBarIcon);
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
|
||||
#include "CogImGuiInputProcessor.h"
|
||||
#include "CogImguiKeyInfo.h"
|
||||
#include "CogImguiModule.h"
|
||||
#include "Engine/World.h"
|
||||
#include "Framework/Application/SlateApplication.h"
|
||||
#include "Framework/Commands/UICommandInfo.h"
|
||||
#include "GameFramework/GameUserSettings.h"
|
||||
#include "GameFramework/InputSettings.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "GameFramework/PlayerInput.h"
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "CogImguiContext.h"
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "CogImguiModule.h"
|
||||
#include "CogImguiWidget.h"
|
||||
#include "Engine/GameViewportClient.h"
|
||||
#include "imgui.h"
|
||||
#include "SlateOptMacros.h"
|
||||
@@ -39,12 +37,12 @@ void SCogImguiWidget::Tick(const FGeometry& AllottedGeometry, const double InCur
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
int32 SCogImguiWidget::OnPaint(
|
||||
const FPaintArgs& Args,
|
||||
const FGeometry& AllottedGeometry,
|
||||
const FPaintArgs& Args,
|
||||
const FGeometry& AllottedGeometry,
|
||||
const FSlateRect& MyClippingRect,
|
||||
FSlateWindowElementList& OutDrawElements,
|
||||
int32 LayerId,
|
||||
const FWidgetStyle& WidgetStyle,
|
||||
FSlateWindowElementList& OutDrawElements,
|
||||
int32 LayerId,
|
||||
const FWidgetStyle& WidgetStyle,
|
||||
bool bParentEnabled) const
|
||||
{
|
||||
|
||||
@@ -180,7 +178,7 @@ FReply SCogImguiWidget::OnAnalogValueChanged(const FGeometry& MyGeometry, const
|
||||
// return FReply::Unhandled();
|
||||
//}
|
||||
|
||||
return FReply::Unhandled();
|
||||
return FReply::Unhandled();
|
||||
}
|
||||
|
||||
return FReply::Handled();
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
|
||||
void AddMousePosEvent(const FVector2D& MousePosition) const;
|
||||
|
||||
TObjectPtr<FCogImguiContext> Context = nullptr;
|
||||
FCogImguiContext* Context = nullptr;
|
||||
|
||||
TObjectPtr<UPlayerInput> PlayerInput;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct ImPlotContext;
|
||||
struct COGIMGUI_API FImGuiViewportData
|
||||
{
|
||||
TWeakPtr<SWindow> Window = nullptr;
|
||||
TObjectPtr<FCogImguiContext> Context = nullptr;
|
||||
FCogImguiContext* Context = nullptr;
|
||||
TWeakPtr<SCogImguiWidget> Widget = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class COGIMGUI_API SCogImguiWidget : public SLeafWidget
|
||||
public:
|
||||
|
||||
SLATE_BEGIN_ARGS(SCogImguiWidget) {}
|
||||
SLATE_ARGUMENT(FCogImguiContext*, Context)
|
||||
SLATE_ARGUMENT(FCogImguiContext*, Context)
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
|
||||
void RefreshVisibility();
|
||||
|
||||
TObjectPtr<FCogImguiContext> Context = nullptr;
|
||||
FCogImguiContext* Context = nullptr;
|
||||
|
||||
TSharedPtr<SWindow> Window = nullptr;
|
||||
|
||||
|
||||
@@ -160,9 +160,9 @@ void FCogWindow::SetSelection(AActor* NewSelection)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
APawn* FCogWindow::GetLocalPlayerPawn()
|
||||
APawn* FCogWindow::GetLocalPlayerPawn() const
|
||||
{
|
||||
APlayerController* LocalPlayerController = GetLocalPlayerController();
|
||||
const APlayerController* LocalPlayerController = GetLocalPlayerController();
|
||||
|
||||
if (LocalPlayerController == nullptr)
|
||||
{
|
||||
@@ -175,9 +175,9 @@ APawn* FCogWindow::GetLocalPlayerPawn()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
APlayerController* FCogWindow::GetLocalPlayerController()
|
||||
APlayerController* FCogWindow::GetLocalPlayerController() const
|
||||
{
|
||||
ULocalPlayer* LocalPlayer = GetLocalPlayer();
|
||||
const ULocalPlayer* LocalPlayer = GetLocalPlayer();
|
||||
if (LocalPlayer == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -187,7 +187,7 @@ APlayerController* FCogWindow::GetLocalPlayerController()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ULocalPlayer* FCogWindow::GetLocalPlayer()
|
||||
ULocalPlayer* FCogWindow::GetLocalPlayer() const
|
||||
{
|
||||
const UWorld* World = GetWorld();
|
||||
if (World == nullptr)
|
||||
@@ -199,13 +199,13 @@ ULocalPlayer* FCogWindow::GetLocalPlayer()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogWindowConfig* FCogWindow::GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass)
|
||||
UCogWindowConfig* FCogWindow::GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass) const
|
||||
{
|
||||
return GetOwner()->GetConfig(ConfigClass);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
const UObject* FCogWindow::GetAsset(const TSubclassOf<UObject> AssetClass)
|
||||
const UObject* FCogWindow::GetAsset(const TSubclassOf<UObject> AssetClass) const
|
||||
{
|
||||
return GetOwner()->GetAsset(AssetClass);
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ void UCogWindowManager::InitializeInternal()
|
||||
ImGuiSettingsHandler IniHandler;
|
||||
IniHandler.TypeName = "Cog";
|
||||
IniHandler.TypeHash = ImHashStr("Cog");
|
||||
IniHandler.ClearAllFn = UCogWindowManager::SettingsHandler_ClearAll;
|
||||
IniHandler.ReadOpenFn = UCogWindowManager::SettingsHandler_ReadOpen;
|
||||
IniHandler.ReadLineFn = UCogWindowManager::SettingsHandler_ReadLine;
|
||||
IniHandler.ApplyAllFn = UCogWindowManager::SettingsHandler_ApplyAll;
|
||||
IniHandler.WriteAllFn = UCogWindowManager::SettingsHandler_WriteAll;
|
||||
IniHandler.ClearAllFn = SettingsHandler_ClearAll;
|
||||
IniHandler.ReadOpenFn = SettingsHandler_ReadOpen;
|
||||
IniHandler.ReadLineFn = SettingsHandler_ReadLine;
|
||||
IniHandler.ApplyAllFn = SettingsHandler_ApplyAll;
|
||||
IniHandler.WriteAllFn = SettingsHandler_WriteAll;
|
||||
IniHandler.UserData = this;
|
||||
ImGui::AddSettingsHandler(&IniHandler);
|
||||
|
||||
@@ -142,7 +142,7 @@ void UCogWindowManager::Tick(float DeltaTime)
|
||||
|
||||
if (LayoutToLoad != -1)
|
||||
{
|
||||
FString Filename = FCogImguiHelper::GetIniFilePath(FString::Printf(TEXT("ImGui_Layout_%d"), LayoutToLoad));
|
||||
const FString Filename = FCogImguiHelper::GetIniFilePath(FString::Printf(TEXT("ImGui_Layout_%d"), LayoutToLoad));
|
||||
ImGui::LoadIniSettingsFromDisk(TCHAR_TO_ANSI(*Filename));
|
||||
LayoutToLoad = -1;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void UCogWindowManager::Render(float DeltaTime)
|
||||
ImGui::DockSpaceOverViewport(0, ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_NoDockingInCentralNode | ImGuiDockNodeFlags_AutoHideTabBar);
|
||||
ImGui::PopStyleColor(1);
|
||||
|
||||
bool bCompactSaved = SettingsWindow->GetSettingsConfig()->bCompactMode;
|
||||
const bool bCompactSaved = SettingsWindow->GetSettingsConfig()->bCompactMode;
|
||||
if (bCompactSaved)
|
||||
{
|
||||
FCogWindowWidgets::PushStyleCompact();
|
||||
@@ -204,7 +204,7 @@ void UCogWindowManager::Render(float DeltaTime)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::AddWindow(FCogWindow* Window, const FString& Name, bool AddToMainMenu /*= true*/)
|
||||
void UCogWindowManager::AddWindow(FCogWindow* Window, const FString& Name, const bool AddToMainMenu /*= true*/)
|
||||
{
|
||||
Window->SetFullName(Name);
|
||||
Window->SetOwner(this);
|
||||
@@ -227,7 +227,7 @@ void UCogWindowManager::AddWindow(FCogWindow* Window, const FString& Name, bool
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FCogWindow* UCogWindowManager::FindWindowByID(ImGuiID ID)
|
||||
FCogWindow* UCogWindowManager::FindWindowByID(const ImGuiID ID)
|
||||
{
|
||||
for (FCogWindow* Window : Windows)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ FCogWindow* UCogWindowManager::FindWindowByID(ImGuiID ID)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::SetHideAllWindows(bool Value)
|
||||
void UCogWindowManager::SetHideAllWindows(const bool Value)
|
||||
{
|
||||
HideAllWindowsCounter = FMath::Max(HideAllWindowsCounter + (Value ? +1 : -1), 0);
|
||||
bHideAllWindows = HideAllWindowsCounter > 0;
|
||||
@@ -249,7 +249,7 @@ void UCogWindowManager::SetHideAllWindows(bool Value)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::ResetLayout()
|
||||
{
|
||||
for (FCogWindow* Window : Windows)
|
||||
for (const FCogWindow* Window : Windows)
|
||||
{
|
||||
ImGui::SetWindowPos(TCHAR_TO_ANSI(*Window->GetName()), ImVec2(10, 10), ImGuiCond_Always);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ void UCogWindowManager::CloseAllWindows()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::LoadLayout(int32 LayoutIndex)
|
||||
void UCogWindowManager::LoadLayout(const int32 LayoutIndex)
|
||||
{
|
||||
for (FCogWindow* Window : Windows)
|
||||
{
|
||||
@@ -278,9 +278,9 @@ void UCogWindowManager::LoadLayout(int32 LayoutIndex)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::SaveLayout(int32 LayoutIndex)
|
||||
void UCogWindowManager::SaveLayout(const int32 LayoutIndex)
|
||||
{
|
||||
FString Filename = *FCogImguiHelper::GetIniFilePath(FString::Printf(TEXT("imgui_layout_%d"), LayoutIndex));
|
||||
const FString Filename = *FCogImguiHelper::GetIniFilePath(FString::Printf(TEXT("imgui_layout_%d"), LayoutIndex));
|
||||
ImGui::SaveIniSettingsToDisk(TCHAR_TO_ANSI(*Filename));
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ void UCogWindowManager::SortMainMenu()
|
||||
MainMenu.SubMenus.Empty();
|
||||
|
||||
TArray<FCogWindow*> SortedWindows = Windows;
|
||||
SortedWindows.Sort([](FCogWindow& Lhs, FCogWindow& Rhs) { return Lhs.GetFullName() < Rhs.GetFullName(); });
|
||||
SortedWindows.Sort([](const FCogWindow& Lhs, const FCogWindow& Rhs) { return Lhs.GetFullName() < Rhs.GetFullName(); });
|
||||
|
||||
for (FCogWindow* Window : SortedWindows)
|
||||
{
|
||||
@@ -307,12 +307,12 @@ UCogWindowManager::FMenu* UCogWindowManager::AddMenu(const FString& Name)
|
||||
TArray<FString> Path;
|
||||
Name.ParseIntoArray(Path, TEXT("."));
|
||||
|
||||
UCogWindowManager::FMenu* CurrentMenu = &MainMenu;
|
||||
FMenu* CurrentMenu = &MainMenu;
|
||||
for (int i = 0; i < Path.Num(); ++i)
|
||||
{
|
||||
FString MenuName = Path[i];
|
||||
|
||||
int SubMenuIndex = CurrentMenu->SubMenus.IndexOfByPredicate([&](const UCogWindowManager::FMenu& Menu) { return Menu.Name == MenuName; });
|
||||
int SubMenuIndex = CurrentMenu->SubMenus.IndexOfByPredicate([&](const FMenu& Menu) { return Menu.Name == MenuName; });
|
||||
if (SubMenuIndex != -1)
|
||||
{
|
||||
CurrentMenu = &CurrentMenu->SubMenus[SubMenuIndex];
|
||||
@@ -334,7 +334,7 @@ void UCogWindowManager::RenderMainMenu()
|
||||
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
for (UCogWindowManager::FMenu& Menu : MainMenu.SubMenus)
|
||||
for (FMenu& Menu : MainMenu.SubMenus)
|
||||
{
|
||||
RenderOptionMenu(Menu);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ void UCogWindowManager::RenderMainMenu()
|
||||
|
||||
if (ImGui::IsItemActive() && ImGui::IsItemHovered() == false)
|
||||
{
|
||||
int iNext = i + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1);
|
||||
const int iNext = i + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1);
|
||||
if (iNext >= 0 && iNext < Widgets.Num())
|
||||
{
|
||||
Widgets[i] = Widgets[iNext];
|
||||
@@ -480,7 +480,7 @@ void UCogWindowManager::RenderMainMenu()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::RenderOptionMenu(UCogWindowManager::FMenu& Menu)
|
||||
void UCogWindowManager::RenderOptionMenu(FMenu& Menu)
|
||||
{
|
||||
if (Menu.Window != nullptr)
|
||||
{
|
||||
@@ -490,7 +490,7 @@ void UCogWindowManager::RenderOptionMenu(UCogWindowManager::FMenu& Menu)
|
||||
{
|
||||
if (ImGui::BeginMenu(TCHAR_TO_ANSI(*Menu.Name)))
|
||||
{
|
||||
for (UCogWindowManager::FMenu& SubMenu : Menu.SubMenus)
|
||||
for (FMenu& SubMenu : Menu.SubMenus)
|
||||
{
|
||||
RenderOptionMenu(SubMenu);
|
||||
}
|
||||
@@ -613,7 +613,7 @@ void UCogWindowManager::SettingsHandler_WriteAll(ImGuiContext* Context, ImGuiSet
|
||||
const UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||
|
||||
Buffer->appendf("[%s][Windows]\n", Handler->TypeName);
|
||||
for (FCogWindow* Window : Manager->Windows)
|
||||
for (const FCogWindow* Window : Manager->Windows)
|
||||
{
|
||||
if (Window->GetIsVisible())
|
||||
{
|
||||
@@ -623,7 +623,7 @@ void UCogWindowManager::SettingsHandler_WriteAll(ImGuiContext* Context, ImGuiSet
|
||||
Buffer->append("\n");
|
||||
|
||||
Buffer->appendf("[%s][Widgets]\n", Handler->TypeName);
|
||||
for (FCogWindow* Window : Manager->Widgets)
|
||||
for (const FCogWindow* Window : Manager->Widgets)
|
||||
{
|
||||
Buffer->appendf("0x%08X %d\n", Window->GetID(), Window->GetIsWidgetVisible());
|
||||
}
|
||||
@@ -725,7 +725,7 @@ UCogWindowConfig* UCogWindowManager::GetConfig(const TSubclassOf<UCogWindowConfi
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
const UObject* UCogWindowManager::GetAsset(const TSubclassOf<UObject> AssetClass)
|
||||
const UObject* UCogWindowManager::GetAsset(const TSubclassOf<UObject> AssetClass) const
|
||||
{
|
||||
const UClass* Class = AssetClass.Get();
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "InputCoreTypes.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "GameFramework/PlayerInput.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -43,8 +43,8 @@ void FCogWindow_Layouts::RenderContent()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow_Layouts::RenderLoadLayoutMenuItem(const UPlayerInput* PlayerInput, int LayoutIndex)
|
||||
{
|
||||
FString Command = FString::Printf(TEXT("%s %d"), *UCogWindowManager::LoadLayoutCommand, LayoutIndex);
|
||||
FString Shortcut = FCogImguiInputHelper::CommandToString(PlayerInput, Command);
|
||||
const FString Command = FString::Printf(TEXT("%s %d"), *UCogWindowManager::LoadLayoutCommand, LayoutIndex);
|
||||
const FString Shortcut = FCogImguiInputHelper::CommandToString(PlayerInput, Command);
|
||||
if (ImGui::MenuItem(TCHAR_TO_ANSI(*FString::Printf(TEXT("Load Layout %d"), LayoutIndex)), TCHAR_TO_ANSI(*Shortcut)))
|
||||
{
|
||||
GetOwner()->LoadLayout(LayoutIndex);
|
||||
@@ -54,8 +54,8 @@ void FCogWindow_Layouts::RenderLoadLayoutMenuItem(const UPlayerInput* PlayerInpu
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow_Layouts::RenderSaveLayoutMenuItem(const UPlayerInput* PlayerInput, int LayoutIndex)
|
||||
{
|
||||
FString Command = FString::Printf(TEXT("%s %d"), *UCogWindowManager::SaveLayoutCommand, LayoutIndex);
|
||||
FString Shortcut = FCogImguiInputHelper::CommandToString(PlayerInput, Command);
|
||||
const FString Command = FString::Printf(TEXT("%s %d"), *UCogWindowManager::SaveLayoutCommand, LayoutIndex);
|
||||
const FString Shortcut = FCogImguiInputHelper::CommandToString(PlayerInput, Command);
|
||||
if (ImGui::MenuItem(TCHAR_TO_ANSI(*FString::Printf(TEXT("Save Layout %d"), LayoutIndex)), TCHAR_TO_ANSI(*Shortcut)))
|
||||
{
|
||||
GetOwner()->SaveLayout(LayoutIndex);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogImguiInputHelper.h"
|
||||
#include "CogImguiModule.h"
|
||||
#include "CogImguiWidget.h"
|
||||
#include "CogWindowManager.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui.h"
|
||||
@@ -157,7 +155,7 @@ void FCogWindow_Settings::RenderTick(float DeltaTime)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogWindow_Settings::SetDPIScale(float Value)
|
||||
void FCogWindow_Settings::SetDPIScale(float Value) const
|
||||
{
|
||||
Config->DPIScale = Value;
|
||||
GetOwner()->GetContext().SetDPIScale(Config->DPIScale);
|
||||
|
||||
@@ -78,12 +78,12 @@ public:
|
||||
template<class T>
|
||||
T* GetConfig() { return Cast<T>(GetConfig(T::StaticClass())); }
|
||||
|
||||
UCogWindowConfig* GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass);
|
||||
UCogWindowConfig* GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass) const;
|
||||
|
||||
template<class T>
|
||||
const T* GetAsset() { return Cast<T>(GetAsset(T::StaticClass())); }
|
||||
|
||||
const UObject* GetAsset(const TSubclassOf<UObject> AssetClass);
|
||||
const UObject* GetAsset(const TSubclassOf<UObject> AssetClass) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -105,11 +105,11 @@ protected:
|
||||
|
||||
virtual void OnSelectionChanged(AActor* OldSelection, AActor* NewSelection) {}
|
||||
|
||||
APawn* GetLocalPlayerPawn();
|
||||
APawn* GetLocalPlayerPawn() const;
|
||||
|
||||
APlayerController* GetLocalPlayerController();
|
||||
APlayerController* GetLocalPlayerController() const;
|
||||
|
||||
ULocalPlayer* GetLocalPlayer();
|
||||
ULocalPlayer* GetLocalPlayer() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static const UObject* GetFirstAssetByClass(const TSubclassOf<UObject> AssetClass)
|
||||
{
|
||||
IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")).Get();
|
||||
const IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")).Get();
|
||||
|
||||
TArray<FAssetData> Assets;
|
||||
AssetRegistry.GetAssetsByClass(AssetClass->GetClassPathName(), Assets, true);
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UObject* Asset = Assets[0].GetAsset();
|
||||
const UObject* Asset = Assets[0].GetAsset();
|
||||
return Asset;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
template<class T>
|
||||
T* GetConfig();
|
||||
|
||||
const UObject* GetAsset(const TSubclassOf<UObject> AssetClass);
|
||||
const UObject* GetAsset(const TSubclassOf<UObject> AssetClass) const;
|
||||
|
||||
template<typename T>
|
||||
T* GetAsset();
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
const UCogWindowConfig_Settings* GetSettingsConfig() const { return Config; }
|
||||
|
||||
void SetDPIScale(float Value);
|
||||
void SetDPIScale(float Value) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ void FCogAIWindow_BehaviorTree::RenderContent()
|
||||
|
||||
if (Config == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No Config");
|
||||
ImGui::TextDisabled("Invalid Config");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,35 +148,35 @@ void FCogAIWindow_BehaviorTree::RenderContent()
|
||||
AActor* Selection = GetSelection();
|
||||
if (Selection == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No Selection");
|
||||
ImGui::TextDisabled("Invalid Selection");
|
||||
return;
|
||||
}
|
||||
|
||||
APawn* Pawn = Cast<APawn>(Selection);
|
||||
if (Pawn == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Not a pawn");
|
||||
ImGui::TextDisabled("Selection is not a pawn");
|
||||
return;
|
||||
}
|
||||
|
||||
AAIController* AIController = Cast<AAIController>(Pawn->Controller);
|
||||
if (AIController == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No AIController");
|
||||
ImGui::TextDisabled("Selection has no AIController");
|
||||
return;
|
||||
}
|
||||
|
||||
UBehaviorTreeComponent* BehaviorTreeComponent = Cast<UBehaviorTreeComponent>(AIController->GetBrainComponent());
|
||||
if (BehaviorTreeComponent == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No BrainComponent");
|
||||
ImGui::TextDisabled("Selection has no BrainComponent");
|
||||
return;
|
||||
}
|
||||
|
||||
UBehaviorTree* CurrentTree = BehaviorTreeComponent->GetCurrentTree();
|
||||
if (CurrentTree == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No Current Tree");
|
||||
ImGui::TextDisabled("Selection has no current BehaviorTree");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,42 +54,42 @@ void FCogAIWindow_Blackboard::RenderContent()
|
||||
AActor* Selection = GetSelection();
|
||||
if (Selection == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No Selection");
|
||||
ImGui::TextDisabled("Invalid Selection");
|
||||
return;
|
||||
}
|
||||
|
||||
APawn* Pawn = Cast<APawn>(Selection);
|
||||
if (Pawn == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Not a pawn");
|
||||
ImGui::TextDisabled("Selection is not a pawn");
|
||||
return;
|
||||
}
|
||||
|
||||
AAIController* AIController = Cast<AAIController>(Pawn->Controller);
|
||||
if (AIController == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No AIController");
|
||||
ImGui::TextDisabled("Selection has no AIController");
|
||||
return;
|
||||
}
|
||||
|
||||
UBrainComponent* BehaviorTree = AIController->GetBrainComponent();
|
||||
if (BehaviorTree == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No BrainComponent");
|
||||
ImGui::TextDisabled("Selection has no BrainComponent");
|
||||
return;
|
||||
}
|
||||
|
||||
UBlackboardComponent* Blackboard = BehaviorTree->GetBlackboardComponent();
|
||||
if (Blackboard == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No BlackboardComponent");
|
||||
ImGui::TextDisabled("Selection has no BlackboardComponent");
|
||||
return;
|
||||
}
|
||||
|
||||
UBlackboardData* BlackboardAsset = Blackboard->GetBlackboardAsset();
|
||||
if (BlackboardAsset == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No BlackboardAsset");
|
||||
ImGui::TextDisabled("Selection has no BlackboardAsset");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "GameplayEffect.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -27,6 +26,11 @@ FVector4f UCogAbilityConfig_Alignment::GetAttributeColor(const UAbilitySystemCom
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FVector4f UCogAbilityConfig_Alignment::GetEffectColor(const UCogAbilityDataAsset* Asset, const UGameplayEffect& Effect) const
|
||||
{
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
return NeutralColor;
|
||||
}
|
||||
|
||||
const FGameplayTagContainer& Tags = Effect.InheritableGameplayEffectTags.CombinedTags;
|
||||
|
||||
if (Tags.HasTag(Asset->NegativeEffectTag))
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#include "CogAbilityHelper.h"
|
||||
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "GameplayEffect.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "imgui.h"
|
||||
|
||||
|
||||
@@ -236,12 +236,17 @@ void ACogAbilityReplicator::Server_ResetAllTweaks_Implementation()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogAbilityReplicator::OnAnyActorSpawned(AActor* Actor)
|
||||
{
|
||||
if (AbilityAsset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbilityAsset->ActorRootClass != nullptr && Actor->GetClass()->IsChildOf(AbilityAsset->ActorRootClass) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int32 TweakCategoryIndex = FindTweakCategoryFromActor(Actor);
|
||||
const int32 TweakCategoryIndex = FindTweakCategoryFromActor(Actor);
|
||||
if (TweakCategoryIndex == INDEX_NONE)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
#include "CogAbilityHelper.h"
|
||||
#include "CogAbilityReplicator.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Abilities::Initialize()
|
||||
@@ -103,12 +101,14 @@ void FCogAbilityWindow_Abilities::RenderContent()
|
||||
AActor* Selection = GetSelection();
|
||||
if (Selection == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid selection");
|
||||
return;
|
||||
}
|
||||
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Selection has no ability system component");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,8 @@
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogAbilityHelper.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "AttributeSet.h"
|
||||
#include "EngineUtils.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Attributes::Initialize()
|
||||
@@ -52,6 +49,7 @@ void FCogAbilityWindow_Attributes::RenderContent()
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Selection has no ability system component");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#include "CogAbilityWindow_Cheats.h"
|
||||
|
||||
#include "AbilitySystemGlobals.h"
|
||||
#include "CogAbilityConfig_Alignment.h"
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogAbilityReplicator.h"
|
||||
#include "CogCommonAllegianceActorInterface.h"
|
||||
#include "CogDebugDraw.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "EngineUtils.h"
|
||||
#include "GameFramework/Character.h"
|
||||
@@ -129,20 +126,20 @@ void FCogAbilityWindow_Cheats::RenderContent()
|
||||
|
||||
if (Config == nullptr)
|
||||
{
|
||||
ImGui::Text("Invalid Config");
|
||||
ImGui::TextDisabled("Invalid Config");
|
||||
return;
|
||||
}
|
||||
|
||||
AActor* SelectedActor = GetSelection();
|
||||
if (SelectedActor == nullptr)
|
||||
{
|
||||
ImGui::Text("Invalid Selection");
|
||||
ImGui::TextDisabled("Invalid Selection");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::Text("Invalid Asset");
|
||||
ImGui::TextDisabled("Invalid Asset");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogAbilityHelper.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "EngineUtils.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::Initialize()
|
||||
@@ -87,9 +84,10 @@ void FCogAbilityWindow_Effects::RenderContent()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
{
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Selection has no ability system component");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,7 +111,7 @@ void FCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
static int SelectedIndex = -1;
|
||||
int Index = 0;
|
||||
|
||||
FGameplayEffectQuery Query;
|
||||
const FGameplayEffectQuery Query;
|
||||
TArray<FActiveGameplayEffectHandle> Effects = AbilitySystemComponent->GetActiveEffects(Query);
|
||||
|
||||
if (Config->SortByName || Config->SortByAlignment)
|
||||
@@ -138,7 +136,7 @@ void FCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
}
|
||||
|
||||
bool AlignmentOrder = false;
|
||||
if (Config->SortByAlignment)
|
||||
if (Config->SortByAlignment && Asset != nullptr)
|
||||
{
|
||||
const FGameplayTagContainer& Tags1 = Effect1->InheritableGameplayEffectTags.CombinedTags;
|
||||
const FGameplayTagContainer& Tags2 = Effect2->InheritableGameplayEffectTags.CombinedTags;
|
||||
@@ -267,7 +265,7 @@ void FCogAbilityWindow_Effects::RenderEffectInfo(const UAbilitySystemComponent&
|
||||
{
|
||||
if (ImGui::BeginTable("Effect", 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);
|
||||
@@ -407,7 +405,7 @@ void FCogAbilityWindow_Effects::RenderRemainingTime(const UAbilitySystemComponen
|
||||
|
||||
if (Duration >= 0)
|
||||
{
|
||||
UWorld* World = AbilitySystemComponent.GetWorld();
|
||||
const UWorld* World = AbilitySystemComponent.GetWorld();
|
||||
const float RemainingTime = StartTime + Duration - World->GetTimeSeconds();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(100, 100, 100, 255));
|
||||
@@ -473,13 +471,13 @@ void FCogAbilityWindow_Effects::CloseEffect(const FActiveGameplayEffectHandle& H
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::RenderOpenEffects()
|
||||
{
|
||||
AActor* Selection = GetSelection();
|
||||
const AActor* Selection = GetSelection();
|
||||
if (Selection == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true);
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -487,7 +485,7 @@ void FCogAbilityWindow_Effects::RenderOpenEffects()
|
||||
|
||||
for (int i = OpenedEffects.Num() - 1; i >= 0; --i)
|
||||
{
|
||||
FActiveGameplayEffectHandle Handle = OpenedEffects[i];
|
||||
const FActiveGameplayEffectHandle Handle = OpenedEffects[i];
|
||||
|
||||
const FActiveGameplayEffect* ActiveEffectPtr = AbilitySystemComponent->GetActiveGameplayEffect(Handle);
|
||||
if (ActiveEffectPtr == nullptr)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "AbilitySystemGlobals.h"
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
@@ -33,12 +32,20 @@ void FCogAbilityWindow_Pools::RenderContent()
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid Asset");
|
||||
return;
|
||||
}
|
||||
|
||||
UAbilitySystemComponent* AbilitySystem = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
const UAbilitySystemComponent* AbilitySystem = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystem == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No ability system found on selection");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Asset->Pools.Num() == 0)
|
||||
{
|
||||
ImGui::TextDisabled("No pool have been defined");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ void FCogAbilityWindow_Tags::RenderContent()
|
||||
|
||||
RenderMenu();
|
||||
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Selection has no ability system component");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "CogAbilityWindow_Tweaks.h"
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "CogAbilityDataAsset.h"
|
||||
#include "CogAbilityReplicator.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -35,12 +33,14 @@ void FCogAbilityWindow_Tweaks::RenderContent()
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid Asset");
|
||||
return;
|
||||
}
|
||||
|
||||
ACogAbilityReplicator* Replicator = ACogAbilityReplicator::GetLocalReplicator(*GetWorld());
|
||||
if (Replicator == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Invalid Replicator");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void FCogAbilityWindow_Tweaks::RenderContent()
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
int32 CurrentTweakProfileIndex = Replicator->GetTweakProfileIndex();
|
||||
const int32 CurrentTweakProfileIndex = Replicator->GetTweakProfileIndex();
|
||||
FName CurrentProfileName = FName("None");
|
||||
if (Asset->TweakProfiles.IsValidIndex(CurrentTweakProfileIndex))
|
||||
{
|
||||
@@ -64,7 +64,7 @@ void FCogAbilityWindow_Tweaks::RenderContent()
|
||||
if (ImGui::BeginCombo("Profile", TCHAR_TO_ANSI(*CurrentProfileName.ToString())))
|
||||
{
|
||||
{
|
||||
bool IsSelected = CurrentTweakProfileIndex == INDEX_NONE;
|
||||
const bool IsSelected = CurrentTweakProfileIndex == INDEX_NONE;
|
||||
if (ImGui::Selectable("None", IsSelected))
|
||||
{
|
||||
Replicator->SetTweakProfile(INDEX_NONE);
|
||||
@@ -74,7 +74,7 @@ void FCogAbilityWindow_Tweaks::RenderContent()
|
||||
for (int32 TweakProfileIndex = 0; TweakProfileIndex < Asset->TweakProfiles.Num(); ++TweakProfileIndex)
|
||||
{
|
||||
const FCogAbilityTweakProfile& TweakProfile = Asset->TweakProfiles[TweakProfileIndex];
|
||||
bool IsSelected = TweakProfileIndex == CurrentTweakProfileIndex;
|
||||
const bool IsSelected = TweakProfileIndex == CurrentTweakProfileIndex;
|
||||
|
||||
if (ImGui::Selectable(TCHAR_TO_ANSI(*TweakProfile.Name.ToString()), IsSelected))
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ActiveGameplayEffectHandle.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "CogWindow.h"
|
||||
#include "CogWindowConfig.h"
|
||||
#include "imgui.h"
|
||||
|
||||
@@ -47,21 +47,27 @@ void FCogInputWindow_Actions::RenderContent()
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::Text("No Actions Asset");
|
||||
ImGui::TextDisabled("Invalid Asset");
|
||||
return;
|
||||
}
|
||||
|
||||
ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
||||
if (LocalPlayer == nullptr)
|
||||
{
|
||||
ImGui::Text("No Local Player");
|
||||
ImGui::TextDisabled("No Local Player");
|
||||
return;
|
||||
}
|
||||
|
||||
UEnhancedInputLocalPlayerSubsystem* EnhancedInputSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(LocalPlayer);
|
||||
if (EnhancedInputSubsystem == nullptr)
|
||||
{
|
||||
ImGui::Text("No Enhanced Input Subsystem");
|
||||
ImGui::TextDisabled("No Enhanced Input Subsystem");
|
||||
return;
|
||||
}
|
||||
|
||||
if(EnhancedInputSubsystem->GetPlayerInput() == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("No Player Input");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -233,4 +239,4 @@ void FCogInputWindow_Actions::DrawAxis(const char* Format, const char* ActionNam
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
FCogWindowWidgets::SliderWithReset("##Inject", InjectValue, -1.0f, 1.0f, 0.0f, "%0.2f");
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogInputDataAsset.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "Engine/World.h"
|
||||
@@ -190,13 +189,13 @@ void FCogInputWindow_Gamepad::RenderStick(const FKey& Key2D, const FKey& KeyBool
|
||||
ImGui::SetCursorScreenPos(ButtonPosition);
|
||||
if (ImGui::InvisibleButton("", ButtonSize))
|
||||
{
|
||||
if (ActionInfo2D->bIsMouseDraggingStick == false)
|
||||
if (ActionInfo2D != nullptr && ActionInfo2D->bIsMouseDraggingStick == false)
|
||||
{
|
||||
OnButtonClicked(ActionInfoBool);
|
||||
}
|
||||
}
|
||||
|
||||
if (ActionInfo2D->Action != nullptr)
|
||||
if (ActionInfo2D != nullptr && ActionInfo2D->Action != nullptr)
|
||||
{
|
||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left))
|
||||
{
|
||||
@@ -268,36 +267,30 @@ void FCogInputWindow_Gamepad::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
if (GetWorld() == nullptr)
|
||||
{
|
||||
ImGui::Text("No World");
|
||||
return;
|
||||
}
|
||||
|
||||
ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
||||
const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
||||
if (LocalPlayer == nullptr)
|
||||
{
|
||||
ImGui::Text("No Local Player");
|
||||
ImGui::TextDisabled("No Local Player");
|
||||
return;
|
||||
}
|
||||
|
||||
UEnhancedInputLocalPlayerSubsystem* EnhancedInputSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(LocalPlayer);
|
||||
const UEnhancedInputLocalPlayerSubsystem* EnhancedInputSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(LocalPlayer);
|
||||
if (EnhancedInputSubsystem == nullptr)
|
||||
{
|
||||
ImGui::Text("No Enhanced Input Subsystem");
|
||||
ImGui::TextDisabled("No Enhanced Input Subsystem");
|
||||
return;
|
||||
}
|
||||
|
||||
Input = EnhancedInputSubsystem->GetPlayerInput();
|
||||
if (Input == nullptr)
|
||||
{
|
||||
ImGui::Text("No Player Input");
|
||||
ImGui::TextDisabled("No Player Input");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
ImGui::Text("No Input Asset");
|
||||
ImGui::TextDisabled("Invalid Asset");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,22 +338,22 @@ void FCogInputWindow_Gamepad::RenderContent()
|
||||
}
|
||||
|
||||
|
||||
const float AspectRatio = 0.55f;
|
||||
const float StickAmplitude = 0.04f;
|
||||
const float StickRadius = 0.08f;
|
||||
const float StickBaseRadius = 0.1f;
|
||||
const float GamepadRound = 0.15f;
|
||||
const float HandleWidth = 0.26f;
|
||||
const ImVec2 DPadButtonSize(0.08f, 0.08f);
|
||||
const float DpadButtonDistance = 0.075f;
|
||||
const float DpadButtonRounding = 0.1f;
|
||||
const ImVec2 SpecialButtonSize(0.08f, 0.04f);
|
||||
const float SpecialButtonRound = 0.05f;
|
||||
const float SpecialButtonDistance = 0.15f;
|
||||
const float TriggerRound = 0.02f;
|
||||
const ImVec2 TriggerButtonSize(0.08f, 0.05f);
|
||||
const float BumperRound = 0.02f;
|
||||
const ImVec2 BumperButtonSize(0.2f, 0.04f);
|
||||
constexpr float AspectRatio = 0.55f;
|
||||
constexpr float StickAmplitude = 0.04f;
|
||||
constexpr float StickRadius = 0.08f;
|
||||
constexpr float StickBaseRadius = 0.1f;
|
||||
constexpr float GamepadRound = 0.15f;
|
||||
constexpr float HandleWidth = 0.26f;
|
||||
constexpr ImVec2 DPadButtonSize(0.08f, 0.08f);
|
||||
constexpr float DpadButtonDistance = 0.075f;
|
||||
constexpr float DpadButtonRounding = 0.1f;
|
||||
constexpr ImVec2 SpecialButtonSize(0.08f, 0.04f);
|
||||
constexpr float SpecialButtonRound = 0.05f;
|
||||
constexpr float SpecialButtonDistance = 0.15f;
|
||||
constexpr float TriggerRound = 0.02f;
|
||||
constexpr ImVec2 TriggerButtonSize(0.08f, 0.05f);
|
||||
constexpr float BumperRound = 0.02f;
|
||||
constexpr ImVec2 BumperButtonSize(0.2f, 0.04f);
|
||||
|
||||
const ImVec2 ContentMin = ImGui::GetCursorScreenPos();
|
||||
const ImVec2 ContentSize = ImGui::GetContentRegionAvail();
|
||||
@@ -382,8 +375,8 @@ void FCogInputWindow_Gamepad::RenderContent()
|
||||
|
||||
DrawList->PushClipRect(ContentMin, ContentMax, true);
|
||||
|
||||
const ImVec2 LS_Pos(0.35f, 0.7f);
|
||||
const ImVec2 RS_Pos(0.65f, 0.7f);
|
||||
constexpr ImVec2 LS_Pos(0.35f, 0.7f);
|
||||
constexpr ImVec2 RS_Pos(0.65f, 0.7f);
|
||||
|
||||
//------------------------------
|
||||
// Triggers
|
||||
@@ -426,7 +419,7 @@ void FCogInputWindow_Gamepad::RenderContent()
|
||||
//------------------------------
|
||||
// DPad Buttons
|
||||
//------------------------------
|
||||
const ImVec2 DPad_Pos(0.15f, 0.44f);
|
||||
constexpr ImVec2 DPad_Pos(0.15f, 0.44f);
|
||||
RenderButton(EKeys::Gamepad_DPad_Up, DPad_Pos + ImVec2(0.0f, -DpadButtonDistance / AspectRatio), DPadButtonSize, ImVec2(0.5f, 0.5f), DpadButtonRounding);
|
||||
RenderButton(EKeys::Gamepad_DPad_Down, DPad_Pos + ImVec2(0.0f, DpadButtonDistance / AspectRatio), DPadButtonSize, ImVec2(0.5f, 0.5f), DpadButtonRounding);
|
||||
RenderButton(EKeys::Gamepad_DPad_Left, DPad_Pos + ImVec2(-DpadButtonDistance, 0.0f), DPadButtonSize, ImVec2(0.5f, 0.5f), DpadButtonRounding);
|
||||
@@ -435,7 +428,7 @@ void FCogInputWindow_Gamepad::RenderContent()
|
||||
//------------------------------
|
||||
// Face Buttons
|
||||
//------------------------------
|
||||
const ImVec2 Face_Pos(1.0f - 0.15f, 0.44f);
|
||||
constexpr ImVec2 Face_Pos(1.0f - 0.15f, 0.44f);
|
||||
RenderButton(EKeys::Gamepad_FaceButton_Top, Face_Pos + ImVec2(0.0f, -DpadButtonDistance / AspectRatio), DPadButtonSize, ImVec2(0.5f, 0.5f), DpadButtonRounding);
|
||||
RenderButton(EKeys::Gamepad_FaceButton_Bottom, Face_Pos + ImVec2(0.0f, DpadButtonDistance / AspectRatio), DPadButtonSize, ImVec2(0.5f, 0.5f), DpadButtonRounding);
|
||||
RenderButton(EKeys::Gamepad_FaceButton_Left, Face_Pos + ImVec2(-DpadButtonDistance, 0.0f), DPadButtonSize, ImVec2(0.5f, 0.5f), DpadButtonRounding);
|
||||
@@ -460,7 +453,7 @@ void FCogInputWindow_Gamepad::RenderTick(float DeltaSeconds)
|
||||
return;
|
||||
}
|
||||
|
||||
ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
||||
const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
||||
if (LocalPlayer == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -473,7 +466,7 @@ void FCogInputWindow_Gamepad::RenderTick(float DeltaSeconds)
|
||||
}
|
||||
|
||||
bool IsTimeToRepeat = false;
|
||||
float WorldTime = GetWorld()->GetTimeSeconds();
|
||||
const float WorldTime = GetWorld()->GetTimeSeconds();
|
||||
if (RepeatTime < WorldTime)
|
||||
{
|
||||
RepeatTime = WorldTime + Config->RepeatPeriod;
|
||||
|
||||
@@ -23,12 +23,6 @@ class ACogSampleGameState : public AGameStateBase
|
||||
|
||||
private:
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// To make sure it doesn't get garbage collected.
|
||||
//---------------------------------------------------------------------------------
|
||||
UPROPERTY()
|
||||
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// The game state has an AbilitySystemComponent to serve as the default instigator
|
||||
// for effects that are not applied by characters.
|
||||
@@ -36,6 +30,12 @@ private:
|
||||
UPROPERTY()
|
||||
UCogSampleAbilitySystemComponent* AbilitySystemComponent = nullptr;
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// To make sure it doesn't get garbage collected.
|
||||
//---------------------------------------------------------------------------------
|
||||
UPROPERTY()
|
||||
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
|
||||
|
||||
#if ENABLE_COG
|
||||
|
||||
void InitializeCog();
|
||||
|
||||
Reference in New Issue
Block a user