mirror of
https://github.com/Ed94/Cog.git
synced 2026-07-30 11:20:07 +00:00
add a new heroes push back abilities
This commit is contained in:
@@ -23,8 +23,12 @@ void ACogAbilityReplicator::Create(APlayerController* Controller)
|
||||
ACogAbilityReplicator::ACogAbilityReplicator(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
bReplicates = true;
|
||||
RootComponent = ObjectInitializer.CreateOptionalDefaultSubobject<USceneComponent>(this, TEXT("Root"));
|
||||
bOnlyRelevantToOwner = true;
|
||||
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -40,20 +44,23 @@ void ACogAbilityReplicator::GetLifetimeReplicatedProps(TArray< FLifetimeProperty
|
||||
DOREPLIFETIME_WITH_PARAMS_FAST(ACogAbilityReplicator, TweakProfileIndex, Params);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogAbilityReplicator::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
OwnerPlayerController = Cast<APlayerController>(GetOwner());
|
||||
|
||||
if (OwnerPlayerController->IsLocalController())
|
||||
if (OwnerPlayerController != nullptr)
|
||||
{
|
||||
FCogAbilityModule::Get().SetLocalReplicator(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
FCogAbilityModule::Get().AddRemoteReplicator(this);
|
||||
if (OwnerPlayerController->IsLocalController())
|
||||
{
|
||||
FCogAbilityModule::Get().SetLocalReplicator(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
FCogAbilityModule::Get().AddRemoteReplicator(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,11 +155,11 @@ void UCogAbilityWindow_Cheats::RequestCheat(AActor* CheatInstigator, AActor* Sel
|
||||
|
||||
if (ICogInterfacesAllegianceActor* AllegianceInterface = Cast<ICogInterfacesAllegianceActor>(OtherActor))
|
||||
{
|
||||
AllegianceInterface->GetAllegiance(CheatInstigator);
|
||||
AllegianceInterface->GetAllegianceWithOtherActor(CheatInstigator);
|
||||
}
|
||||
|
||||
if ((IsShiftDown && (Allegiance == ECogInterfacesAllegiance::Enemy))
|
||||
|| (IsAltDown && (Allegiance == ECogInterfacesAllegiance::Ally)))
|
||||
|| (IsAltDown && (Allegiance == ECogInterfacesAllegiance::Friendly)))
|
||||
{
|
||||
Actors.Add(OtherActor);
|
||||
}
|
||||
|
||||
@@ -506,13 +506,24 @@ void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeleta
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::ReplicateShape(const UObject* WorldContextObject, const FCogDebugShape& Shape)
|
||||
{
|
||||
const UWorld* World = WorldContextObject != nullptr ? WorldContextObject->GetWorld() : nullptr;
|
||||
UWorld* World = WorldContextObject != nullptr ? WorldContextObject->GetWorld() : nullptr;
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const ENetMode NetMode = World->GetNetMode();
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_ListenServer)
|
||||
{
|
||||
for (const TObjectPtr<ACogDebugReplicator>& Replicator : FCogDebugModule::Get().GetRemoteReplicators())
|
||||
TArray<ACogDebugReplicator*> Replicators;
|
||||
FCogDebugModule::Get().GetRemoteReplicators(*World, Replicators);
|
||||
|
||||
for (ACogDebugReplicator* Replicator : Replicators)
|
||||
{
|
||||
Replicator->ReplicatedShapes.Add(Shape);
|
||||
if (Replicator != nullptr)
|
||||
{
|
||||
Replicator->ReplicatedShapes.Add(Shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "CogDebugDraw.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogString(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector Location, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawString(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector Location, const FLinearColor Color, bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -14,7 +14,7 @@ void UCogDebugDrawBlueprint::DebugLogString(const UObject* WorldContextObject, F
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogPoint(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Size, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawPoint(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Size, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -25,7 +25,7 @@ void UCogDebugDrawBlueprint::DebugLogPoint(const UObject* WorldContextObject, FC
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogSegment(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSegment(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -36,7 +36,7 @@ void UCogDebugDrawBlueprint::DebugLogSegment(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogArrow(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawArrow(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -47,7 +47,7 @@ void UCogDebugDrawBlueprint::DebugLogArrow(const UObject* WorldContextObject, FC
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogAxis(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, const FRotator Rotation, float Scale, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawAxis(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, const FRotator Rotation, float Scale, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -58,7 +58,7 @@ void UCogDebugDrawBlueprint::DebugLogAxis(const UObject* WorldContextObject, FCo
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogSphere(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSphere(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -69,7 +69,7 @@ void UCogDebugDrawBlueprint::DebugLogSphere(const UObject* WorldContextObject, F
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -80,7 +80,7 @@ void UCogDebugDrawBlueprint::DebugLogBox(const UObject* WorldContextObject, FCog
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogSolidBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSolidBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -91,7 +91,7 @@ void UCogDebugDrawBlueprint::DebugLogSolidBox(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogCapsule(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const float HalfHeight, const float Radius, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCapsule(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const float HalfHeight, const float Radius, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -102,7 +102,7 @@ void UCogDebugDrawBlueprint::DebugLogCapsule(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogCircle(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircle(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -113,7 +113,7 @@ void UCogDebugDrawBlueprint::DebugLogCircle(const UObject* WorldContextObject, F
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogCircleArc(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircleArc(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FLinearColor Color, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -124,7 +124,7 @@ void UCogDebugDrawBlueprint::DebugLogCircleArc(const UObject* WorldContextObject
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogPoints(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float Radius, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawPoints(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float Radius, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -135,7 +135,7 @@ void UCogDebugDrawBlueprint::DebugLogPoints(const UObject* WorldContextObject, F
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogPath(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float PointSize, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority)
|
||||
void UCogDebugDrawBlueprint::DebugDrawPath(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float PointSize, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -146,7 +146,7 @@ void UCogDebugDrawBlueprint::DebugLogPath(const UObject* WorldContextObject, FCo
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogString2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector2D Location, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawString2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector2D Location, const FLinearColor Color, bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -157,7 +157,7 @@ void UCogDebugDrawBlueprint::DebugLogString2D(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogSegment2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D SegmentStart, const FVector2D SegmentEnd, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawSegment2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D SegmentStart, const FVector2D SegmentEnd, const FLinearColor Color, bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -168,7 +168,7 @@ void UCogDebugDrawBlueprint::DebugLogSegment2D(const UObject* WorldContextObject
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogCircle2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Location, float Radius, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawCircle2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Location, float Radius, const FLinearColor Color, bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
@@ -179,7 +179,7 @@ void UCogDebugDrawBlueprint::DebugLogCircle2D(const UObject* WorldContextObject,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugDrawBlueprint::DebugLogRect2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Min, const FVector2D Max, const FLinearColor Color, bool Persistent)
|
||||
void UCogDebugDrawBlueprint::DebugDrawRect2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Min, const FVector2D Max, const FLinearColor Color, bool Persistent)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
if (const FLogCategoryBase* LogCategoryPtr = LogCategory.GetLogCategory())
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "CogDebugLogMacros.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogDebugLogBlueprint::Log(FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const AActor* Actor, const FString& Text)
|
||||
void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -16,9 +16,9 @@ void UCogDebugLogBlueprint::Log(FCogLogCategory LogCategory, ECogLogVerbosity Ve
|
||||
return;
|
||||
}
|
||||
|
||||
if (Actor != nullptr)
|
||||
if (WorldContextObject != nullptr)
|
||||
{
|
||||
COG_LOG_ACTOR_NO_CONTEXT(*LogCategoryPtr, (ELogVerbosity::Type)Verbosity, Actor, TEXT("%s"), *Text);
|
||||
COG_LOG_OBJECT_NO_CONTEXT(*LogCategoryPtr, (ELogVerbosity::Type)Verbosity, WorldContextObject, TEXT("%s"), *Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -29,7 +29,7 @@ void UCogDebugLogBlueprint::Log(FCogLogCategory LogCategory, ECogLogVerbosity Ve
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool UCogDebugLogBlueprint::IsLogActive(FCogLogCategory LogCategory, const AActor* Actor)
|
||||
bool UCogDebugLogBlueprint::IsLogActive(const UObject* WorldContextObject, FCogLogCategory LogCategory)
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -40,7 +40,7 @@ bool UCogDebugLogBlueprint::IsLogActive(FCogLogCategory LogCategory, const AActo
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FCogDebugSettings::IsDebugActiveForActor(Actor) == false)
|
||||
if (FCogDebugSettings::IsDebugActiveForObject(WorldContextObject) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ FString FCogDebugLogCategoryInfo::GetDisplayName() const
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// FCogDebugLogCategoryManager
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName)
|
||||
void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName, bool bVisible)
|
||||
{
|
||||
LogCategories.Add(LogCategory.GetCategoryName(),
|
||||
FCogDebugLogCategoryInfo
|
||||
@@ -42,6 +42,7 @@ void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory,
|
||||
&LogCategory,
|
||||
ELogVerbosity::NumVerbosity,
|
||||
DisplayName,
|
||||
bVisible,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -95,18 +96,18 @@ ELogVerbosity::Type FCogDebugLogCategoryManager::GetServerVerbosity(FName Catego
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLogCategoryManager::SetServerVerbosity(FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
void FCogDebugLogCategoryManager::SetServerVerbosity(UWorld& World, FName CategoryName, ELogVerbosity::Type Verbosity)
|
||||
{
|
||||
if (ACogDebugReplicator* Replicator = FCogDebugModule::Get().GetLocalReplicator())
|
||||
if (ACogDebugReplicator* Replicator = FCogDebugModule::Get().GetLocalReplicator(World))
|
||||
{
|
||||
Replicator->Server_SetCategoryVerbosity(CategoryName, (ECogLogVerbosity)Verbosity);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLogCategoryManager::SetServerVerbosityActive(FName CategoryName, bool Value)
|
||||
void FCogDebugLogCategoryManager::SetServerVerbosityActive(UWorld& World, FName CategoryName, bool Value)
|
||||
{
|
||||
SetServerVerbosity(CategoryName, Value ? ELogVerbosity::Verbose : ELogVerbosity::Warning);
|
||||
SetServerVerbosity(World, CategoryName, Value ? ELogVerbosity::Verbose : ELogVerbosity::Warning);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "CogDebugMetric.h"
|
||||
|
||||
#include "CogDebugSettings.h"
|
||||
#include "CogInterfaceFilteredActor.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
float FCogDebugMetric::MaxDurationSetting = 0.0f;
|
||||
@@ -14,12 +13,9 @@ TMap<FName, FCogDebugMetricEntry> FCogDebugMetric::Metrics;
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugMetric::AddMetric(const FCogDebugMetricParams& Params)
|
||||
{
|
||||
if (Cast<ICogInterfacesFilteredActor>(Params.WorldContextObject))
|
||||
if (FCogDebugSettings::IsDebugActiveForObject(Params.WorldContextObject) == false)
|
||||
{
|
||||
if (Params.WorldContextObject != FCogDebugSettings::GetSelection())
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
FCogDebugMetricEntry& Entry = Metrics.FindOrAdd(Params.Name);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "CogDebugModule.h"
|
||||
|
||||
#include "CogDebugReplicator.h"
|
||||
#include "EngineUtils.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FCogDebugModule"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -13,34 +16,25 @@ void FCogDebugModule::ShutdownModule()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ACogDebugReplicator* FCogDebugModule::GetLocalReplicator()
|
||||
ACogDebugReplicator* FCogDebugModule::GetLocalReplicator(UWorld& World)
|
||||
{
|
||||
return LocalReplicator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugModule::SetLocalReplicator(ACogDebugReplicator* Value)
|
||||
{
|
||||
LocalReplicator = Value;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ACogDebugReplicator* FCogDebugModule::GetRemoteReplicator(const APlayerController* PlayerController)
|
||||
{
|
||||
for (ACogDebugReplicator* Replicator : RemoteReplicators)
|
||||
for (TActorIterator<ACogDebugReplicator> It(&World, ACogDebugReplicator::StaticClass()); It; ++It)
|
||||
{
|
||||
if (Replicator->GetPlayerController() == PlayerController)
|
||||
{
|
||||
return Replicator;
|
||||
}
|
||||
ACogDebugReplicator* Replicator = *It;
|
||||
return Replicator;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugModule::AddRemoteReplicator(ACogDebugReplicator* Value)
|
||||
void FCogDebugModule::GetRemoteReplicators(UWorld& World, TArray<ACogDebugReplicator*>& Replicators)
|
||||
{
|
||||
RemoteReplicators.Add(Value);
|
||||
for (TActorIterator<ACogDebugReplicator> It(&World, ACogDebugReplicator::StaticClass()); It; ++It)
|
||||
{
|
||||
ACogDebugReplicator* Replicator = Cast<ACogDebugReplicator>(*It);
|
||||
Replicators.Add(Replicator);
|
||||
}
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "CogDebugDraw.h"
|
||||
#include "CogDebugHelper.h"
|
||||
#include "CogInterfaceFilteredActor.h"
|
||||
#include "CogImguiHelper.h"
|
||||
|
||||
FCogDebugPlotEvent FCogDebugPlot::DefaultEvent;
|
||||
@@ -424,15 +423,9 @@ FCogDebugPlotEntry* FCogDebugPlot::RegisterPlot(const UObject* WorldContextObjec
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Cast to ICogActorFilteringDebugInterface to know if we should filter
|
||||
//---------------------------------------------------------------------------------
|
||||
if (Cast<ICogInterfacesFilteredActor>(WorldContextObject))
|
||||
if (FCogDebugSettings::IsDebugActiveForObject(WorldContextObject) == false)
|
||||
{
|
||||
if (WorldContextObject != FCogDebugSettings::GetSelection())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FCogDebugPlotEntry* EntryPtr = FindPlot(PlotName);
|
||||
|
||||
@@ -115,11 +115,10 @@ ACogDebugReplicator::ACogDebugReplicator(const FObjectInitializer& ObjectInitial
|
||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||
PrimaryActorTick.TickGroup = TG_PrePhysics;
|
||||
|
||||
bHasAuthority = false;
|
||||
bIsLocal = false;
|
||||
bReplicates = true;
|
||||
bOnlyRelevantToOwner = true;
|
||||
|
||||
bHasAuthority = false;
|
||||
ReplicatedData.Owner = this;
|
||||
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
@@ -134,19 +133,13 @@ void ACogDebugReplicator::BeginPlay()
|
||||
check(World);
|
||||
const ENetMode NetMode = World->GetNetMode();
|
||||
bHasAuthority = NetMode != NM_Client;
|
||||
bIsLocal = NetMode != NM_DedicatedServer;
|
||||
|
||||
OwnerPlayerController = Cast<APlayerController>(GetOwner());
|
||||
|
||||
if (OwnerPlayerController->IsLocalController())
|
||||
{
|
||||
FCogDebugModule::Get().SetLocalReplicator(this);
|
||||
Server_RequestAllCategoriesVerbosity();
|
||||
}
|
||||
else
|
||||
{
|
||||
FCogDebugModule::Get().AddRemoteReplicator(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -186,7 +179,7 @@ void ACogDebugReplicator::Server_SetCategoryVerbosity_Implementation(FName LogCa
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
ENetMode NetMode = GetWorld()->GetNetMode();
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_DedicatedServer)
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_ListenServer)
|
||||
{
|
||||
if (FCogDebugLogCategoryInfo* LogCategoryInfo = FCogDebugLogCategoryManager::FindLogCategoryInfo(LogCategoryName))
|
||||
{
|
||||
@@ -239,7 +232,7 @@ void ACogDebugReplicator::Server_RequestAllCategoriesVerbosity_Implementation()
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
ENetMode NetMode = GetWorld()->GetNetMode();
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_DedicatedServer)
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_ListenServer)
|
||||
{
|
||||
TArray<FCogServerCategoryData> CategoriesData;
|
||||
for (auto& Entry : FCogDebugLogCategoryManager::GetLogCategories())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CogDebugSettings.h"
|
||||
|
||||
#include "CogInterfaceFilteredActor.h"
|
||||
#include "CogInterfaceDebugFilteredActor.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TWeakObjectPtr<AActor> FCogDebugSettings::Selection;
|
||||
@@ -66,17 +66,44 @@ void FCogDebugSettings::Reset()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugSettings::IsDebugActiveForActor(const AActor* Actor)
|
||||
bool FCogDebugSettings::IsDebugActiveForObject(const UObject* WorldContextObject)
|
||||
{
|
||||
const AActor* SelectionPtr = Selection.Get();
|
||||
if (Actor == nullptr || SelectionPtr == nullptr)
|
||||
if (FilterBySelection == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Cast<ICogInterfacesFilteredActor>(Actor))
|
||||
if (WorldContextObject == nullptr)
|
||||
{
|
||||
return (SelectionPtr == Actor || FilterBySelection == false);
|
||||
return true;
|
||||
}
|
||||
|
||||
const AActor* SelectionPtr = Selection.Get();
|
||||
if (SelectionPtr == nullptr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const UObject* Outer = WorldContextObject;
|
||||
for (;;)
|
||||
{
|
||||
if (SelectionPtr == Outer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Cast<ICogInterfacesDebugFilteredActor>(Outer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const UObject* NewOuter = Outer->GetOuter();
|
||||
if (NewOuter == Outer || NewOuter == nullptr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Outer = NewOuter;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -13,54 +13,54 @@ class COGDEBUG_API UCogDebugDrawBlueprint : public UBlueprintFunctionLibrary
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogString(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector Location, const FLinearColor Color, bool Persistent);
|
||||
static void DebugDrawString(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector Location, const FLinearColor Color, bool Persistent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogPoint(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float size, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawPoint(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float size, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogSegment(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawSegment(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogArrow(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawArrow(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector SegmentStart, const FVector SegmentEnd, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogAxis(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, const FRotator Rotation, float Scale, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawAxis(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, const FRotator Rotation, float Scale, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogSphere(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawSphere(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Location, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogSolidBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawSolidBox(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const FVector Extent, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogCapsule(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const float HalfHeight, const float Radius, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawCapsule(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector Center, const float HalfHeight, const float Radius, const FQuat Rotation, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogCircle(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawCircle(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float Radius, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogCircleArc(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawCircleArc(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FLinearColor Color, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogPoints(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float Radius, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawPoints(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float Radius, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogPath(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float PointSize, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority);
|
||||
static void DebugDrawPath(const UObject* WorldContextObject, FCogLogCategory LogCategory, const TArray<FVector>& Points, float PointSize, const FLinearColor StartColor, const FLinearColor EndColor, bool Persistent, uint8 DepthPriority);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogString2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector2D Location, const FLinearColor Color, bool Persistent);
|
||||
static void DebugDrawString2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FString& Text, const FVector2D Location, const FLinearColor Color, bool Persistent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogSegment2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D SegmentStart, const FVector2D SegmentEnd, const FLinearColor Color, bool Persistent);
|
||||
static void DebugDrawSegment2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D SegmentStart, const FVector2D SegmentEnd, const FLinearColor Color, bool Persistent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogCircle2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Location, float Radius, const FLinearColor Color, bool Persistent);
|
||||
static void DebugDrawCircle2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Location, float Radius, const FLinearColor Color, bool Persistent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void DebugLogRect2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Min, const FVector2D Max, const FLinearColor Color, bool Persistent);
|
||||
static void DebugDrawRect2D(const UObject* WorldContextObject, FCogLogCategory LogCategory, const FVector2D Min, const FVector2D Max, const FLinearColor Color, bool Persistent);
|
||||
|
||||
};
|
||||
@@ -26,10 +26,10 @@ class COGDEBUG_API UCogDebugLogBlueprint : public UBlueprintFunctionLibrary
|
||||
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Log", meta = (DevelopmentOnly))
|
||||
static void Log(FCogLogCategory LogCategory, ECogLogVerbosity Verbosity = ECogLogVerbosity::Verbose, const AActor* Actor = nullptr, const FString& Text = FString(""));
|
||||
UFUNCTION(BlueprintCallable, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static void Log(const UObject* WorldContextObject, FCogLogCategory LogCategory, ECogLogVerbosity Verbosity = ECogLogVerbosity::Verbose, const FString& Text = FString(""));
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Log", meta = (DevelopmentOnly, AdvancedDisplay = "ScreenTextColor"))
|
||||
static bool IsLogActive(FCogLogCategory LogCategory, const AActor* Actor = nullptr);
|
||||
UFUNCTION(BlueprintPure, meta = (DevelopmentOnly, WorldContext = "WorldContextObject"))
|
||||
static bool IsLogActive(const UObject* WorldContextObject, FCogLogCategory LogCategory);
|
||||
|
||||
};
|
||||
@@ -14,6 +14,7 @@ struct COGDEBUG_API FCogDebugLogCategoryInfo
|
||||
FLogCategoryBase* LogCategory = nullptr;
|
||||
ELogVerbosity::Type ServerVerbosity = ELogVerbosity::NoLogging;
|
||||
FString DisplayName;
|
||||
bool bVisible = true;
|
||||
|
||||
FString GetDisplayName() const;
|
||||
};
|
||||
@@ -21,7 +22,7 @@ struct COGDEBUG_API FCogDebugLogCategoryInfo
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
struct COGDEBUG_API FCogDebugLogCategoryManager
|
||||
{
|
||||
static void AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName = "");
|
||||
static void AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName = "", bool bVisible = true);
|
||||
|
||||
static bool IsVerbosityActive(ELogVerbosity::Type Verbosity);
|
||||
|
||||
@@ -37,13 +38,13 @@ struct COGDEBUG_API FCogDebugLogCategoryManager
|
||||
|
||||
static TMap<FName, FCogDebugLogCategoryInfo>& GetLogCategories() { return LogCategories; }
|
||||
|
||||
static void SetServerVerbosityActive(FName LogCategory, bool Value);
|
||||
static void SetServerVerbosityActive(UWorld& World, FName LogCategory, bool Value);
|
||||
|
||||
static bool IsServerVerbosityActive(FName LogCategory);
|
||||
|
||||
static ELogVerbosity::Type GetServerVerbosity(FName LogCategory);
|
||||
|
||||
static void SetServerVerbosity(FName LogCategory, ELogVerbosity::Type Verbosity);
|
||||
static void SetServerVerbosity(UWorld& World, FName LogCategory, ELogVerbosity::Type Verbosity);
|
||||
|
||||
static void OnServerVerbosityChanged(FName LogCategory, ELogVerbosity::Type Verbosity);
|
||||
|
||||
|
||||
@@ -7,15 +7,16 @@
|
||||
|
||||
#if !ENABLE_COG
|
||||
|
||||
#define COG_LOG_ACTIVE_FOR_OBJECT(Object) (0)
|
||||
#define COG_LOG(LogCategory, Verbosity, Format, ...) (0)
|
||||
#define COG_LOG_FUNC(LogCategory, Verbosity, Format, ...) (0)
|
||||
#define COG_LOG_ACTOR(LogCategory, Verbosity, Actor, Format, ...) (0)
|
||||
#define COG_LOG_ACTOR_NO_CONTEXT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
||||
#define COG_LOG_OBJECT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
||||
#define COG_LOG_OBJECT_NO_CONTEXT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
||||
|
||||
#else //!ENABLE_COG
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
#define COG_LOG_ACTIVE_FOR_ACTOR(Actor) (FCogDebugSettings::IsDebugActiveForActor(Actor))
|
||||
#define COG_LOG_ACTIVE_FOR_OBJECT(Object) (FCogDebugSettings::IsDebugActiveForObject(Object))
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
#define COG_LOG(LogCategory, Verbosity, Format, ...) \
|
||||
@@ -32,20 +33,20 @@
|
||||
COG_LOG(LogCategory, Verbosity, TEXT("%s - %s"), ANSI_TO_TCHAR(__FUNCTION__), *FString::Printf(Format, ##__VA_ARGS__)); \
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
#define COG_LOG_ACTOR(LogCategory, Verbosity, Actor, Format, ...) \
|
||||
if (COG_LOG_ACTIVE_FOR_ACTOR(Actor) || (int32)Verbosity <= (int32)ELogVerbosity::Warning) \
|
||||
#define COG_LOG_OBJECT(LogCategory, Verbosity, Object, Format, ...) \
|
||||
if (COG_LOG_ACTIVE_FOR_OBJECT(Object) || (int32)Verbosity <= (int32)ELogVerbosity::Warning) \
|
||||
{ \
|
||||
COG_LOG(LogCategory, Verbosity, TEXT("%s - %s - %s"), \
|
||||
*GetNameSafe(Actor), \
|
||||
*GetNameSafe(Object), \
|
||||
ANSI_TO_TCHAR(__FUNCTION__), \
|
||||
*FString::Printf(Format, ##__VA_ARGS__)); \
|
||||
} \
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
#define COG_LOG_ACTOR_NO_CONTEXT(LogCategory, Verbosity, Actor, Format, ...) \
|
||||
if (COG_LOG_ACTIVE_FOR_ACTOR(Actor) || (int32)Verbosity <= (int32)ELogVerbosity::Warning) \
|
||||
#define COG_LOG_OBJECT_NO_CONTEXT(LogCategory, Verbosity, Object, Format, ...) \
|
||||
if (COG_LOG_ACTIVE_FOR_OBJECT(Object) || (int32)Verbosity <= (int32)ELogVerbosity::Warning) \
|
||||
{ \
|
||||
COG_LOG(LogCategory, Verbosity, TEXT("%s - %s"), *GetNameSafe(Actor), *FString::Printf(Format, ##__VA_ARGS__)); \
|
||||
COG_LOG(LogCategory, Verbosity, TEXT("%s - %s"), *GetNameSafe(Object), *FString::Printf(Format, ##__VA_ARGS__)); \
|
||||
} \
|
||||
|
||||
|
||||
|
||||
@@ -16,19 +16,10 @@ public:
|
||||
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
ACogDebugReplicator* GetLocalReplicator();
|
||||
ACogDebugReplicator* GetLocalReplicator(UWorld& World);
|
||||
|
||||
void SetLocalReplicator(ACogDebugReplicator* Value);
|
||||
|
||||
ACogDebugReplicator* GetRemoteReplicator(const APlayerController* PlayerController);
|
||||
|
||||
TArray<TObjectPtr<ACogDebugReplicator>> GetRemoteReplicators() const { return RemoteReplicators; }
|
||||
|
||||
void AddRemoteReplicator(ACogDebugReplicator* Value);
|
||||
void GetRemoteReplicators(UWorld& World, TArray<ACogDebugReplicator*>& Replicators);
|
||||
|
||||
private:
|
||||
|
||||
TObjectPtr<ACogDebugReplicator> LocalReplicator;
|
||||
|
||||
TArray<TObjectPtr<ACogDebugReplicator>> RemoteReplicators;
|
||||
};
|
||||
|
||||
@@ -65,8 +65,6 @@ public:
|
||||
|
||||
APlayerController* GetPlayerController() const { return OwnerPlayerController.Get(); }
|
||||
|
||||
bool IsLocal() const { return bIsLocal; }
|
||||
|
||||
TArray<FCogDebugShape> ReplicatedShapes;
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
@@ -87,7 +85,6 @@ protected:
|
||||
TObjectPtr<APlayerController> OwnerPlayerController;
|
||||
|
||||
uint32 bHasAuthority : 1;
|
||||
uint32 bIsLocal : 1;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -8,38 +8,68 @@ struct COGDEBUG_API FCogDebugSettings
|
||||
public:
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static bool IsDebugActiveForActor(const AActor* Actor);
|
||||
static bool IsDebugActiveForObject(const UObject* WorldContextObject);
|
||||
|
||||
static AActor* GetSelection();
|
||||
|
||||
static void SetSelection(AActor* Value);
|
||||
|
||||
static bool GetDebugPersistent(bool bPersistent);
|
||||
|
||||
static float GetDebugDuration(bool bPersistent);
|
||||
|
||||
static float GetDebugTextDuration(bool bPersistent);
|
||||
|
||||
static int GetCircleSegments();
|
||||
|
||||
static int GetDebugSegments();
|
||||
|
||||
static float GetDebugThickness(float Thickness);
|
||||
|
||||
static float GetDebugServerThickness(float Thickness);
|
||||
|
||||
static uint8 GetDebugDepthPriority(float DepthPriority);
|
||||
|
||||
static FColor ModulateDebugColor(const UWorld* World, const FColor& Color, bool bPersistent = true);
|
||||
|
||||
static FColor ModulateServerColor(const FColor& Color);
|
||||
|
||||
static bool IsSecondarySkeletonBone(FName BoneName);
|
||||
|
||||
static void Reset();
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static TWeakObjectPtr<AActor> Selection;
|
||||
|
||||
static bool FilterBySelection;
|
||||
|
||||
static bool Persistent;
|
||||
|
||||
static bool TextShadow;
|
||||
|
||||
static bool Fade2D;
|
||||
|
||||
static float Duration;
|
||||
|
||||
static int DepthPriority;
|
||||
|
||||
static int Segments;
|
||||
|
||||
static float Thickness;
|
||||
|
||||
static float ServerThickness;
|
||||
|
||||
static float ServerColorMultiplier;
|
||||
|
||||
static float ArrowSize;
|
||||
|
||||
static float AxesScale;
|
||||
|
||||
static float GradientColorIntensity;
|
||||
|
||||
static float GradientColorSpeed;
|
||||
|
||||
static float TextSize;
|
||||
|
||||
static TArray<FString> SecondaryBoneWildcards;
|
||||
};
|
||||
|
||||
@@ -24,19 +24,6 @@ void FCogEngineModule::SetLocalReplicator(ACogEngineReplicator* Value)
|
||||
LocalReplicator = Value;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
ACogEngineReplicator* FCogEngineModule::GetRemoteReplicator(const APlayerController* PlayerController)
|
||||
{
|
||||
for (ACogEngineReplicator* Replicator : RemoteReplicators)
|
||||
{
|
||||
if (Replicator->GetPlayerController() == PlayerController)
|
||||
{
|
||||
return Replicator;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineModule::AddRemoteReplicator(ACogEngineReplicator* Value)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,50 @@ void UCogEngineWindow_DebugSettings::RenderHelp()
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_DebugSettings::PostInitProperties()
|
||||
{
|
||||
Super::PostInitProperties();
|
||||
|
||||
FCogDebugSettings::FilterBySelection = FilterBySelection;
|
||||
FCogDebugSettings::Persistent = Persistent;
|
||||
FCogDebugSettings::TextShadow = TextShadow;
|
||||
FCogDebugSettings::Fade2D = Fade2D;
|
||||
FCogDebugSettings::Duration = Duration;
|
||||
FCogDebugSettings::DepthPriority = DepthPriority;
|
||||
FCogDebugSettings::Segments = Segments;
|
||||
FCogDebugSettings::Thickness = Thickness;
|
||||
FCogDebugSettings::ServerThickness = ServerThickness;
|
||||
FCogDebugSettings::ServerColorMultiplier = ServerColorMultiplier;
|
||||
FCogDebugSettings::ArrowSize = ArrowSize;
|
||||
FCogDebugSettings::AxesScale = AxesScale;
|
||||
FCogDebugSettings::GradientColorIntensity = GradientColorIntensity;
|
||||
FCogDebugSettings::GradientColorSpeed = GradientColorSpeed;
|
||||
FCogDebugSettings::TextSize = TextSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_DebugSettings::PreSaveConfig()
|
||||
{
|
||||
Super::PreSaveConfig();
|
||||
|
||||
FilterBySelection = FCogDebugSettings::FilterBySelection;
|
||||
Persistent = FCogDebugSettings::Persistent;
|
||||
TextShadow = FCogDebugSettings::TextShadow;
|
||||
Fade2D = FCogDebugSettings::Fade2D;
|
||||
Duration = FCogDebugSettings::Duration;
|
||||
DepthPriority = FCogDebugSettings::DepthPriority;
|
||||
Segments = FCogDebugSettings::Segments;
|
||||
Thickness = FCogDebugSettings::Thickness;
|
||||
ServerThickness = FCogDebugSettings::ServerThickness;
|
||||
ServerColorMultiplier = FCogDebugSettings::ServerColorMultiplier;
|
||||
ArrowSize = FCogDebugSettings::ArrowSize;
|
||||
AxesScale = FCogDebugSettings::AxesScale;
|
||||
GradientColorIntensity = FCogDebugSettings::GradientColorIntensity;
|
||||
GradientColorSpeed = FCogDebugSettings::GradientColorSpeed;
|
||||
TextSize = FCogDebugSettings::TextSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_DebugSettings::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
|
||||
@@ -81,6 +81,11 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
{
|
||||
FName CategoryName = Entry.Key;
|
||||
const FCogDebugLogCategoryInfo& CategoryInfo = Entry.Value;
|
||||
if (CategoryInfo.bVisible == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FLogCategoryBase* Category = CategoryInfo.LogCategory;
|
||||
|
||||
ImGui::PushID(Index);
|
||||
@@ -102,7 +107,7 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
if (ImGui::Checkbox("##Server", &IsActive))
|
||||
{
|
||||
ELogVerbosity::Type NewVerbosity = IsActive ? (IsControlDown ? ELogVerbosity::VeryVerbose : ELogVerbosity::Verbose) : ELogVerbosity::Warning;
|
||||
FCogDebugLogCategoryManager::SetServerVerbosity(CategoryName, NewVerbosity);
|
||||
FCogDebugLogCategoryManager::SetServerVerbosity(*World, CategoryName, NewVerbosity);
|
||||
}
|
||||
|
||||
if (Verbosity == ELogVerbosity::VeryVerbose)
|
||||
@@ -168,7 +173,7 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
|
||||
if (ImGui::Selectable(FCogDebugHelper::VerbosityToString(Verbosity), IsSelected))
|
||||
{
|
||||
FCogDebugLogCategoryManager::SetServerVerbosity(CategoryName, Verbosity);
|
||||
FCogDebugLogCategoryManager::SetServerVerbosity(*World, CategoryName, Verbosity);
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
|
||||
@@ -14,12 +14,23 @@ void UCogEngineWindow_Metrics::RenderHelp()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Metrics::PostLoad()
|
||||
void UCogEngineWindow_Metrics::PostInitProperties()
|
||||
{
|
||||
Super::PostInitProperties();
|
||||
|
||||
FCogDebugMetric::MaxDurationSetting = MaxDurationSetting;
|
||||
FCogDebugMetric::RestartDelaySetting = RestartDelaySetting;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Metrics::PreSaveConfig()
|
||||
{
|
||||
Super::PreSaveConfig();
|
||||
|
||||
MaxDurationSetting = FCogDebugMetric::MaxDurationSetting;
|
||||
RestartDelaySetting = FCogDebugMetric::RestartDelaySetting;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Metrics::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
@@ -47,17 +58,11 @@ void UCogEngineWindow_Metrics::RenderContent()
|
||||
bool bSettingModified = false;
|
||||
|
||||
FCogWindowWidgets::PushStyleCompact();
|
||||
if (ImGui::DragFloat("Auto Restart Delay", &RestartDelaySetting, 0.1f, 0.0f, FLT_MAX, "%0.1f"))
|
||||
{
|
||||
FCogDebugMetric::RestartDelaySetting = RestartDelaySetting;
|
||||
}
|
||||
ImGui::DragFloat("Auto Restart Delay", &FCogDebugMetric::RestartDelaySetting, 0.1f, 0.0f, FLT_MAX, "%0.1f");
|
||||
FCogWindowWidgets::PopStyleCompact();
|
||||
|
||||
FCogWindowWidgets::PushStyleCompact();
|
||||
if (ImGui::DragFloat("Max Time", &MaxDurationSetting, 0.1f, 0.0f, FLT_MAX, "%0.1f"))
|
||||
{
|
||||
FCogDebugMetric::MaxDurationSetting = MaxDurationSetting;
|
||||
}
|
||||
ImGui::DragFloat("Max Time", &FCogDebugMetric::MaxDurationSetting, 0.1f, 0.0f, FLT_MAX, "%0.1f");
|
||||
FCogWindowWidgets::PopStyleCompact();
|
||||
|
||||
ImGui::EndMenu();
|
||||
|
||||
@@ -20,8 +20,6 @@ public:
|
||||
|
||||
void SetLocalReplicator(ACogEngineReplicator* Value);
|
||||
|
||||
ACogEngineReplicator* GetRemoteReplicator(const APlayerController* PlayerController);
|
||||
|
||||
TArray<TObjectPtr<ACogEngineReplicator>> GetRemoteReplicators() const { return RemoteReplicators; }
|
||||
|
||||
void AddRemoteReplicator(ACogEngineReplicator* Value);
|
||||
|
||||
@@ -4,15 +4,67 @@
|
||||
#include "CogWindow.h"
|
||||
#include "CogEngineWindow_DebugSettings.generated.h"
|
||||
|
||||
UCLASS()
|
||||
UCLASS(Config = Cog)
|
||||
class COGENGINE_API UCogEngineWindow_DebugSettings : public UCogWindow
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void RenderHelp()override;
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreSaveConfig() override;
|
||||
|
||||
virtual void PostInitProperties() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool FilterBySelection = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool Persistent = false;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool TextShadow = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool Fade2D = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float Duration = 3.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int DepthPriority = 0;
|
||||
|
||||
UPROPERTY(Config)
|
||||
int Segments = 12;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float Thickness = 0.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float ServerThickness = 2.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float ServerColorMultiplier = 0.8f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float ArrowSize = 10.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float AxesScale = 1.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float GradientColorIntensity = 0.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float GradientColorSpeed = 2.0f;
|
||||
|
||||
UPROPERTY(Config)
|
||||
float TextSize = 1.0f;
|
||||
};
|
||||
|
||||
@@ -16,9 +16,11 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
virtual void PostInitProperties() override;
|
||||
|
||||
virtual void PostLoad() override;
|
||||
virtual void PreSaveConfig() override;
|
||||
|
||||
virtual void RenderHelp() override;
|
||||
|
||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
UENUM(BlueprintType)
|
||||
enum class ECogInterfacesAllegiance : uint8
|
||||
{
|
||||
Ally,
|
||||
Enemy
|
||||
Friendly,
|
||||
Enemy,
|
||||
Neutral
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -25,5 +26,5 @@ class ICogInterfacesAllegianceActor
|
||||
|
||||
public:
|
||||
|
||||
virtual ECogInterfacesAllegiance GetAllegiance(const AActor* OtherActor) const = 0;
|
||||
virtual ECogInterfacesAllegiance GetAllegianceWithOtherActor(const AActor* OtherActor) const = 0;
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogInterfaceDebugFilteredActor.generated.h"
|
||||
|
||||
UINTERFACE(MinimalAPI, Blueprintable)
|
||||
class UCogInterfacesDebugFilteredActor : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
class ICogInterfacesDebugFilteredActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogInterfaceFilteredActor.generated.h"
|
||||
|
||||
UINTERFACE(MinimalAPI, Blueprintable)
|
||||
class UCogInterfacesFilteredActor : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
class ICogInterfacesFilteredActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
@@ -34,7 +34,7 @@ void UCogWindowManager::Shutdown()
|
||||
{
|
||||
for (UCogWindow* Window : Windows)
|
||||
{
|
||||
Window->Shutdown();
|
||||
Window->PreSaveConfig();
|
||||
Window->SaveConfig();
|
||||
}
|
||||
|
||||
@@ -146,6 +146,15 @@ void UCogWindowManager::SetHideAllWindows(bool Value)
|
||||
bHideAllWindows = HideAllWindowsCounter > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::ResetLayout()
|
||||
{
|
||||
for (UCogWindow* Window : Windows)
|
||||
{
|
||||
ImGui::SetWindowPos(TCHAR_TO_ANSI(*Window->GetName()), ImVec2(10, 10), ImGuiCond_Always);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogWindowManager::CloseAllWindows()
|
||||
{
|
||||
@@ -230,7 +239,17 @@ void UCogWindowManager::DrawMainMenu()
|
||||
|
||||
if (ImGui::BeginMenu("Window"))
|
||||
{
|
||||
if (ImGui::BeginMenu("Load Layout"))
|
||||
if (ImGui::MenuItem("Close All Windows"))
|
||||
{
|
||||
CloseAllWindows();
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem("Reset Window Layout"))
|
||||
{
|
||||
ResetLayout();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Load Window Layout"))
|
||||
{
|
||||
for (int32 i = 1; i <= 4; ++i)
|
||||
{
|
||||
@@ -243,7 +262,7 @@ void UCogWindowManager::DrawMainMenu()
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Save Layout"))
|
||||
if (ImGui::BeginMenu("Save Window Layout"))
|
||||
{
|
||||
for (int32 i = 1; i <= 4; ++i)
|
||||
{
|
||||
@@ -258,12 +277,6 @@ void UCogWindowManager::DrawMainMenu()
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("Close All"))
|
||||
{
|
||||
CloseAllWindows();
|
||||
}
|
||||
|
||||
ImGui::MenuItem("Transparent Mode", nullptr, &bTransparentMode);
|
||||
ImGui::MenuItem("Compact Mode", nullptr, &bCompactMode);
|
||||
|
||||
ImGui::Text("DPI Scale");
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
virtual void Initialize() {}
|
||||
|
||||
virtual void Shutdown() {}
|
||||
virtual void PreSaveConfig() {}
|
||||
|
||||
/** Called every frame with a valid imgui context if the window is visible. */
|
||||
virtual void Render(float DeltaTime);
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
void CloseAllWindows();
|
||||
|
||||
void ResetLayout();
|
||||
|
||||
void LoadLayout(int LayoutIndex);
|
||||
|
||||
void SaveLayout(int LayoutIndex);
|
||||
|
||||
Reference in New Issue
Block a user