13 Commits

Author SHA1 Message Date
ed 66caf73df9 Merge remote-tracking branch 'arnaud-jamin/main'
# Conflicts:
#	Plugins/Cog/Source/CogCommon/Public/CogCommonLogCategory.h
2024-10-08 17:38:02 -04:00
ed eb543ffdd8 fixers (possible) 2024-10-08 17:37:02 -04:00
Arnaud Jamin 3539881135 Fix includes
Fix collision draw functions not using draw settings
2024-06-05 09:39:05 -04:00
Arnaud Jamin 8949050964 add missing includes 2024-05-16 11:13:49 -04:00
Arnaud Jamin 1690b802ed Add Vlog on server debug shape
Add more debug recolor option
2024-05-16 10:59:53 -04:00
Arnaud Jamin 4cc44207a4 missing include 2024-05-11 18:39:40 -04:00
Arnaud Jamin 1033bc8cf7 Move enum ECogLogVerbosity to cog common 2024-05-10 22:56:37 -04:00
Arnaud Jamin 5e2ff8b918 Move the window config base class in CogCommon for projects that want to have their own configs, 2024-05-10 22:34:53 -04:00
Arnaud Jamin c4af1f304d Make the ability window more easily overridable in case a project wants to add more ability debug 2024-05-10 11:56:41 -04:00
Arnaud Jamin 69ef005a1e Display inhibition of gameplay effects 2024-05-10 00:57:19 -04:00
Arnaud Jamin 5cd88b2f86 Add required tags in gameplay ability window 2024-05-02 12:45:03 -04:00
Arnaud Jamin 87dd681624 Add gameplay tasks window. Add blocking tags in the gameplay ability window. 2024-04-26 11:59:12 -04:00
ed cdae61e8ec Update readme. 2024-04-09 16:18:03 -04:00
61 changed files with 1379 additions and 384 deletions
@@ -0,0 +1,21 @@
#pragma once
#include "CoreMinimal.h"
#include "CogCommonConfig.generated.h"
UCLASS(Config = Cog)
class COGCOMMON_API UCogCommonConfig : public UObject
{
GENERATED_BODY()
public:
UCogCommonConfig()
{
Reset();
}
virtual void Reset()
{
}
};
@@ -0,0 +1,34 @@
#pragma once
#include "CoreMinimal.h"
#include "CogCommonLog.generated.h"
//--------------------------------------------------------------------------------------------------------------------------
UENUM(BlueprintType)
enum class ECogLogVerbosity : uint8
{
NoLogging = ELogVerbosity::NoLogging,
Fatal = ELogVerbosity::Fatal,
Error = ELogVerbosity::Error,
Warning = ELogVerbosity::Warning,
Display = ELogVerbosity::Display,
Log = ELogVerbosity::Log,
Verbose = ELogVerbosity::Verbose,
VeryVerbose = ELogVerbosity::VeryVerbose
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT(BlueprintType)
struct COGCOMMON_API FCogLogCategory
{
GENERATED_USTRUCT_BODY()
FCogLogCategory() {}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FName Name;
FString GetName() const { return Name.ToString(); }
mutable FLogCategoryBase* LogCategory = nullptr;
};
@@ -1,20 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "CogCommonLogCategory.generated.h"
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT(BlueprintType)
struct COGCOMMON_API FCogLogCategory
{
GENERATED_USTRUCT_BODY()
FCogLogCategory() {}
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Cog")
FName Name;
FString GetName() const { return Name.ToString(); }
mutable FLogCategoryBase* LogCategory = nullptr;
};
@@ -3,8 +3,10 @@
#include "CogCommonDebugFilteredActorInterface.h" #include "CogCommonDebugFilteredActorInterface.h"
#include "CogDebugDrawHelper.h" #include "CogDebugDrawHelper.h"
#include "CogDebugReplicator.h" #include "CogDebugReplicator.h"
#include "imgui.h"
#include "Engine/World.h" #include "Engine/World.h"
#include "Engine/Engine.h" #include "Engine/Engine.h"
#include "Kismet/KismetMathLibrary.h"
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
TWeakObjectPtr<AActor> FCogDebug::Selection; TWeakObjectPtr<AActor> FCogDebug::Selection;
@@ -19,7 +21,7 @@ void FCogDebug::Reset()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
bool FCogDebug::IsDebugActiveForObject(const UObject* WorldContextObject) bool FCogDebug::IsDebugActiveForObject(const UObject* WorldContextObject)
{ {
const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (World == nullptr) if (World == nullptr)
{ {
return true; return true;
@@ -186,21 +188,49 @@ FColor FCogDebug::ModulateDebugColor(const UWorld* World, const FColor& Color, b
return Color; return Color;
} }
const float Time = World->GetTimeSeconds(); switch (Settings.RecolorMode)
const FLinearColor BaseColor(Color);
FLinearColor ComplementaryColor = BaseColor.LinearRGBToHSV();
ComplementaryColor.R = ComplementaryColor.R - 180.0f;
if (ComplementaryColor.R < 0.0f)
{ {
ComplementaryColor.R = 360.0f - ComplementaryColor.R; case ECogDebugRecolorMode::None:
{
return Color;
}
case ECogDebugRecolorMode::Color:
{
return UKismetMathLibrary::LinearColorLerp(Color, Settings.RecolorColor, Settings.RecolorIntensity).ToFColor(true);
}
case ECogDebugRecolorMode::HueOverTime:
{
const FLinearColor BaseColor(Color);
FLinearColor ComplementaryColor = BaseColor.LinearRGBToHSV();
ComplementaryColor.R = ComplementaryColor.R - 180.0f;
if (ComplementaryColor.R < 0.0f)
{
ComplementaryColor.R = 360.0f - ComplementaryColor.R;
}
ComplementaryColor = ComplementaryColor.HSVToLinearRGB();
const FLinearColor NewColor = FLinearColor::LerpUsingHSV(FLinearColor(Color), ComplementaryColor, FMath::Cos(Settings.RecolorTimeSpeed * World->GetTimeSeconds()));
const FLinearColor BlendColor = BaseColor * (1.0f - Settings.RecolorIntensity) + NewColor * Settings.RecolorIntensity;
return BlendColor.ToFColor(true);
}
case ECogDebugRecolorMode::HueOverFrames:
{
const FLinearColor BaseColor(Color);
const float Factor = (Settings.RecolorFrameCycle > 0) ? (GFrameCounter % Settings.RecolorFrameCycle) / (float)Settings.RecolorFrameCycle : 0.0f;
const FLinearColor NewColor(Factor * 360.0f, 1.0f, 1.0f);
const FLinearColor BlendColor = BaseColor * (1.0f - Settings.RecolorIntensity) + NewColor.HSVToLinearRGB() * Settings.RecolorIntensity;
return BlendColor.ToFColor(true);
}
default:
{
return Color;
}
} }
ComplementaryColor = ComplementaryColor.HSVToLinearRGB();
const FLinearColor GradientColor = FLinearColor::LerpUsingHSV(FLinearColor(Color), ComplementaryColor, FMath::Cos(Settings.GradientColorSpeed * Time));
const FLinearColor FBlendColor = BaseColor * (1.0f - Settings.GradientColorIntensity) + GradientColor * Settings.GradientColorIntensity;
return FBlendColor.ToFColor(true);
} }
@@ -283,7 +313,7 @@ void FCogDebug::GetDebugDrawOverlapSettings(FCogDebugDrawOverlapParams& Params)
Params.DepthPriority = Settings.DepthPriority; Params.DepthPriority = Settings.DepthPriority;
Params.Thickness = Settings.Thickness; Params.Thickness = Settings.Thickness;
GetDebugChannelColors(Params.ChannelColors); GetDebugChannelColors(Params.ChannelColors);
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -1,7 +1,7 @@
#include "CogDebugDrawBlueprint.h" #include "CogDebugDrawBlueprint.h"
#include "CogDebugDraw.h" #include "CogDebugDraw.h"
#include "CogCommonLogCategory.h" #include "CogCommonLog.h"
#include "CogDebugLog.h" #include "CogDebugLog.h"
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -421,10 +421,10 @@ void FCogDebugDrawHelper::DrawLineTrace(
End, End,
FCogDebug::Settings.ArrowSize, FCogDebug::Settings.ArrowSize,
HasHits ? Settings.HitColor : Settings.NoHitColor, HasHits ? Settings.HitColor : Settings.NoHitColor,
false, Settings.Persistent,
0.0f, Settings.LifeTime,
FCogDebug::GetDebugDepthPriority(0), Settings.DepthPriority,
FCogDebug::GetDebugThickness(0.0f)); Settings.Thickness);
DrawHitResults(World, HitResults, Settings); DrawHitResults(World, HitResults, Settings);
} }
@@ -449,10 +449,10 @@ void FCogDebugDrawHelper::DrawSweep(
End, End,
FCogDebug::Settings.ArrowSize, FCogDebug::Settings.ArrowSize,
Color, Color,
false, Settings.Persistent,
0.0f, Settings.LifeTime,
FCogDebug::GetDebugDepthPriority(0), Settings.DepthPriority,
FCogDebug::GetDebugThickness(0.0f)); Settings.Thickness);
DrawShape(World, Shape, Start, Rotation, FVector::OneVector, Color, Settings.Persistent, Settings.LifeTime, Settings.DepthPriority, Settings.Thickness); DrawShape(World, Shape, Start, Rotation, FVector::OneVector, Color, Settings.Persistent, Settings.LifeTime, Settings.DepthPriority, Settings.Thickness);
@@ -1,7 +1,6 @@
#include "CogDebugLog.h" #include "CogDebugLog.h"
#include "CogCommonLogCategory.h" #include "CogCommonLog.h"
#include "CogDebugModule.h"
#include "CogDebugReplicator.h" #include "CogDebugReplicator.h"
#include "Engine/Engine.h" #include "Engine/Engine.h"
#include "Engine/World.h" #include "Engine/World.h"
@@ -2,7 +2,7 @@
#include "CogCommon.h" #include "CogCommon.h"
#include "CogDebugLog.h" #include "CogDebugLog.h"
#include "CogCommonLogCategory.h" #include "CogCommonLog.h"
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, const FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text) void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, const FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text)
@@ -1,5 +1,6 @@
#include "CogDebugPlot.h" #include "CogDebugPlot.h"
#include "CogDebug.h"
#include "CogDebugDraw.h" #include "CogDebugDraw.h"
#include "CogDebugHelper.h" #include "CogDebugHelper.h"
#include "CogImguiHelper.h" #include "CogImguiHelper.h"
@@ -1,5 +1,6 @@
#include "CogDebugReplicator.h" #include "CogDebugReplicator.h"
#include "CogDebug.h"
#include "CogDebugDraw.h" #include "CogDebugDraw.h"
#include "CogDebugLog.h" #include "CogDebugLog.h"
#include "EngineUtils.h" #include "EngineUtils.h"
@@ -3,6 +3,10 @@
#include "CogCommon.h" #include "CogCommon.h"
#include "CogDebugDrawHelper.h" #include "CogDebugDrawHelper.h"
#include "DrawDebugHelpers.h" #include "DrawDebugHelpers.h"
#include "Engine/World.h"
#include "VisualLogger/VisualLogger.h"
DEFINE_LOG_CATEGORY(LogCogServerVLOG);
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
FCogDebugShape FCogDebugShape::MakePoint(const FVector& Location, const float Size, const FColor& Color, const bool bPersistent, const uint8 DepthPriority) FCogDebugShape FCogDebugShape::MakePoint(const FVector& Location, const float Size, const FColor& Color, const bool bPersistent, const uint8 DepthPriority)
@@ -20,20 +24,25 @@ FCogDebugShape FCogDebugShape::MakePoint(const FVector& Location, const float Si
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawPoint(UWorld* World) const void FCogDebugShape::DrawPoint(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 1) if (ShapeData.Num() == 1)
{ {
const FVector Location = ShapeData[0];
const float ServerThickness = FCogDebug::GetDebugServerThickness(Thickness);
DrawDebugPoint( DrawDebugPoint(
World, World,
ShapeData[0], Location,
FCogDebug::GetDebugServerThickness(Thickness), ServerThickness,
FCogDebug::ModulateServerColor(Color), FCogDebug::ModulateServerColor(Color),
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority)); FCogDebug::GetDebugDepthPriority(DepthPriority));
UE_VLOG_LOCATION(World, LogCogServerVLOG, Verbose, Location, ServerThickness, Color, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -56,21 +65,28 @@ FCogDebugShape FCogDebugShape::MakeSegment(const FVector& StartLocation, const F
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawSegment(UWorld* World) const void FCogDebugShape::DrawSegment(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 2) if (ShapeData.Num() == 2)
{ {
const FVector Start = ShapeData[0];
const FVector End = ShapeData[1];
const FColor ServerColor = FCogDebug::ModulateServerColor(Color);
const float ServerThickness = FCogDebug::GetDebugServerThickness(Thickness);
DrawDebugLine( DrawDebugLine(
World, World,
ShapeData[0], Start,
ShapeData[1], End,
FCogDebug::ModulateServerColor(Color), ServerColor,
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority), FCogDebug::GetDebugDepthPriority(DepthPriority),
FCogDebug::GetDebugServerThickness(Thickness)); ServerThickness);
UE_VLOG_SEGMENT_THICK(World, LogCogServerVLOG, Verbose, Start, End, ServerColor, ServerThickness, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -94,22 +110,29 @@ FCogDebugShape FCogDebugShape::MakeArrow(const FVector& StartLocation, const FVe
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawArrow(UWorld* World) const void FCogDebugShape::DrawArrow(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 3) if (ShapeData.Num() == 3)
{ {
const FVector Start = ShapeData[0];
const FVector End = ShapeData[1];
const float Size = ShapeData[2].X;
const FColor ServerColor = FCogDebug::ModulateServerColor(Color);
DrawDebugDirectionalArrow( DrawDebugDirectionalArrow(
World, World,
ShapeData[0], Start,
ShapeData[1], End,
ShapeData[2].X, Size,
FCogDebug::ModulateServerColor(Color), ServerColor,
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority), FCogDebug::GetDebugDepthPriority(DepthPriority),
FCogDebug::GetDebugServerThickness(Thickness)); FCogDebug::GetDebugServerThickness(Thickness));
UE_VLOG_ARROW(World, LogCogServerVLOG, Verbose, Start, End, ServerColor, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -133,21 +156,30 @@ FCogDebugShape FCogDebugShape::MakeAxes(const FVector& Location, const FRotator&
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawAxes(UWorld* World) const void FCogDebugShape::DrawAxes(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 3) if (ShapeData.Num() == 3)
{ {
const FVector Location = ShapeData[0];
const FRotator Rotation(ShapeData[1].X, ShapeData[1].Y, ShapeData[1].Z);
const float Scale = ShapeData[2].X;
DrawDebugCoordinateSystem( DrawDebugCoordinateSystem(
World, World,
ShapeData[0], Location,
FRotator(ShapeData[1].X, ShapeData[1].Y, ShapeData[1].Z), Rotation,
ShapeData[2].X, Scale,
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority), FCogDebug::GetDebugDepthPriority(DepthPriority),
FCogDebug::GetDebugServerThickness(Thickness)); FCogDebug::GetDebugServerThickness(Thickness));
const FRotationMatrix Matrix(Rotation);
UE_VLOG_ARROW(World, LogCogServerVLOG, Verbose, Location, Location + Matrix.GetScaledAxis(EAxis::X) * Scale, FColor::Red, TEXT(""));
UE_VLOG_ARROW(World, LogCogServerVLOG, Verbose, Location, Location + Matrix.GetScaledAxis(EAxis::Y) * Scale, FColor::Green, TEXT(""));
UE_VLOG_ARROW(World, LogCogServerVLOG, Verbose, Location, Location + Matrix.GetScaledAxis(EAxis::Z) * Scale, FColor::Blue, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -171,22 +203,27 @@ FCogDebugShape FCogDebugShape::MakeBox(const FVector& Center, const FRotator& Ro
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawBox(UWorld* World) const void FCogDebugShape::DrawBox(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 3) if (ShapeData.Num() == 3)
{ {
const FVector Location = ShapeData[0];
const FVector Extent = ShapeData[1];
const FRotator Rotation(ShapeData[2].X, ShapeData[2].Y, ShapeData[2].Z);
const FColor ServerColor = FCogDebug::ModulateServerColor(Color);
DrawDebugBox( DrawDebugBox(
World, World, Location, Extent, FQuat(Rotation),
ShapeData[0], ServerColor,
ShapeData[1],
FQuat(FRotator(ShapeData[2].X, ShapeData[2].Y, ShapeData[2].Z)),
FCogDebug::ModulateServerColor(Color),
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority), FCogDebug::GetDebugDepthPriority(DepthPriority),
FCogDebug::GetDebugServerThickness(Thickness)); FCogDebug::GetDebugServerThickness(Thickness));
const FBox Box(-Extent, Extent);
UE_VLOG_OBOX(World, LogCogServerVLOG, Verbose, Box, FRotationTranslationMatrix(Rotation, Location), ServerColor, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -209,21 +246,29 @@ FCogDebugShape FCogDebugShape::MakeSolidBox(const FVector& Center, const FRotato
} }
void FCogDebugShape::DrawSolidBox(UWorld* World) const void FCogDebugShape::DrawSolidBox(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 12) if (ShapeData.Num() == 12)
{ {
const FVector Location = ShapeData[0];
const FVector Extent = ShapeData[1];
const FRotator Rotation(ShapeData[2].X, ShapeData[2].Y, ShapeData[2].Z);
const FColor ServerColor = FCogDebug::ModulateServerColor(Color);
DrawDebugSolidBox( DrawDebugSolidBox(
World, World,
ShapeData[0], Location,
ShapeData[1], Extent,
FQuat(FRotator(ShapeData[1].X, ShapeData[1].Y, ShapeData[1].Z)), FQuat(Rotation),
FCogDebug::ModulateServerColor(Color), ServerColor,
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority)); FCogDebug::GetDebugDepthPriority(DepthPriority));
const FBox Box(-Extent, Extent);
UE_VLOG_OBOX(World, LogCogServerVLOG, Verbose, Box, FRotationTranslationMatrix(Rotation, Location), ServerColor, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -247,26 +292,33 @@ FCogDebugShape FCogDebugShape::MakeCone(const FVector& Location, const FVector&
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawCone(UWorld* World) const void FCogDebugShape::DrawCone(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 3 && ShapeData[2].X > 0) if (ShapeData.Num() == 3 && ShapeData[2].X > 0)
{ {
const FVector Location = ShapeData[0];
const FVector Direction = ShapeData[1];
const float Length = ShapeData[2].X;
const float DefaultConeAngle = 0.25f; // ~ 15 degrees const float DefaultConeAngle = 0.25f; // ~ 15 degrees
const FColor ServerColor = FCogDebug::ModulateServerColor(Color);
DrawDebugCone( DrawDebugCone(
World, World,
ShapeData[0], Location,
ShapeData[1], Direction,
ShapeData[2].X, Length,
DefaultConeAngle, DefaultConeAngle,
DefaultConeAngle, DefaultConeAngle,
FCogDebug::GetCircleSegments(), FCogDebug::GetCircleSegments(),
FCogDebug::ModulateServerColor(Color), ServerColor,
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority), FCogDebug::GetDebugDepthPriority(DepthPriority),
FCogDebug::GetDebugServerThickness(Thickness)); FCogDebug::GetDebugServerThickness(Thickness));
UE_VLOG_CONE(World, LogCogServerVLOG, Verbose, Location, Direction, Length, DefaultConeAngle, ServerColor, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -289,7 +341,7 @@ FCogDebugShape FCogDebugShape::MakeCylinder(const FVector& Center, const float R
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawCylinder(UWorld* World) const void FCogDebugShape::DrawCylinder(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
@@ -329,23 +381,33 @@ FCogDebugShape FCogDebugShape::MakeCircle(const FVector& Center, const FRotator&
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawCicle(UWorld* World) const void FCogDebugShape::DrawCircle(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
if (ShapeData.Num() == 3) if (ShapeData.Num() == 3)
{ {
const FVector Location = ShapeData[0];
const FRotator Rotation (ShapeData[1].X, ShapeData[1].Y, ShapeData[1].Z);
const FRotationTranslationMatrix Matrix(Rotation, Location);
const float Radius = ShapeData[2].X;
const FColor ServerColor = FCogDebug::ModulateServerColor(Color);
const float ServerThickness = FCogDebug::GetDebugServerThickness(Thickness);
DrawDebugCircle( DrawDebugCircle(
World, World,
FRotationTranslationMatrix(FRotator(ShapeData[1].X, ShapeData[1].Y, ShapeData[1].Z), ShapeData[0]), Matrix,
ShapeData[2].X, Radius,
FCogDebug::GetCircleSegments(), FCogDebug::GetCircleSegments(),
FCogDebug::ModulateServerColor(Color), ServerColor,
FCogDebug::GetDebugPersistent(bPersistent), FCogDebug::GetDebugPersistent(bPersistent),
FCogDebug::GetDebugDuration(bPersistent), FCogDebug::GetDebugDuration(bPersistent),
FCogDebug::GetDebugDepthPriority(DepthPriority), FCogDebug::GetDebugDepthPriority(DepthPriority),
FCogDebug::GetDebugServerThickness(Thickness), ServerThickness,
false); false);
UE_VLOG_CIRCLE_THICK(World, LogCogServerVLOG, Verbose, Location, Matrix.GetUnitAxis(EAxis::X), Radius, ServerColor, ServerThickness, TEXT(""));
} }
#endif //ENABLE_COG #endif //ENABLE_COG
@@ -369,7 +431,7 @@ FCogDebugShape FCogDebugShape::MakeCircleArc(const FVector& Center, const FRotat
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawCicleArc(UWorld* World) const void FCogDebugShape::DrawCircleArc(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
@@ -410,7 +472,7 @@ FCogDebugShape FCogDebugShape::MakeCapsule(const FVector& Center, const FQuat& R
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawCapsule(UWorld* World) const void FCogDebugShape::DrawCapsule(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
@@ -451,7 +513,7 @@ FCogDebugShape FCogDebugShape::MakeFlatCapsule(const FVector2D& Start, const FVe
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawFlatCapsule(UWorld* World) const void FCogDebugShape::DrawFlatCapsule(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
@@ -491,7 +553,7 @@ FCogDebugShape FCogDebugShape::MakeBone(const FVector& BoneLocation, const FVect
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawBone(UWorld* World) const void FCogDebugShape::DrawBone(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
@@ -535,7 +597,7 @@ FCogDebugShape FCogDebugShape::MakePolygon(const TArray<FVector>& Verts, const F
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::DrawPolygon(UWorld* World) const void FCogDebugShape::DrawPolygon(const UWorld* World) const
{ {
#if ENABLE_COG #if ENABLE_COG
@@ -564,7 +626,7 @@ void FCogDebugShape::DrawPolygon(UWorld* World) const
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogDebugShape::Draw(UWorld* World) const void FCogDebugShape::Draw(const UWorld* World) const
{ {
switch (Type) switch (Type)
{ {
@@ -573,8 +635,8 @@ void FCogDebugShape::Draw(UWorld* World) const
case ECogDebugShape::Bone: DrawBone(World); break; case ECogDebugShape::Bone: DrawBone(World); break;
case ECogDebugShape::Box: DrawBox(World); break; case ECogDebugShape::Box: DrawBox(World); break;
case ECogDebugShape::Capsule: DrawCapsule(World); break; case ECogDebugShape::Capsule: DrawCapsule(World); break;
case ECogDebugShape::Circle: DrawCicle(World); break; case ECogDebugShape::Circle: DrawCircle(World); break;
case ECogDebugShape::CircleArc: DrawCicleArc(World); break; case ECogDebugShape::CircleArc: DrawCircleArc(World); break;
case ECogDebugShape::Cone: DrawCone(World); break; case ECogDebugShape::Cone: DrawCone(World); break;
case ECogDebugShape::Cylinder: DrawCylinder(World); break; case ECogDebugShape::Cylinder: DrawCylinder(World); break;
case ECogDebugShape::FlatCapsule: DrawFlatCapsule(World); break; case ECogDebugShape::FlatCapsule: DrawFlatCapsule(World); break;
+20 -2
View File
@@ -12,6 +12,15 @@ struct FCogDebugDrawLineTraceParams;
struct FCogDebugDrawOverlapParams; struct FCogDebugDrawOverlapParams;
struct FCogDebugDrawSweepParams; struct FCogDebugDrawSweepParams;
UENUM()
enum ECogDebugRecolorMode : uint8
{
None,
Color,
HueOverTime,
HueOverFrames,
};
USTRUCT() USTRUCT()
struct FCogDebugSettings struct FCogDebugSettings
{ {
@@ -54,10 +63,19 @@ struct FCogDebugSettings
float AxesScale = 1.0f; float AxesScale = 1.0f;
UPROPERTY(Config) UPROPERTY(Config)
float GradientColorIntensity = 0.0f; TEnumAsByte<ECogDebugRecolorMode> RecolorMode = None;
UPROPERTY(Config) UPROPERTY(Config)
float GradientColorSpeed = 2.0f; float RecolorIntensity = 0.0f;
UPROPERTY(Config)
FColor RecolorColor = FColor(255, 0, 0, 255);
UPROPERTY(Config)
float RecolorTimeSpeed = 2.0f;
UPROPERTY(Config)
int32 RecolorFrameCycle = 6;
UPROPERTY(Config) UPROPERTY(Config)
float TextSize = 1.0f; float TextSize = 1.0f;
@@ -1,22 +1,10 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Kismet/KismetSystemLibrary.h" #include "CogCommonLog.h"
#include "Logging/LogVerbosity.h" #include "Kismet/BlueprintFunctionLibrary.h"
#include "CogDebugLogBlueprint.generated.h"
//-------------------------------------------------------------------------------------------------------------------------- #include "CogDebugLogBlueprint.generated.h"
UENUM()
enum class ECogLogVerbosity : uint8
{
Fatal = ELogVerbosity::Fatal,
Error = ELogVerbosity::Error,
Warning = ELogVerbosity::Warning,
Display = ELogVerbosity::Display,
Log = ELogVerbosity::Log,
Verbose = ELogVerbosity::Verbose,
VeryVerbose = ELogVerbosity::VeryVerbose
};
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(meta = (ScriptName = "CogLogBlueprint")) UCLASS(meta = (ScriptName = "CogLogBlueprint"))
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonLog.h"
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "CogDebugShape.h" #include "CogDebugShape.h"
#include "CogDebugLogBlueprint.h"
#include "UObject/Class.h" #include "UObject/Class.h"
#include "UObject/ObjectMacros.h" #include "UObject/ObjectMacros.h"
#include "CogDebugReplicator.generated.h" #include "CogDebugReplicator.generated.h"
@@ -0,0 +1,50 @@
#pragma once
//--------------------------------------------------------------------------------------------------------------------------
// Hack to access to private members
// https://github.com/YunHsiao/Crysknife/blob/main/SourcePatch/Runtime/Core/Public/Misc/PrivateAccessor.h
// https://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html
//--------------------------------------------------------------------------------------------------------------------------
template<typename Type, Type& Output, Type Input>
struct TRob
{
TRob() { Output = Input; }
static TRob Obj;
};
template<typename Type, Type& Output, Type Input>
TRob<Type, Output, Input> TRob<Type, Output, Input>::Obj;
template<typename OwnerType, typename VariableType>
using TMemberVariableType = VariableType(OwnerType::*);
template<typename OwnerType, typename ReturnType, typename... Args>
using TMemberFunctionType = ReturnType(OwnerType::*)(Args...);
template<typename OwnerType, typename ReturnType, typename... Args>
using TConstMemberFunctionType = ReturnType(OwnerType::*)(Args...) const;
template<typename VariableType>
using TStaticVariableType = VariableType*;
template<typename ReturnType, typename... Args>
using TStaticFunctionType = ReturnType(*)(Args...);
#define INIT_PRIVATE_ACCESSOR(Name, Value) template struct TRob<decltype(Name), Name, &Value>
#define DEFINE_PRIVATE_ACCESSOR(Name, Value, Type, ...) \
static Type<__VA_ARGS__> Name; \
INIT_PRIVATE_ACCESSOR(Name, Value)
/****************************** Syntactic Sugars ******************************/
#define DEFINE_PRIVATE_ACCESSOR_VARIABLE(Name, Class, VariableType, VariableName) DEFINE_PRIVATE_ACCESSOR(Name, Class::VariableName, TMemberVariableType, Class, VariableType)
#define DEFINE_PRIVATE_ACCESSOR_STATIC_VARIABLE(Name, Class, VariableType, VariableName) DEFINE_PRIVATE_ACCESSOR(Name, Class::VariableName, TStaticVariableType, VariableType)
#define DEFINE_PRIVATE_ACCESSOR_FUNCTION(Name, Class, ReturnType, FunctionName, ...) DEFINE_PRIVATE_ACCESSOR(Name, Class::FunctionName, TMemberFunctionType, Class, ReturnType, __VA_ARGS__)
#define DEFINE_PRIVATE_ACCESSOR_CONST_FUNCTION(Name, Class, ReturnType, FunctionName, ...) DEFINE_PRIVATE_ACCESSOR(Name, Class::FunctionName, TConstMemberFunctionType, Class, ReturnType, __VA_ARGS__)
#define DEFINE_PRIVATE_ACCESSOR_STATIC_FUNCTION(Name, Class, ReturnType, FunctionName, ...) DEFINE_PRIVATE_ACCESSOR(Name, Class::FunctionName, TStaticFunctionType, ReturnType, __VA_ARGS__)
#define PRIVATE_ACCESS_OBJ(Obj, Name) (Obj.*Name)
#define PRIVATE_ACCESS_PTR(Ptr, Name) (Ptr->*Name)
#define PRIVATE_ACCESS_STATIC(Name) (*Name)
@@ -2,6 +2,8 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
DECLARE_LOG_CATEGORY_EXTERN(LogCogServerVLOG, Verbose, All);
enum class ECogDebugShape : uint8 enum class ECogDebugShape : uint8
{ {
Invalid, Invalid,
@@ -58,22 +60,22 @@ struct COGDEBUG_API FCogDebugShape
static FCogDebugShape MakeFlatCapsule(const FVector2D& Start, const FVector2D& End, const float Radius, const float Z, const FColor& Color, const float Thickness, const bool bPersistent, const uint8 DepthPriority); static FCogDebugShape MakeFlatCapsule(const FVector2D& Start, const FVector2D& End, const float Radius, const float Z, const FColor& Color, const float Thickness, const bool bPersistent, const uint8 DepthPriority);
static FCogDebugShape MakePolygon(const TArray<FVector>& Verts, const FColor& Color, const bool bPersistent, const uint8 DepthPriority); static FCogDebugShape MakePolygon(const TArray<FVector>& Verts, const FColor& Color, const bool bPersistent, const uint8 DepthPriority);
void DrawPoint(UWorld* World) const; void DrawPoint(const UWorld* World) const;
void DrawSegment(UWorld* World) const; void DrawSegment(const UWorld* World) const;
void DrawBone(UWorld* World) const; void DrawBone(const UWorld* World) const;
void DrawArrow(UWorld* World) const; void DrawArrow(const UWorld* World) const;
void DrawAxes(UWorld* World) const; void DrawAxes(const UWorld* World) const;
void DrawBox(UWorld* World) const; void DrawBox(const UWorld* World) const;
void DrawSolidBox(UWorld* World) const; void DrawSolidBox(const UWorld* World) const;
void DrawCone(UWorld* World) const; void DrawCone(const UWorld* World) const;
void DrawCylinder(UWorld* World) const; void DrawCylinder(const UWorld* World) const;
void DrawCicle(UWorld* World) const; void DrawCircle(const UWorld* World) const;
void DrawCicleArc(UWorld* World) const; void DrawCircleArc(const UWorld* World) const;
void DrawCapsule(UWorld* World) const; void DrawCapsule(const UWorld* World) const;
void DrawFlatCapsule(UWorld* World) const; void DrawFlatCapsule(const UWorld* World) const;
void DrawPolygon(UWorld* World) const; void DrawPolygon(const UWorld* World) const;
void Draw(UWorld* World) const; void Draw(const UWorld* World) const;
}; };
FArchive& operator<<(FArchive& Ar, FCogDebugShape& Shape); FArchive& operator<<(FArchive& Ar, FCogDebugShape& Shape);
@@ -1,6 +1,6 @@
#include "CogDebugLogCategoryDetails.h" #include "CogDebugLogCategoryDetails.h"
#include "CogCommonLogCategory.h" #include "CogCommonLog.h"
#include "CogDebugLog.h" #include "CogDebugLog.h"
#include "DetailWidgetRow.h" #include "DetailWidgetRow.h"
#include "Editor.h" #include "Editor.h"
@@ -1,6 +1,6 @@
#include "SCogDebugLogCategoryGraphPin.h" #include "SCogDebugLogCategoryGraphPin.h"
#include "CogCommonLogCategory.h" #include "CogCommonLog.h"
#include "ScopedTransaction.h" #include "ScopedTransaction.h"
#include "SCogDebugLogCategoryWidget.h" #include "SCogDebugLogCategoryWidget.h"
#include "UObject/UObjectIterator.h" #include "UObject/UObjectIterator.h"
@@ -2,7 +2,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogDebugGraphPanelPinFactory.h" #include "CogDebugGraphPanelPinFactory.h"
#include "CogCommonLogCategory.h" #include "CogCommonLog.h"
#include "EdGraphSchema_K2.h" #include "EdGraphSchema_K2.h"
#include "EdGraphUtilities.h" #include "EdGraphUtilities.h"
#include "SCogDebugLogCategoryGraphPin.h" #include "SCogDebugLogCategoryGraphPin.h"
@@ -166,21 +166,7 @@ void FCogEngineWindow_DebugSettings::RenderContent()
ImGui::SetTooltip("The size of debug arrows."); ImGui::SetTooltip("The size of debug arrows.");
} }
FCogWindowWidgets::SetNextItemToShortWidth(); FCogWindowWidgets::SetNextItemToShortWidth();
ImGui::DragFloat("Gradient Intensity", &Settings.GradientColorIntensity, 0.01f, 0.0f, 1.0f, "%.2f");
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::SetTooltip("How much the debug elements color should be changed by a gradient color over time.");
}
FCogWindowWidgets::SetNextItemToShortWidth();
ImGui::DragFloat("Gradient Speed", &Settings.GradientColorSpeed, 0.1f, 0.0f, 10.0f, "%.1f");
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::SetTooltip("The speed of the gradient color change.");
}
FCogWindowWidgets::SetNextItemToShortWidth();
ImGui::DragFloat("Text Size", &Settings.TextSize, 0.1f, 0.1f, 5.0f, "%.1f"); ImGui::DragFloat("Text Size", &Settings.TextSize, 0.1f, 0.1f, 5.0f, "%.1f");
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary)) if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{ {
@@ -188,6 +174,54 @@ void FCogEngineWindow_DebugSettings::RenderContent()
} }
} }
if (ImGui::CollapsingHeader("Recolor", ImGuiTreeNodeFlags_DefaultOpen))
{
FCogWindowWidgets::SetNextItemToShortWidth();
ECogDebugRecolorMode Mode = Settings.RecolorMode;
if (FCogWindowWidgets::ComboboxEnum("Recolor mode", Mode))
{
Settings.RecolorMode = Mode;
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::SetTooltip("How the debug element should be recolored.");
}
if (Settings.RecolorMode != ECogDebugRecolorMode::None)
{
FCogWindowWidgets::SetNextItemToShortWidth();
ImGui::DragFloat("Recolor Intensity", &Settings.RecolorIntensity, 0.01f, 0.0f, 1.0f, "%.2f");
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::SetTooltip("How much the debug elements color should be changed.");
}
}
if (Settings.RecolorMode == ECogDebugRecolorMode::Color)
{
FCogImguiHelper::ColorEdit4("Recolor Color", Settings.RecolorColor, ColorEditFlags);
}
else if (Settings.RecolorMode == HueOverTime)
{
FCogWindowWidgets::SetNextItemToShortWidth();
ImGui::DragFloat("Recolor Speed", &Settings.RecolorTimeSpeed, 0.1f, 0.0f, 10.0f, "%.1f");
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::SetTooltip("The speed of the recolor.");
}
}
else if (Settings.RecolorMode == ECogDebugRecolorMode::HueOverFrames)
{
FCogWindowWidgets::SetNextItemToShortWidth();
ImGui::DragInt("Recolor Cycle", &Settings.RecolorFrameCycle, 1, 2, 100);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
{
ImGui::SetTooltip("How many frames are used to perform a full hue cycle.");
}
}
}
if (ImGui::CollapsingHeader("Gizmo")) if (ImGui::CollapsingHeader("Gizmo"))
{ {
ImGui::SeparatorText("General"); ImGui::SeparatorText("General");
@@ -227,6 +227,11 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
FCogDebugPlotEntry& Entry = *PlotPtr; FCogDebugPlotEntry& Entry = *PlotPtr;
if (Entry.Values.empty())
{
continue;
}
if (Entry.CurrentRow == PlotIndex) if (Entry.CurrentRow == PlotIndex)
{ {
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogDebugGizmo.h" #include "CogDebugGizmo.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "Engine/HitResult.h" #include "Engine/HitResult.h"
#include "CogEngineCollisionTester.h" #include "CogEngineCollisionTester.h"
#include "CogEngineWindow_CollisionTester.generated.h" #include "CogEngineWindow_CollisionTester.generated.h"
@@ -47,7 +47,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_CollisionTester : public UCogWindowConfig class UCogEngineConfig_CollisionTester : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "Engine/EngineTypes.h" #include "Engine/EngineTypes.h"
#include "CogEngineWindow_CollisionViewer.generated.h" #include "CogEngineWindow_CollisionViewer.generated.h"
@@ -37,7 +37,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_CollisionViewer : public UCogWindowConfig class UCogEngineConfig_CollisionViewer : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogDebug.h" #include "CogDebug.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogEngineWindow_DebugSettings.generated.h" #include "CogEngineWindow_DebugSettings.generated.h"
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -32,7 +32,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_DebugSettings : public UCogWindowConfig class UCogEngineConfig_DebugSettings : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "imgui.h" #include "imgui.h"
#include "CogEngineWindow_Inspector.generated.h" #include "CogEngineWindow_Inspector.generated.h"
@@ -110,7 +110,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_Inspector : public UCogWindowConfig class UCogEngineConfig_Inspector : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogEngineWindow_Metrics.generated.h" #include "CogEngineWindow_Metrics.generated.h"
struct FCogDebugMetricEntry; struct FCogDebugMetricEntry;
@@ -41,7 +41,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_Metrics : public UCogWindowConfig class UCogEngineConfig_Metrics : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "imgui.h" #include "imgui.h"
#include "Misc/OutputDevice.h" #include "Misc/OutputDevice.h"
#include "CogEngineWindow_OutputLog.generated.h" #include "CogEngineWindow_OutputLog.generated.h"
@@ -71,7 +71,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_OutputLog : public UCogWindowConfig class UCogEngineConfig_OutputLog : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogEngineWindow_Plots.generated.h" #include "CogEngineWindow_Plots.generated.h"
struct ImVec2; struct ImVec2;
@@ -50,7 +50,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_Plots : public UCogWindowConfig class UCogEngineConfig_Plots : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogEngineWindow_Selection.generated.h" #include "CogEngineWindow_Selection.generated.h"
class IConsoleObject; class IConsoleObject;
@@ -92,7 +92,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_Selection : public UCogWindowConfig class UCogEngineConfig_Selection : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogDebugGizmo.h" #include "CogDebugGizmo.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogEngineWindow_Transform.generated.h" #include "CogEngineWindow_Transform.generated.h"
class UCogEngineConfig_Transform; class UCogEngineConfig_Transform;
@@ -43,7 +43,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogEngineConfig_Transform : public UCogWindowConfig class UCogEngineConfig_Transform : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -22,6 +22,7 @@ public class CogWindow : ModuleRules
new string[] new string[]
{ {
"Core", "Core",
"CogCommon",
"CogImgui", "CogImgui",
"CogDebug", "CogDebug",
} }
@@ -1,10 +1,8 @@
#include "CogWindow.h" #include "CogWindow.h"
#include "CogDebugDraw.h"
#include "CogDebug.h" #include "CogDebug.h"
#include "CogWindow_Settings.h" #include "CogWindow_Settings.h"
#include "CogWindowManager.h" #include "CogWindowManager.h"
#include "CogWindowWidgets.h"
#include "Engine/World.h" #include "Engine/World.h"
#include "imgui_internal.h" #include "imgui_internal.h"
#include "GameFramework/Pawn.h" #include "GameFramework/Pawn.h"
@@ -180,7 +178,7 @@ ULocalPlayer* FCogWindow::GetLocalPlayer() const
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCogWindowConfig* FCogWindow::GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass) const UCogCommonConfig* FCogWindow::GetConfig(const TSubclassOf<UCogCommonConfig> ConfigClass) const
{ {
return GetOwner()->GetConfig(ConfigClass); return GetOwner()->GetConfig(ConfigClass);
} }
@@ -6,7 +6,6 @@
#include "CogWindow_Layouts.h" #include "CogWindow_Layouts.h"
#include "CogWindow_Settings.h" #include "CogWindow_Settings.h"
#include "CogWindow_Spacing.h" #include "CogWindow_Spacing.h"
#include "CogWindowConfig.h"
#include "CogWindowHelper.h" #include "CogWindowHelper.h"
#include "CogWindowWidgets.h" #include "CogWindowWidgets.h"
#include "Engine/Engine.h" #include "Engine/Engine.h"
@@ -116,7 +115,7 @@ void UCogWindowManager::Shutdown()
} }
Windows.Empty(); Windows.Empty();
for (UCogWindowConfig* Config : Configs) for (UCogCommonConfig* Config : Configs)
{ {
Config->SaveConfig(); Config->SaveConfig();
} }
@@ -163,7 +162,7 @@ void UCogWindowManager::Tick(float DeltaTime)
void UCogWindowManager::Render(float DeltaTime) void UCogWindowManager::Render(float DeltaTime)
{ {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
ImGui::DockSpaceOverViewport(0, ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_NoDockingOverCentralNode | ImGuiDockNodeFlags_AutoHideTabBar); ImGui::DockSpaceOverViewport(0, ImGui::GetWindowViewport(), ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_NoDockingOverCentralNode | ImGuiDockNodeFlags_AutoHideTabBar);
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
@@ -741,19 +740,19 @@ void UCogWindowManager::SortCommands(UPlayerInput* PlayerInput)
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCogWindowConfig* UCogWindowManager::GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass) UCogCommonConfig* UCogWindowManager::GetConfig(const TSubclassOf<UCogCommonConfig> ConfigClass)
{ {
const UClass* Class = ConfigClass.Get(); const UClass* Class = ConfigClass.Get();
for (UCogWindowConfig* Config : Configs) for (UCogCommonConfig* Config : Configs)
{ {
if (Config && Config->IsA(Class)) if (Config && Config->IsA(Class))
{ {
return Cast<UCogWindowConfig>(Config); return Cast<UCogCommonConfig>(Config);
} }
} }
UCogWindowConfig* Config = NewObject<UCogWindowConfig>(this, Class); UCogCommonConfig* Config = NewObject<UCogCommonConfig>(this, Class);
Configs.Add(Config); Configs.Add(Config);
return Config; return Config;
} }
@@ -1020,3 +1020,13 @@ void FCogWindowWidgets::ActorFrame(const AActor& Actor)
AddTextWithShadow(DrawList, FCogImguiHelper::ToImVec2(ScreenPosMin + FVector2D(0, -14.0f)) + Viewport->Pos, Color, TCHAR_TO_ANSI(*FCogWindowHelper::GetActorName(Actor))); AddTextWithShadow(DrawList, FCogImguiHelper::ToImVec2(ScreenPosMin + FVector2D(0, -14.0f)) + Viewport->Pos, Color, TCHAR_TO_ANSI(*FCogWindowHelper::GetActorName(Actor)));
} }
} }
//--------------------------------------------------------------------------------------------------------------------------
void FCogWindowWidgets::SmallButton(const char* Text, const ImVec4& Color)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(Color.x, Color.y, Color.z, Color.w * 0.6f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(Color.x, Color.y, Color.z, Color.w * 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(Color.x, Color.y, Color.z, Color.w * 1.0f));
ImGui::SmallButton(Text);
ImGui::PopStyleColor(3);
}
@@ -83,7 +83,7 @@ void FCogWindow_Settings::RenderContent()
if (ShortcutWidth > 0.0f) if (ShortcutWidth > 0.0f)
{ {
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetWindowContentRegionMax().x - ShortcutWidth); ImGui::SetCursorPosX(ImGui::GetContentRegionAvail().x); // https://github.com/ocornut/imgui/issues/7838
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]); ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]);
ImGui::Text("%s", ShortcutText.Get()); ImGui::Text("%s", ShortcutText.Get());
ImGui::PopStyleColor(); ImGui::PopStyleColor();
@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "imgui.h" #include "imgui.h"
#include "Templates/SubclassOf.h" #include "Templates/SubclassOf.h"
#include "UObject/ReflectedTypeAccessors.h" #include "UObject/ReflectedTypeAccessors.h"
@@ -9,7 +10,6 @@
class AActor; class AActor;
class APawn; class APawn;
class APlayerController; class APlayerController;
class UCogWindowConfig;
class UCogWindowManager; class UCogWindowManager;
class ULocalPlayer; class ULocalPlayer;
class UWorld; class UWorld;
@@ -78,7 +78,7 @@ public:
template<class T> template<class T>
T* GetConfig() { return Cast<T>(GetConfig(T::StaticClass())); } T* GetConfig() { return Cast<T>(GetConfig(T::StaticClass())); }
UCogWindowConfig* GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass) const; UCogCommonConfig* GetConfig(const TSubclassOf<UCogCommonConfig> ConfigClass) const;
template<class T> template<class T>
const T* GetAsset() { return Cast<T>(GetAsset(T::StaticClass())); } const T* GetAsset() { return Cast<T>(GetAsset(T::StaticClass())); }
@@ -1,25 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "CogWindowConfig.generated.h"
UCLASS(Config = Cog)
class COGWINDOW_API UCogWindowConfig : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(Config)
bool bHideMenu = false;
UCogWindowConfig()
{
Reset();
}
virtual void Reset()
{
bHideMenu = true;
}
};
@@ -5,12 +5,12 @@
#include "imgui.h" #include "imgui.h"
#include "CogWindowManager.generated.h" #include "CogWindowManager.generated.h"
class UCogCommonConfig;
class FCogWindow; class FCogWindow;
class FCogWindow_Layouts; class FCogWindow_Layouts;
class FCogWindow_Settings; class FCogWindow_Settings;
class IConsoleObject; class IConsoleObject;
class SCogImguiWidget; class SCogImguiWidget;
class UCogWindowConfig;
class UPlayerInput; class UPlayerInput;
class UWorld; class UWorld;
struct ImGuiSettingsHandler; struct ImGuiSettingsHandler;
@@ -61,7 +61,7 @@ public:
const FCogWindow_Settings* GetSettingsWindow() const { return SettingsWindow; } const FCogWindow_Settings* GetSettingsWindow() const { return SettingsWindow; }
UCogWindowConfig* GetConfig(const TSubclassOf<UCogWindowConfig> ConfigClass); UCogCommonConfig* GetConfig(const TSubclassOf<UCogCommonConfig> ConfigClass);
template<class T> template<class T>
T* GetConfig(); T* GetConfig();
@@ -124,7 +124,7 @@ protected:
static FString ResetLayoutCommand; static FString ResetLayoutCommand;
UPROPERTY() UPROPERTY()
mutable TArray<UCogWindowConfig*> Configs; mutable TArray<UCogCommonConfig*> Configs;
UPROPERTY() UPROPERTY()
mutable TArray<const UObject*> Assets; mutable TArray<const UObject*> Assets;
@@ -172,7 +172,7 @@ T* UCogWindowManager::AddWindow(const FString& Name, bool AddToMainMenu)
template<class T> template<class T>
T* UCogWindowManager::GetConfig() T* UCogWindowManager::GetConfig()
{ {
static_assert(TPointerIsConvertibleFromTo<T, const UCogWindowConfig>::Value); static_assert(TPointerIsConvertibleFromTo<T, const UCogCommonConfig>::Value);
return Cast<T>(&GetConfig(T::StaticClass())); return Cast<T>(&GetConfig(T::StaticClass()));
} }
@@ -102,6 +102,8 @@ public:
static void ActorContextMenu(AActor& Selection, const FCogWindowActorContextMenuFunction& ContextMenuFunction); static void ActorContextMenu(AActor& Selection, const FCogWindowActorContextMenuFunction& ContextMenuFunction);
static void ActorFrame(const AActor& Actor); static void ActorFrame(const AActor& Actor);
static void SmallButton(const char* Text, const ImVec4& Color);
}; };
template<typename EnumType> template<typename EnumType>
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogWindow_Settings.generated.h" #include "CogWindow_Settings.generated.h"
class UCogEngineConfig_Settings; class UCogEngineConfig_Settings;
@@ -36,7 +36,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogWindowConfig_Settings : public UCogWindowConfig class UCogWindowConfig_Settings : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogAIWindow_BehaviorTree.generated.h" #include "CogAIWindow_BehaviorTree.generated.h"
class UBehaviorTreeComponent; class UBehaviorTreeComponent;
@@ -37,7 +37,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAIConfig_BehaviorTree : public UCogWindowConfig class UCogAIConfig_BehaviorTree : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogAIWindow_Blackboard.generated.h" #include "CogAIWindow_Blackboard.generated.h"
class UCogAIConfig_Blackboard; class UCogAIConfig_Blackboard;
@@ -33,7 +33,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAIConfig_Blackboard : public UCogWindowConfig class UCogAIConfig_Blackboard : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,4 +1,5 @@
using UnrealBuildTool; using UnrealBuildTool;
using UnrealBuildTool.Rules;
public class CogAbility : ModuleRules public class CogAbility : ModuleRules
{ {
@@ -37,6 +38,7 @@ public class CogAbility : ModuleRules
new string[] new string[]
{ {
"CoreUObject", "CoreUObject",
"GameplayTasks",
"Engine", "Engine",
} }
); );
@@ -1,5 +1,6 @@
#include "CogAbilityHelper.h" #include "CogAbilityHelper.h"
#include "CogWindowWidgets.h"
#include "GameplayTagContainer.h" #include "GameplayTagContainer.h"
#include "imgui.h" #include "imgui.h"
@@ -12,12 +13,47 @@ FString FCogAbilityHelper::CleanupName(FString Str)
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityHelper::RenderTagContainer(const FGameplayTagContainer& Container) void FCogAbilityHelper::RenderTagContainer(const FGameplayTagContainer& Container, const bool Inline, const ImVec4& Color)
{ {
TArray<FGameplayTag> GameplayTags; TArray<FGameplayTag> GameplayTags;
Container.GetGameplayTagArray(GameplayTags); Container.GetGameplayTagArray(GameplayTags);
for (FGameplayTag Tag : GameplayTags) for (const FGameplayTag& Tag : GameplayTags)
{ {
ImGui::Text("%s", TCHAR_TO_ANSI(*Tag.ToString())); FCogWindowWidgets::SmallButton(StringCast<ANSICHAR>(*Tag.ToString()).Get(), Color);
if (Inline)
{
ImGui::SameLine();
}
}
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityHelper::RenderTagContainer(
const FGameplayTagContainer& ContainerTags,
const FGameplayTagContainer& TagsToMatch,
const bool InverseMatch,
const bool OnlyShowMatches,
const bool Inline,
const ImVec4& NormalColor,
const ImVec4& MatchColor)
{
TArray<FGameplayTag> Tags;
ContainerTags.GetGameplayTagArray(Tags);
for (const FGameplayTag& Tag : Tags)
{
bool hasTag = TagsToMatch.HasTag(Tag);
hasTag = InverseMatch ? !hasTag : hasTag;
if (OnlyShowMatches && hasTag == false) {
continue;
}
const ImVec4 Color = hasTag ? MatchColor : NormalColor;
FCogWindowWidgets::SmallButton(StringCast<ANSICHAR>(*Tag.ToString()).Get(), Color);
if (Inline)
{
ImGui::SameLine();
}
} }
} }
@@ -7,8 +7,12 @@
#include "CogAbilityReplicator.h" #include "CogAbilityReplicator.h"
#include "CogImguiHelper.h" #include "CogImguiHelper.h"
#include "CogWindowWidgets.h" #include "CogWindowWidgets.h"
#include "CogDebugRob.h"
#include "imgui.h" #include "imgui.h"
DEFINE_PRIVATE_ACCESSOR_VARIABLE(GameplayAbility_ActivationBlockedTags, UGameplayAbility, FGameplayTagContainer, ActivationBlockedTags);
DEFINE_PRIVATE_ACCESSOR_VARIABLE(GameplayAbility_ActivationRequiredTags, UGameplayAbility, FGameplayTagContainer, ActivationRequiredTags);
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::Initialize() void FCogAbilityWindow_Abilities::Initialize()
{ {
@@ -41,9 +45,9 @@ void FCogAbilityWindow_Abilities::ResetConfig()
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderTick(float DetlaTime) void FCogAbilityWindow_Abilities::RenderTick(float DeltaTime)
{ {
Super::RenderTick(DetlaTime); Super::RenderTick(DeltaTime);
RenderOpenAbilities(); RenderOpenAbilities();
} }
@@ -112,13 +116,13 @@ void FCogAbilityWindow_Abilities::RenderContent()
return; return;
} }
RenderAbiltiesMenu(Selection); RenderAbilitiesMenu(Selection);
RenderAbilitiesTable(*AbilitySystemComponent); RenderAbilitiesTable(*AbilitySystemComponent);
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbiltiesMenu(AActor* Selection) void FCogAbilityWindow_Abilities::RenderAbilitiesMenu(AActor* Selection)
{ {
if (ImGui::BeginMenuBar()) if (ImGui::BeginMenuBar())
{ {
@@ -151,16 +155,11 @@ void FCogAbilityWindow_Abilities::RenderAbiltiesMenu(AActor* Selection)
ImGui::Separator(); ImGui::Separator();
ImGui::Checkbox("Sort by Name", &Config->SortByName); RenderAbilitiesMenuFilters();
ImGui::Checkbox("Show Active", &Config->ShowActive);
ImGui::Checkbox("Show Inactive", &Config->ShowInactive);
ImGui::Checkbox("Show Blocked", &Config->ShowBlocked);
ImGui::Separator(); ImGui::Separator();
ImGui::ColorEdit4("Active Color", (float*)&Config->ActiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); RenderAbilitiesMenuColorSettings();
ImGui::ColorEdit4("Inactive Color", (float*)&Config->InactiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Blocked Color", (float*)&Config->BlockedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::Separator(); ImGui::Separator();
@@ -178,6 +177,83 @@ void FCogAbilityWindow_Abilities::RenderAbiltiesMenu(AActor* Selection)
} }
} }
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilitiesMenuFilters()
{
ImGui::Checkbox("Sort by Name", &Config->SortByName);
ImGui::Checkbox("Show Active", &Config->ShowActive);
ImGui::Checkbox("Show Inactive", &Config->ShowInactive);
ImGui::Checkbox("Show Pressed", &Config->ShowPressed);
ImGui::Checkbox("Show Blocked", &Config->ShowBlocked);
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilitiesMenuColorSettings()
{
ImGui::ColorEdit4("Active Color", (float*)&Config->ActiveAbilityColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Inactive Color", (float*)&Config->InactiveAbilityColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Blocked Color", (float*)&Config->BlockedAbilityColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Default Tag Color", (float*)&Config->DefaultTagsColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Blocked Tag Color", (float*)&Config->BlockedTagsColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Input Pressed Color", (float*)&Config->InputPressedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilityActivation(FGameplayAbilitySpec& Spec)
{
FCogWindowWidgets::PushStyleCompact();
bool IsActive = Spec.IsActive();
if (ImGui::Checkbox("##Activation", &IsActive))
{
AbilityHandleToActivate = Spec.Handle;
}
FCogWindowWidgets::PopStyleCompact();
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilitiesTableAbilityName(UAbilitySystemComponent& AbilitySystemComponent, int& SelectedIndex, int Index, FGameplayAbilitySpec& Spec, UGameplayAbility* Ability)
{
const ImVec4 Color = GetAbilityColor(AbilitySystemComponent, Spec);
ImGui::PushStyleColor(ImGuiCol_Text, Color);
if (ImGui::Selectable(TCHAR_TO_ANSI(*GetAbilityName(Ability)), SelectedIndex == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap | ImGuiSelectableFlags_AllowDoubleClick))
{
SelectedIndex = Index;
if (ImGui::IsMouseDoubleClicked(0))
{
OpenAbility(Spec.Handle);
}
}
ImGui::PopStyleColor(1);
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilitiesTableAbilityBlocking(UAbilitySystemComponent& AbilitySystemComponent, UGameplayAbility* Ability)
{
if (Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent) == false)
{
FGameplayTagContainer OwnedGameplayTags;
AbilitySystemComponent.GetOwnedGameplayTags(OwnedGameplayTags);
if (const FGameplayTagContainer* ActivationBlockedTags = &PRIVATE_ACCESS_PTR(Ability, GameplayAbility_ActivationBlockedTags))
{
FGameplayTagContainer AllBlockingTags;
AbilitySystemComponent.GetBlockedAbilityTags(AllBlockingTags);
AllBlockingTags.AppendTags(OwnedGameplayTags);
FCogAbilityHelper::RenderTagContainer(*ActivationBlockedTags, AllBlockingTags, false, true, true, ImVec4(0, 0, 0, 0), FCogImguiHelper::ToImVec4(Config->BlockedTagsColor));
}
ImGui::SameLine();
if (const FGameplayTagContainer* ActivationRequiredTags = &PRIVATE_ACCESS_PTR(Ability, GameplayAbility_ActivationRequiredTags))
{
FCogAbilityHelper::RenderTagContainer(*ActivationRequiredTags, OwnedGameplayTags, true, true, true, ImVec4(0, 0, 0, 0), FCogImguiHelper::ToImVec4(Config->BlockedTagsColor));
}
}
}
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent& AbilitySystemComponent) void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent& AbilitySystemComponent)
{ {
@@ -185,7 +261,7 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
TArray<FGameplayAbilitySpec> FitleredAbilities; TArray<FGameplayAbilitySpec> FitleredAbilities;
for (FGameplayAbilitySpec& Spec: Abilities) for (FGameplayAbilitySpec& Spec : Abilities)
{ {
const UGameplayAbility* Ability = Spec.GetPrimaryInstance(); const UGameplayAbility* Ability = Spec.GetPrimaryInstance();
if (Ability == nullptr) if (Ability == nullptr)
@@ -193,24 +269,10 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
Ability = Spec.Ability; Ability = Spec.Ability;
} }
const bool IsJustBlocked = Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent) == false; if (ShouldShowAbility(AbilitySystemComponent, Spec, Ability) == false)
const bool IsJustActive = Spec.IsActive() && IsJustBlocked == false;
const bool IsJustInactive = Spec.IsActive() == false && IsJustBlocked == false;
if (Config->ShowBlocked == false && IsJustBlocked)
{ {
continue; continue;
} }
if (Config->ShowActive == false && IsJustActive)
{
continue;
}
if (Config->ShowInactive == false && IsJustInactive)
{
continue;
}
const auto AbilityName = StringCast<ANSICHAR>(*GetAbilityName(Ability)); const auto AbilityName = StringCast<ANSICHAR>(*GetAbilityName(Ability));
if (Filter.PassFilter(AbilityName.Get()) == false) if (Filter.PassFilter(AbilityName.Get()) == false)
@@ -229,24 +291,8 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
}); });
} }
if (ImGui::BeginTable("Abilities", 6, ImGuiTableFlags_SizingFixedFit if (RenderAbilitiesTableHeader(AbilitySystemComponent))
| ImGuiTableFlags_Resizable
| ImGuiTableFlags_NoBordersInBodyUntilResize
| ImGuiTableFlags_ScrollY
| ImGuiTableFlags_RowBg
| ImGuiTableFlags_BordersV
| ImGuiTableFlags_Reorderable
| ImGuiTableFlags_Hideable))
{ {
ImGui::TableSetupColumn("##Activation", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("Ability");
ImGui::TableSetupColumn("Level");
ImGui::TableSetupColumn("Input");
ImGui::TableSetupColumn("Cooldown");
ImGui::TableSetupColumn("Blocked");
ImGui::TableHeadersRow();
static int SelectedIndex = -1; static int SelectedIndex = -1;
int Index = 0; int Index = 0;
@@ -262,83 +308,7 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
ImGui::PushID(Index); ImGui::PushID(Index);
const ImVec4 Color = GetAbilityColor(AbilitySystemComponent, Spec); RenderAbilitiesTableRow(AbilitySystemComponent, SelectedIndex, Index, Spec, Ability);
ImGui::PushStyleColor(ImGuiCol_Text, Color);
//------------------------
// Activation
//------------------------
ImGui::TableNextColumn();
FCogWindowWidgets::PushStyleCompact();
bool IsActive = Spec.IsActive();
if (ImGui::Checkbox("##Activation", &IsActive))
{
AbilityHandleToActivate = Spec.Handle;
}
FCogWindowWidgets::PopStyleCompact();
//------------------------
// Name
//------------------------
ImGui::TableNextColumn();
if (ImGui::Selectable(TCHAR_TO_ANSI(*GetAbilityName(Ability)), SelectedIndex == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap | ImGuiSelectableFlags_AllowDoubleClick))
{
SelectedIndex = Index;
if (ImGui::IsMouseDoubleClicked(0))
{
OpenAbility(Spec.Handle);
}
}
ImGui::PopStyleColor(1);
//------------------------
// Popup
//------------------------
if (ImGui::IsItemHovered())
{
FCogWindowWidgets::BeginTableTooltip();
RenderAbilityInfo(AbilitySystemComponent, Spec);
FCogWindowWidgets::EndTableTooltip();
}
//------------------------
// ContextMenu
//------------------------
RenderAbilityContextMenu(AbilitySystemComponent, Spec, Index);
//------------------------
// Level
//------------------------
ImGui::TableNextColumn();
ImGui::Text("%d", Spec.Level);
//------------------------
// InputPressed
//------------------------
ImGui::TableNextColumn();
if (Spec.InputPressed > 0)
{
ImGui::Text("%d", Spec.InputPressed);
}
//------------------------
// Cooldown
//------------------------
ImGui::TableNextColumn();
RenderAbilityCooldown(AbilitySystemComponent, *Ability);
//------------------------
// Blocked
//------------------------
ImGui::TableNextColumn();
const bool IsBlocked = Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent) == false;
if (IsBlocked)
{
ImGui::Text("Blocked");
}
ImGui::PopID(); ImGui::PopID();
Index++; Index++;
@@ -348,6 +318,116 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
} }
} }
//--------------------------------------------------------------------------------------------------------------------------
bool FCogAbilityWindow_Abilities::ShouldShowAbility(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, const UGameplayAbility* Ability)
{
const bool IsBlocked = Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent) == false;
if (Config->ShowBlocked && IsBlocked)
{
return true;
}
if (Config->ShowActive && Spec.IsActive())
{
return true;
}
if (Config->ShowInactive && Spec.IsActive() == false)
{
return true;
}
if (Config->ShowPressed && Spec.InputPressed)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------------------
bool FCogAbilityWindow_Abilities::RenderAbilitiesTableHeader(UAbilitySystemComponent& AbilitySystemComponent)
{
if (ImGui::BeginTable("Abilities", 6, ImGuiTableFlags_SizingFixedFit
| ImGuiTableFlags_Resizable
| ImGuiTableFlags_NoBordersInBodyUntilResize
| ImGuiTableFlags_ScrollY
| ImGuiTableFlags_RowBg
| ImGuiTableFlags_BordersV
| ImGuiTableFlags_Reorderable
| ImGuiTableFlags_Hideable))
{
ImGui::TableSetupColumn("##Activation", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("Ability");
ImGui::TableSetupColumn("Level");
ImGui::TableSetupColumn("Input");
ImGui::TableSetupColumn("Cooldown");
ImGui::TableSetupColumn("Blocking");
ImGui::TableHeadersRow();
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilitiesTableRow(UAbilitySystemComponent& AbilitySystemComponent, int& SelectedIndex, int Index, FGameplayAbilitySpec& Spec, UGameplayAbility* Ability)
{
//------------------------
// Activation
//------------------------
ImGui::TableNextColumn();
RenderAbilityActivation(Spec);
//------------------------
// Name
//------------------------
ImGui::TableNextColumn();
RenderAbilitiesTableAbilityName(AbilitySystemComponent, SelectedIndex, Index, Spec, Ability);
//------------------------
// Popup
//------------------------
if (ImGui::IsItemHovered())
{
FCogWindowWidgets::BeginTableTooltip();
RenderAbilityInfo(AbilitySystemComponent, Spec);
FCogWindowWidgets::EndTableTooltip();
}
//------------------------
// ContextMenu
//------------------------
RenderAbilityContextMenu(AbilitySystemComponent, Spec, Index);
//------------------------
// Level
//------------------------
ImGui::TableNextColumn();
RenderAbilityLevel(Spec);
//------------------------
// InputPressed
//------------------------
ImGui::TableNextColumn();
RenderAbilityInputPressed(Spec);
//------------------------
// Cooldown
//------------------------
ImGui::TableNextColumn();
RenderAbilityCooldown(AbilitySystemComponent, *Ability);
//------------------------
// Blocking
//------------------------
ImGui::TableNextColumn();
RenderAbilitiesTableAbilityBlocking(AbilitySystemComponent, Ability);
}
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilityCooldown(const UAbilitySystemComponent& AbilitySystemComponent, UGameplayAbility& Ability) void FCogAbilityWindow_Abilities::RenderAbilityCooldown(const UAbilitySystemComponent& AbilitySystemComponent, UGameplayAbility& Ability)
{ {
@@ -356,8 +436,7 @@ void FCogAbilityWindow_Abilities::RenderAbilityCooldown(const UAbilitySystemComp
return; return;
} }
FGameplayAbilitySpec* Spec = Ability.GetCurrentAbilitySpec(); const FGameplayAbilitySpec* Spec = Ability.GetCurrentAbilitySpec();
if (Spec == nullptr) if (Spec == nullptr)
{ {
return; return;
@@ -375,6 +454,21 @@ void FCogAbilityWindow_Abilities::RenderAbilityCooldown(const UAbilitySystemComp
} }
} }
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilityLevel(FGameplayAbilitySpec& Spec)
{
ImGui::Text("%d", Spec.Level);
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilityInputPressed(FGameplayAbilitySpec& Spec)
{
if (Spec.InputPressed)
{
FCogWindowWidgets::SmallButton("Pressed", FCogImguiHelper::ToImVec4(Config->ActiveAbilityColor));
}
}
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilityContextMenu(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, int Index) void FCogAbilityWindow_Abilities::RenderAbilityContextMenu(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, int Index)
{ {
@@ -443,7 +537,7 @@ void FCogAbilityWindow_Abilities::RenderAbilityInfo(const UAbilitySystemComponen
if (ImGui::BeginTable("Ability", 2, ImGuiTableFlags_Borders)) if (ImGui::BeginTable("Ability", 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("Property");
ImGui::TableSetupColumn("Value"); ImGui::TableSetupColumn("Value");
@@ -510,7 +604,7 @@ void FCogAbilityWindow_Abilities::RenderAbilityInfo(const UAbilitySystemComponen
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Level"); ImGui::TextColored(TextColor, "Level");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%d", Spec.Level); RenderAbilityLevel(Spec);
//------------------------ //------------------------
// InputID // InputID
@@ -526,28 +620,65 @@ void FCogAbilityWindow_Abilities::RenderAbilityInfo(const UAbilitySystemComponen
//------------------------ //------------------------
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "InputPressed"); ImGui::TextColored(TextColor, "Input Pressed");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%d", Spec.InputPressed); RenderAbilityInputPressed(Spec);
//------------------------ //------------------------
// AbilityTags // AbilityTags
//------------------------ //------------------------
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "AbilityTags"); ImGui::TextColored(TextColor, "Ability Tags");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
const bool SatisfyTagRequirements = Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent);
FCogAbilityHelper::RenderTagContainer(Ability->AbilityTags); FCogAbilityHelper::RenderTagContainer(Ability->AbilityTags);
//--------------------------------------------- //------------------------
// TODO: find a way to display blocking tags // RequiredTags
//--------------------------------------------- //------------------------
FGameplayTagContainer OwnedGameplayTags;
AbilitySystemComponent.GetOwnedGameplayTags(OwnedGameplayTags);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Required Tags");
ImGui::TableNextColumn();
if (const FGameplayTagContainer* ActivationRequiredTags = &PRIVATE_ACCESS_PTR(Ability, GameplayAbility_ActivationRequiredTags))
{
FCogAbilityHelper::RenderTagContainer(*ActivationRequiredTags, OwnedGameplayTags, true, false, false, FCogImguiHelper::ToImVec4(Config->DefaultTagsColor), FCogImguiHelper::ToImVec4(Config->BlockedTagsColor));
}
//------------------------
// BlockingTags
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Blocking Tags");
ImGui::TableNextColumn();
if (const FGameplayTagContainer* ActivationBlockedTags = &PRIVATE_ACCESS_PTR(Ability, GameplayAbility_ActivationBlockedTags))
{
FGameplayTagContainer AllBlockingTags;
AbilitySystemComponent.GetBlockedAbilityTags(AllBlockingTags);
AllBlockingTags.AppendTags(OwnedGameplayTags);
FCogAbilityHelper::RenderTagContainer(*ActivationBlockedTags, AllBlockingTags, false, false, false, FCogImguiHelper::ToImVec4(Config->DefaultTagsColor), FCogImguiHelper::ToImVec4(Config->BlockedTagsColor));
}
//------------------------
// Additional info
//------------------------
RenderAbilityAdditionalInfo(AbilitySystemComponent, Spec, *Ability, TextColor);
ImGui::EndTable(); ImGui::EndTable();
} }
} }
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::RenderAbilityAdditionalInfo(const UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, UGameplayAbility& Ability, const ImVec4& TextColor)
{
}
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Abilities::GameTick(float DeltaTime) void FCogAbilityWindow_Abilities::GameTick(float DeltaTime)
{ {
@@ -627,13 +758,13 @@ ImVec4 FCogAbilityWindow_Abilities::GetAbilityColor(const UAbilitySystemComponen
if (Spec.IsActive()) if (Spec.IsActive())
{ {
return FCogImguiHelper::ToImVec4(Config->ActiveColor); return FCogImguiHelper::ToImVec4(Config->ActiveAbilityColor);
} }
if (Ability != nullptr && Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent) == false) if (Ability != nullptr && Ability->DoesAbilitySatisfyTagRequirements(AbilitySystemComponent) == false)
{ {
return FCogImguiHelper::ToImVec4(Config->BlockedColor); return FCogImguiHelper::ToImVec4(Config->BlockedAbilityColor);
} }
return FCogImguiHelper::ToImVec4(Config->InactiveColor); return FCogImguiHelper::ToImVec4(Config->InactiveAbilityColor);
} }
@@ -85,14 +85,14 @@ void FCogAbilityWindow_Effects::RenderContent()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Effects::RenderEffectsTable() void FCogAbilityWindow_Effects::RenderEffectsTable()
{ {
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true); const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
if (AbilitySystemComponent == nullptr) if (AbilitySystemComponent == nullptr)
{ {
ImGui::TextDisabled("Selection has no ability system component"); ImGui::TextDisabled("Selection has no ability system component");
return; return;
} }
if (ImGui::BeginTable("Effects", 4, ImGuiTableFlags_SizingFixedFit if (ImGui::BeginTable("Effects", 5, ImGuiTableFlags_SizingFixedFit
| ImGuiTableFlags_Resizable | ImGuiTableFlags_Resizable
| ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_NoBordersInBodyUntilResize
| ImGuiTableFlags_ScrollY | ImGuiTableFlags_ScrollY
@@ -107,6 +107,7 @@ void FCogAbilityWindow_Effects::RenderEffectsTable()
ImGui::TableSetupColumn("Remaining Time"); ImGui::TableSetupColumn("Remaining Time");
ImGui::TableSetupColumn("Stacks"); ImGui::TableSetupColumn("Stacks");
ImGui::TableSetupColumn("Prediction"); ImGui::TableSetupColumn("Prediction");
ImGui::TableSetupColumn("Inhibited");
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
static int SelectedIndex = -1; static int SelectedIndex = -1;
@@ -258,6 +259,11 @@ void FCogAbilityWindow_Effects::RenderEffectRow(const UAbilitySystemComponent& A
ImGui::TableNextColumn(); ImGui::TableNextColumn();
RenderPrediction(ActiveEffect, true); RenderPrediction(ActiveEffect, true);
//------------------------
// Inhibited
//------------------------
ImGui::TableNextColumn();
RenderInhibition(ActiveEffect, true);
} }
@@ -266,7 +272,7 @@ void FCogAbilityWindow_Effects::RenderEffectInfo(const UAbilitySystemComponent&
{ {
if (ImGui::BeginTable("Effect", 2, ImGuiTableFlags_Borders)) if (ImGui::BeginTable("Effect", 2, ImGuiTableFlags_Borders))
{ {
constexpr 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("Property");
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
@@ -325,6 +331,15 @@ void FCogAbilityWindow_Effects::RenderEffectInfo(const UAbilitySystemComponent&
ImGui::TableNextColumn(); ImGui::TableNextColumn();
RenderPrediction(ActiveEffect, false); RenderPrediction(ActiveEffect, false);
//------------------------
// Inhibited
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Inhibited");
ImGui::TableNextColumn();
RenderInhibition(ActiveEffect, false);
//------------------------ //------------------------
// Dynamic Asset Tags // Dynamic Asset Tags
//------------------------ //------------------------
@@ -406,7 +421,7 @@ void FCogAbilityWindow_Effects::RenderRemainingTime(const UAbilitySystemComponen
if (Duration >= 0) if (Duration >= 0)
{ {
const UWorld* World = AbilitySystemComponent.GetWorld(); const UWorld* World = AbilitySystemComponent.GetWorld();
const float RemainingTime = StartTime + Duration - World->GetTimeSeconds(); const float RemainingTime = StartTime + Duration - World->GetTimeSeconds();
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(100, 100, 100, 255)); ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(100, 100, 100, 255));
@@ -457,6 +472,19 @@ void FCogAbilityWindow_Effects::RenderPrediction(const FActiveGameplayEffect& Ac
ImGui::Text("%s", TCHAR_TO_ANSI(*PredictionString)); ImGui::Text("%s", TCHAR_TO_ANSI(*PredictionString));
} }
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Effects::RenderInhibition(const FActiveGameplayEffect& ActiveEffect, bool Short)
{
if (ActiveEffect.bIsInhibited)
{
FCogWindowWidgets::SmallButton("Yes", ImVec4(1, 0, 0, 1));
}
else
{
ImGui::Text("No");
}
}
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Effects::OpenEffect(const FActiveGameplayEffectHandle& Handle) void FCogAbilityWindow_Effects::OpenEffect(const FActiveGameplayEffectHandle& Handle)
{ {
@@ -472,13 +500,13 @@ void FCogAbilityWindow_Effects::CloseEffect(const FActiveGameplayEffectHandle& H
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Effects::RenderOpenEffects() void FCogAbilityWindow_Effects::RenderOpenEffects()
{ {
const AActor* Selection = GetSelection(); const AActor* Selection = GetSelection();
if (Selection == nullptr) if (Selection == nullptr)
{ {
return; return;
} }
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true); const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true);
if (AbilitySystemComponent == nullptr) if (AbilitySystemComponent == nullptr)
{ {
return; return;
@@ -486,7 +514,7 @@ void FCogAbilityWindow_Effects::RenderOpenEffects()
for (int i = OpenedEffects.Num() - 1; i >= 0; --i) for (int i = OpenedEffects.Num() - 1; i >= 0; --i)
{ {
const FActiveGameplayEffectHandle Handle = OpenedEffects[i]; const FActiveGameplayEffectHandle Handle = OpenedEffects[i];
const FActiveGameplayEffect* ActiveEffectPtr = AbilitySystemComponent->GetActiveGameplayEffect(Handle); const FActiveGameplayEffect* ActiveEffectPtr = AbilitySystemComponent->GetActiveGameplayEffect(Handle);
if (ActiveEffectPtr == nullptr) if (ActiveEffectPtr == nullptr)
@@ -235,6 +235,8 @@ void FCogAbilityWindow_OwnedTags::GetTagContainer(FGameplayTagContainer& TagCont
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
// FCogAbilityWindow_BlockedTags
//------------------------------------------
void FCogAbilityWindow_BlockedTags::Initialize() void FCogAbilityWindow_BlockedTags::Initialize()
{ {
Super::Initialize(); Super::Initialize();
@@ -0,0 +1,414 @@
#include "CogAbilityWindow_Tasks.h"
#include "AbilitySystemGlobals.h"
#include "AbilitySystemComponent.h"
#include "CogAbilityDataAsset.h"
#include "CogAbilityHelper.h"
#include "CogAbilityReplicator.h"
#include "CogImguiHelper.h"
#include "CogWindowHelper.h"
#include "CogWindowWidgets.h"
#include "imgui.h"
class UCogAbilityConfig_Tasks;
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::Initialize()
{
Super::Initialize();
bHasMenu = true;
bNoPadding = true;
Config = GetConfig<UCogAbilityConfig_Tasks>();
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderHelp()
{
ImGui::Text(
"This window displays the gameplay tasks. ");
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::ResetConfig()
{
Super::ResetConfig();
Config->Reset();
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderTick(float DetlaTime)
{
Super::RenderTick(DetlaTime);
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderContent()
{
Super::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;
}
RenderTaskMenu(Selection);
RenderTasksTable(*AbilitySystemComponent);
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderTaskMenu(AActor* Selection)
{
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("Options"))
{
ImGui::Checkbox("Sort by Name", &Config->SortByName);
ImGui::Checkbox("Show Uninitialized", &Config->ShowUninitialized);
ImGui::Checkbox("Show Awaiting Activation", &Config->ShowAwaitingActivation);
ImGui::Checkbox("Show Active", &Config->ShowActive);
ImGui::Checkbox("Show Paused", &Config->ShowPaused);
ImGui::Checkbox("Show Finished", &Config->ShowFinished);
ImGui::Checkbox("Show Ticking", &Config->ShowTicking);
ImGui::Checkbox("Show Simulating", &Config->ShowSimulating);
ImGui::Separator();
ImGui::ColorEdit4("Uninitialized Color", (float*)&Config->UninitializedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Awaiting Activation Color", (float*)&Config->AwaitingActivationColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Active Color", (float*)&Config->ActiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Paused Color", (float*)&Config->PausedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::ColorEdit4("Finished Color", (float*)&Config->FinishedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
ImGui::Separator();
if (ImGui::MenuItem("Reset"))
{
ResetConfig();
}
ImGui::EndMenu();
}
FCogWindowWidgets::SearchBar(Filter);
ImGui::EndMenuBar();
}
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderTasksTable(UAbilitySystemComponent& AbilitySystemComponent)
{
TArray<const UGameplayTask*> FilteredTasks;
FilteredTasks.Reserve(16);
const AActor* Selection = GetSelection();
for (FConstGameplayTaskIterator it = AbilitySystemComponent.GetKnownTaskIterator(); it; ++it)
{
const UGameplayTask* Task = Cast<const UGameplayTask>(*it);
if (Task == nullptr)
{
continue;
}
const EGameplayTaskState TaskState = Task->GetState();
if (Config->ShowUninitialized == false && TaskState == EGameplayTaskState::Uninitialized)
{
continue;
}
if (Config->ShowAwaitingActivation == false && TaskState == EGameplayTaskState::AwaitingActivation)
{
continue;
}
if (Config->ShowActive == false && TaskState == EGameplayTaskState::Active)
{
continue;
}
if (Config->ShowPaused == false && TaskState == EGameplayTaskState::Paused)
{
continue;
}
if (Config->ShowFinished == false && TaskState == EGameplayTaskState::Finished)
{
continue;
}
if (Config->ShowTicking == false && Task->IsTickingTask())
{
continue;
}
if (Config->ShowSimulating == false && Task->IsSimulating())
{
continue;
}
const char* TaskName = StringCast<ANSICHAR>(*Task->GetName()).Get();
bool PassFilter = Filter.PassFilter(TaskName);
if (PassFilter == false)
{
if (const UGameplayAbility* Ability = Cast<UGameplayAbility>(Task->GetTaskOwner()))
{
const char* AbilityName = StringCast<ANSICHAR>(*FCogAbilityHelper::CleanupName(Ability->GetName())).Get();
PassFilter = Filter.PassFilter(AbilityName);
}
}
if (PassFilter == false)
{
continue;
}
FilteredTasks.Add(Task);
}
if (Config->SortByName)
{
FilteredTasks.Sort([](const UGameplayTask& Lhs, const UGameplayTask& Rhs)
{
return Lhs.GetName().Compare(Rhs.GetName()) < 0;
});
}
if (ImGui::BeginTable("Tasks", 4, ImGuiTableFlags_SizingFixedFit
| ImGuiTableFlags_Resizable
| ImGuiTableFlags_NoBordersInBodyUntilResize
| ImGuiTableFlags_ScrollY
| ImGuiTableFlags_RowBg
| ImGuiTableFlags_BordersV
| ImGuiTableFlags_Reorderable
| ImGuiTableFlags_Hideable))
{
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableSetupColumn("State");
ImGui::TableSetupColumn("Task");
ImGui::TableSetupColumn("Owner");
ImGui::TableSetupColumn("Is Ticking");
ImGui::TableHeadersRow();
static int SelectedIndex = -1;
ImGuiListClipper Clipper;
Clipper.Begin(FilteredTasks.Num());
while (Clipper.Step())
{
for (int32 LineIndex = Clipper.DisplayStart; LineIndex < Clipper.DisplayEnd; LineIndex++)
{
const UGameplayTask* Task = FilteredTasks[LineIndex];
ImGui::TableNextRow();
ImGui::PushID(LineIndex);
//------------------------
// State
//------------------------
ImGui::TableNextColumn();
RenderTaskState(Task);
//------------------------
// Name
//------------------------
ImGui::TableNextColumn();
const char* TaskName = StringCast<ANSICHAR>(*Task->GetName()).Get();
if (ImGui::Selectable(TaskName, SelectedIndex == LineIndex, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap | ImGuiSelectableFlags_AllowDoubleClick))
{
SelectedIndex = LineIndex;
}
//------------------------
// Popup
//------------------------
if (ImGui::IsItemHovered())
{
FCogWindowWidgets::BeginTableTooltip();
RenderTaskInfo(Task);
FCogWindowWidgets::EndTableTooltip();
}
//------------------------
// Owner
//------------------------
ImGui::TableNextColumn();
RenderTaskOwner(Task);
//------------------------
// IsTicking
//------------------------
ImGui::TableNextColumn();
ImGui::Text(Task->IsTickingTask() ? "Yes" : "No");
ImGui::PopID();
}
}
Clipper.End();
ImGui::EndTable();
}
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderTaskInfo(const UGameplayTask* Task)
{
if (Task == nullptr)
{
return;
}
if (ImGui::BeginTable("Task", 2, ImGuiTableFlags_Borders))
{
constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
ImGui::TableSetupColumn("Property");
ImGui::TableSetupColumn("Value");
//------------------------
// Name
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Name");
ImGui::TableNextColumn();
ImGui::Text(StringCast<ANSICHAR>(*Task->GetName()).Get());
//------------------------
// Instance Name
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Instance Name");
ImGui::TableNextColumn();
ImGui::Text(StringCast<ANSICHAR>(*Task->GetInstanceName().ToString()).Get());
//------------------------
// Owner
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Ability");
ImGui::TableNextColumn();
RenderTaskOwner(Task);
//------------------------
// State
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "State");
ImGui::TableNextColumn();
RenderTaskState(Task);
//------------------------
// Priority
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Priority");
ImGui::TableNextColumn();
ImGui::Text("%d", (int32)Task->GetPriority());
//------------------------
// IsTicking
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Is Ticking");
ImGui::TableNextColumn();
ImGui::Text(Task->IsTickingTask() ? "Yes" : "No");
//------------------------
// IsSimulated
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Is Simulated");
ImGui::TableNextColumn();
ImGui::Text(Task->IsSimulatedTask() ? "Yes" : "No");
//------------------------
// IsSimulating
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Is Simulating");
ImGui::TableNextColumn();
ImGui::Text(Task->IsSimulating() ? "Yes" : "No");
//------------------------
// Debug
//------------------------
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Debug");
ImGui::TableNextColumn();
ImGui::PushTextWrapPos(FCogWindowWidgets::GetFontWidth() * 80);
ImGui::Text(StringCast<ANSICHAR>(*Task->GetDebugString()).Get());
ImGui::PopTextWrapPos();
ImGui::EndTable();
}
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderTaskOwner(const UGameplayTask* Task)
{
IGameplayTaskOwnerInterface* TaskOwner = Task->GetTaskOwner();
FString OwnerName;
if (const UGameplayAbility* Ability = Cast<UGameplayAbility>(TaskOwner))
{
OwnerName = FCogAbilityHelper::CleanupName(Ability->GetName());
}
else if (const UObject* Object = Cast<UObject>(TaskOwner))
{
OwnerName = GetNameSafe(Object);
}
ImGui::Text(StringCast<ANSICHAR>(*OwnerName).Get());
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogAbilityWindow_Tasks::RenderTaskState(const UGameplayTask* Task)
{
switch (Task->GetState())
{
case EGameplayTaskState::Uninitialized:
FCogWindowWidgets::SmallButton("Uninitialized", FCogImguiHelper::ToImVec4(Config->UninitializedColor));
break;
case EGameplayTaskState::AwaitingActivation:
FCogWindowWidgets::SmallButton("Awaiting Activation", FCogImguiHelper::ToImVec4(Config->AwaitingActivationColor));
break;
case EGameplayTaskState::Active:
FCogWindowWidgets::SmallButton("Active", FCogImguiHelper::ToImVec4(Config->ActiveColor));
break;
case EGameplayTaskState::Paused:
FCogWindowWidgets::SmallButton("Paused", FCogImguiHelper::ToImVec4(Config->PausedColor));
break;
case EGameplayTaskState::Finished:
FCogWindowWidgets::SmallButton("Finished", FCogImguiHelper::ToImVec4(Config->FinishedColor));
break;
}
}
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogWindowConfig.h" #include "CogCommonConfig.h"
#include "CogAbilityConfig_Alignment.generated.h" #include "CogAbilityConfig_Alignment.generated.h"
class UAbilitySystemComponent; class UAbilitySystemComponent;
@@ -14,7 +14,7 @@ struct FModifierSpec;
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAbilityConfig_Alignment : public UCogWindowConfig class UCogAbilityConfig_Alignment : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -15,5 +15,15 @@ public:
static FString CleanupName(FString Str); static FString CleanupName(FString Str);
static void RenderTagContainer(const FGameplayTagContainer& Container); static void RenderTagContainer(const FGameplayTagContainer& Container, const bool Inline = false, const ImVec4& Color = ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
static void RenderTagContainer(
const FGameplayTagContainer& ContainerTags,
const FGameplayTagContainer& TagsToMatch,
const bool InverseMatch = false,
const bool OnlyShowMatches = false,
const bool Inline = false,
const ImVec4& DefaultColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f),
const ImVec4& MatchColor = ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
}; };
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "GameplayAbilitySpecHandle.h" #include "GameplayAbilitySpecHandle.h"
#include "CogAbilityWindow_Abilities.generated.h" #include "CogAbilityWindow_Abilities.generated.h"
@@ -26,18 +26,37 @@ protected:
virtual void RenderHelp() override; virtual void RenderHelp() override;
virtual void RenderTick(float DetlaTime) override; virtual void RenderTick(float DeltaTime) override;
virtual void RenderContent() override; virtual void RenderContent() override;
virtual void GameTick(float DeltaTime) override; virtual void GameTick(float DeltaTime) override;
virtual void RenderAbiltiesMenu(AActor* Selection); virtual void RenderAbilitiesMenu(AActor* Selection);
virtual void RenderAbilitiesMenuFilters();
virtual void RenderAbilitiesMenuColorSettings();
virtual FString GetAbilityName(const UGameplayAbility* Ability); virtual FString GetAbilityName(const UGameplayAbility* Ability);
virtual void RenderAbilitiesTable(UAbilitySystemComponent& AbilitySystemComponent); virtual void RenderAbilitiesTable(UAbilitySystemComponent& AbilitySystemComponent);
virtual bool RenderAbilitiesTableHeader(UAbilitySystemComponent& AbilitySystemComponent);
virtual void RenderAbilitiesTableRow(UAbilitySystemComponent& AbilitySystemComponent, int& SelectedIndex, int Index,
FGameplayAbilitySpec& Spec, UGameplayAbility* Ability);
virtual void RenderAbilityActivation(FGameplayAbilitySpec& Spec);
virtual void RenderAbilitiesTableAbilityName(UAbilitySystemComponent& AbilitySystemComponent, int& SelectedIndex, int Index, FGameplayAbilitySpec& Spec, UGameplayAbility* Ability);
virtual void RenderAbilitiesTableAbilityBlocking(UAbilitySystemComponent& AbilitySystemComponent, UGameplayAbility* Ability);
virtual void RenderAbilityLevel(FGameplayAbilitySpec& Spec);
virtual void RenderAbilityInputPressed(FGameplayAbilitySpec& Spec);
virtual void RenderAbilityCooldown(const UAbilitySystemComponent& AbilitySystemComponent, UGameplayAbility& Ability); virtual void RenderAbilityCooldown(const UAbilitySystemComponent& AbilitySystemComponent, UGameplayAbility& Ability);
virtual void RenderAbilityContextMenu(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, int Index); virtual void RenderAbilityContextMenu(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, int Index);
@@ -46,6 +65,8 @@ protected:
virtual void RenderAbilityInfo(const UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec); virtual void RenderAbilityInfo(const UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec);
virtual void RenderAbilityAdditionalInfo(const UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec, UGameplayAbility& Ability, const ImVec4& TextColor);
virtual void ProcessAbilityActivation(const FGameplayAbilitySpecHandle& Handle); virtual void ProcessAbilityActivation(const FGameplayAbilitySpecHandle& Handle);
virtual void ActivateAbility(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec); virtual void ActivateAbility(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec);
@@ -58,6 +79,9 @@ protected:
virtual ImVec4 GetAbilityColor(const UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec); virtual ImVec4 GetAbilityColor(const UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec);
virtual bool ShouldShowAbility(UAbilitySystemComponent& AbilitySystemComponent, FGameplayAbilitySpec& Spec,
const UGameplayAbility* Ability);
FGameplayAbilitySpecHandle AbilityHandleToActivate; FGameplayAbilitySpecHandle AbilityHandleToActivate;
FGameplayAbilitySpecHandle AbilityHandleToRemove; FGameplayAbilitySpecHandle AbilityHandleToRemove;
@@ -73,7 +97,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAbilityConfig_Abilities : public UCogWindowConfig class UCogAbilityConfig_Abilities : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -88,17 +112,29 @@ public:
UPROPERTY(Config) UPROPERTY(Config)
bool ShowInactive = true; bool ShowInactive = true;
UPROPERTY(Config)
bool ShowPressed = true;
UPROPERTY(Config) UPROPERTY(Config)
bool ShowBlocked = true; bool ShowBlocked = true;
UPROPERTY(Config) UPROPERTY(Config)
FVector4f ActiveColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f); FVector4f ActiveAbilityColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
UPROPERTY(Config) UPROPERTY(Config)
FVector4f InactiveColor = FVector4f(1.0f, 1.0f, 1.0f, 1.0f); FVector4f InactiveAbilityColor = FVector4f(1.0f, 1.0f, 1.0f, 1.0f);
UPROPERTY(Config) UPROPERTY(Config)
FVector4f BlockedColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f); FVector4f BlockedAbilityColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f);
UPROPERTY(Config)
FVector4f DefaultTagsColor = FVector4f(0.6f, 0.6f, 0.6f, 1.0f);
UPROPERTY(Config)
FVector4f BlockedTagsColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f);
UPROPERTY(Config)
FVector4f InputPressedColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
virtual void Reset() override virtual void Reset() override
{ {
@@ -107,9 +143,13 @@ public:
SortByName = false; SortByName = false;
ShowActive = true; ShowActive = true;
ShowInactive = true; ShowInactive = true;
ShowPressed = true;
ShowBlocked = true; ShowBlocked = true;
ActiveColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f); ActiveAbilityColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
InactiveColor = FVector4f(1.0f, 1.0f, 1.0f, 1.0f); InactiveAbilityColor = FVector4f(1.0f, 1.0f, 1.0f, 1.0f);
BlockedColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f); BlockedAbilityColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f);
DefaultTagsColor = FVector4f(0.6f, 0.6f, 0.6f, 1.0f);
BlockedTagsColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f);
InputPressedColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
} }
}; };
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogAbilityWindow_Attributes.generated.h" #include "CogAbilityWindow_Attributes.generated.h"
class UAbilitySystemComponent; class UAbilitySystemComponent;
@@ -42,7 +42,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAbilityConfig_Attributes : public UCogWindowConfig class UCogAbilityConfig_Attributes : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogAbilityWindow_Cheats.generated.h" #include "CogAbilityWindow_Cheats.generated.h"
class AActor; class AActor;
@@ -47,7 +47,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAbilityConfig_Cheats : public UCogWindowConfig class UCogAbilityConfig_Cheats : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -2,8 +2,8 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "ActiveGameplayEffectHandle.h" #include "ActiveGameplayEffectHandle.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "imgui.h" #include "imgui.h"
#include "CogAbilityWindow_Effects.generated.h" #include "CogAbilityWindow_Effects.generated.h"
@@ -48,6 +48,8 @@ protected:
virtual void RenderPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short); virtual void RenderPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short);
virtual void RenderInhibition(const FActiveGameplayEffect& ActiveEffect, bool Short);
virtual FString GetEffectName(const UGameplayEffect& Effect); virtual FString GetEffectName(const UGameplayEffect& Effect);
virtual FString GetEffectNameSafe(const UGameplayEffect* Effect); virtual FString GetEffectNameSafe(const UGameplayEffect* Effect);
@@ -71,7 +73,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAbilityConfig_Effects : public UCogWindowConfig class UCogAbilityConfig_Effects : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogAbilityWindow_Tags.generated.h" #include "CogAbilityWindow_Tags.generated.h"
struct FGameplayTagContainer; struct FGameplayTagContainer;
@@ -67,7 +67,7 @@ class COGABILITY_API FCogAbilityWindow_BlockedTags : public FCogAbilityWindow_Ta
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogAbilityConfig_Tags : public UCogWindowConfig class UCogAbilityConfig_Tags : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -0,0 +1,106 @@
#pragma once
#include "CoreMinimal.h"
#include "CogWindow.h"
#include "CogAbilityWindow_Tasks.generated.h"
class UAbilitySystemComponent;
class UCogAbilityConfig_Tasks;
class UCogAbilityDataAsset;
class UGameplayTask;
class COGABILITY_API FCogAbilityWindow_Tasks : public FCogWindow
{
typedef FCogWindow Super;
public:
virtual void Initialize() override;
protected:
virtual void ResetConfig() override;
virtual void RenderHelp() override;
virtual void RenderTick(float DetlaTime) override;
virtual void RenderContent() override;
virtual void RenderTaskMenu(AActor* Selection);
virtual void RenderTasksTable(UAbilitySystemComponent& AbilitySystemComponent);
virtual void RenderTaskInfo(const UGameplayTask* Task);
virtual void RenderTaskOwner(const UGameplayTask* Task);
virtual void RenderTaskState(const UGameplayTask* Task);
TObjectPtr<UCogAbilityConfig_Tasks> Config = nullptr;
ImGuiTextFilter Filter;
};
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog)
class UCogAbilityConfig_Tasks : public UCogCommonConfig
{
GENERATED_BODY()
public:
UPROPERTY(Config)
bool SortByName = false;
UPROPERTY(Config)
bool ShowTicking = true;
UPROPERTY(Config)
bool ShowSimulating = true;
UPROPERTY(Config)
bool ShowUninitialized = true;
UPROPERTY(Config)
bool ShowAwaitingActivation = true;
UPROPERTY(Config)
bool ShowActive = true;
UPROPERTY(Config)
bool ShowPaused = true;
UPROPERTY(Config)
bool ShowFinished = true;
UPROPERTY(Config)
FVector4f UninitializedColor = FVector4f(0.0f, 0.0f, 0.0f, 1.0f);
UPROPERTY(Config)
FVector4f AwaitingActivationColor = FVector4f(0.6f, 0.6f, 0.6f, 1.0f);
UPROPERTY(Config)
FVector4f ActiveColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
UPROPERTY(Config)
FVector4f PausedColor = FVector4f(0.3f, 0.3f, 0.3f, 1.0f);
UPROPERTY(Config)
FVector4f FinishedColor = FVector4f(1.0f, 0.5f, 0.5f, 1.0f);
virtual void Reset() override
{
Super::Reset();
SortByName = false;
ShowTicking = true;
ShowActive = true;
ShowPaused = true;
ShowFinished = true;
ActiveColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
PausedColor = FVector4f(0.3f, 0.3f, 0.3f, 1.0f);
FinishedColor = FVector4f(0.0f, 1.0f, 0.5f, 1.0f);
}
};
@@ -6,6 +6,7 @@
#include "CogAbilityWindow_Effects.h" #include "CogAbilityWindow_Effects.h"
#include "CogAbilityWindow_Pools.h" #include "CogAbilityWindow_Pools.h"
#include "CogAbilityWindow_Tags.h" #include "CogAbilityWindow_Tags.h"
#include "CogAbilityWindow_Tasks.h"
#include "CogAbilityWindow_Tweaks.h" #include "CogAbilityWindow_Tweaks.h"
#include "CogAIWindow_BehaviorTree.h" #include "CogAIWindow_BehaviorTree.h"
#include "CogAIWindow_Blackboard.h" #include "CogAIWindow_Blackboard.h"
@@ -107,6 +108,8 @@ void Cog::AddAllWindows(UCogWindowManager& CogWindowManager)
CogWindowManager.AddWindow<FCogAbilityWindow_OwnedTags>("Gameplay.Owned Tags"); CogWindowManager.AddWindow<FCogAbilityWindow_OwnedTags>("Gameplay.Owned Tags");
CogWindowManager.AddWindow<FCogAbilityWindow_Tasks>("Gameplay.Tasks");
CogWindowManager.AddWindow<FCogAbilityWindow_Tweaks>("Gameplay.Tweaks"); CogWindowManager.AddWindow<FCogAbilityWindow_Tweaks>("Gameplay.Tweaks");
//--------------------------------------- //---------------------------------------
@@ -22,6 +22,7 @@ public class CogInput : ModuleRules
new string[] new string[]
{ {
"Core", "Core",
"CogCommon",
"CogImgui", "CogImgui",
"CogDebug", "CogDebug",
"CogWindow", "CogWindow",
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogInjectActionInfo.h" #include "CogInjectActionInfo.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "CogInputWindow_Actions.generated.h" #include "CogInputWindow_Actions.generated.h"
class UInputAction; class UInputAction;
@@ -44,7 +44,7 @@ private:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogInputConfig_Actions : public UCogWindowConfig class UCogInputConfig_Actions : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -1,9 +1,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogCommonConfig.h"
#include "CogInjectActionInfo.h" #include "CogInjectActionInfo.h"
#include "CogWindow.h" #include "CogWindow.h"
#include "CogWindowConfig.h"
#include "imgui.h" #include "imgui.h"
#include "InputCoreTypes.h" #include "InputCoreTypes.h"
#include "CogInputWindow_Gamepad.generated.h" #include "CogInputWindow_Gamepad.generated.h"
@@ -66,7 +66,7 @@ protected:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog) UCLASS(Config = Cog)
class UCogInputConfig_Gamepad : public UCogWindowConfig class UCogInputConfig_Gamepad : public UCogCommonConfig
{ {
GENERATED_BODY() GENERATED_BODY()
+10
View File
@@ -1,4 +1,14 @@
# Cog # Cog
## FORK OF ORIGINAL
This fork is setup to build as an engine plugin (and most likely also work fine as a regular project plugin)
It depends on: [UE_ImGui](https://github.com/Ed94/UE_ImGui) which is a fork of [Vescodes's ImGui](https://github.com/VesCodes/ImGui) for Unreal.
This repo no longer has the Imgui libraries they are sourced from the latter's Thirdparty directory.
## Original Readme
Cog is a set of debug tools for Unreal Engine built on top of [Dear ImGui](https://github.com/ocornut/imgui) Cog is a set of debug tools for Unreal Engine built on top of [Dear ImGui](https://github.com/ocornut/imgui)
![Cog](https://github.com/arnaud-jamin/Cog/assets/13844285/21659aea-2cd8-4ef6-b3b0-5795f5f3246b) ![Cog](https://github.com/arnaud-jamin/Cog/assets/13844285/21659aea-2cd8-4ef6-b3b0-5795f5f3246b)