mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 00:01:37 -07:00
Replicate client selection to the server to filter server debug replication
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[/Script/GameplayDebugger.GameplayDebuggerUserSettings]
|
||||
FontSize=15
|
||||
|
||||
Binary file not shown.
@@ -514,18 +514,27 @@ void FCogDebugDraw::ReplicateShape(const UObject* WorldContextObject, const FCog
|
||||
}
|
||||
|
||||
const ENetMode NetMode = World->GetNetMode();
|
||||
if (NetMode == NM_DedicatedServer || NetMode == NM_ListenServer)
|
||||
if (NetMode != NM_DedicatedServer && NetMode != NM_ListenServer)
|
||||
{
|
||||
TArray<ACogDebugReplicator*> Replicators;
|
||||
ACogDebugReplicator::GetRemoteReplicators(*World, Replicators);
|
||||
return;
|
||||
}
|
||||
|
||||
for (ACogDebugReplicator* Replicator : Replicators)
|
||||
TArray<ACogDebugReplicator*> Replicators;
|
||||
ACogDebugReplicator::GetRemoteReplicators(*World, Replicators);
|
||||
|
||||
for (ACogDebugReplicator* Replicator : Replicators)
|
||||
{
|
||||
if (Replicator == nullptr)
|
||||
{
|
||||
if (Replicator != nullptr)
|
||||
{
|
||||
Replicator->ReplicatedShapes.Add(Shape);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (FCogDebugSettings::IsReplicatedDebugActiveForObject(WorldContextObject, Replicator->GetServerSelection(), Replicator->IsServerFilteringBySelection()) == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Replicator->ReplicatedShapes.Add(Shape);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ void ACogDebugReplicator::BeginPlay()
|
||||
if (OwnerPlayerController->IsLocalController())
|
||||
{
|
||||
Server_RequestAllCategoriesVerbosity();
|
||||
Server_SetSelection(FCogDebugSettings::GetSelection());
|
||||
Server_SetIsFilteringBySelection(FCogDebugSettings::GetIsFilteringBySelection());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ void ACogDebugReplicator::TickActor(float DeltaTime, enum ELevelTick TickType, F
|
||||
{
|
||||
if (GetWorld()->GetNetMode() == NM_Client)
|
||||
{
|
||||
for (FCogDebugShape ReplicatedShape : ReplicatedShapes)
|
||||
for (const FCogDebugShape& ReplicatedShape : ReplicatedShapes)
|
||||
{
|
||||
ReplicatedShape.Draw(GetWorld());
|
||||
}
|
||||
@@ -195,6 +197,26 @@ void ACogDebugReplicator::Server_RequestAllCategoriesVerbosity_Implementation()
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogDebugReplicator::Server_SetIsFilteringBySelection_Implementation(bool Value)
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
bIsServerFilteringBySelection = Value;
|
||||
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogDebugReplicator::Server_SetSelection_Implementation(AActor* Value)
|
||||
{
|
||||
#if !UE_BUILD_SHIPPING
|
||||
|
||||
ServerSelection = Value;
|
||||
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// FCogReplicatorNetPack
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -277,4 +299,4 @@ bool FCogReplicatorNetPack::NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "CogDebugSettings.h"
|
||||
|
||||
#include "CogCommonDebugFilteredActorInterface.h"
|
||||
#include "CogDebugReplicator.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TWeakObjectPtr<AActor> FCogDebugSettings::Selection;
|
||||
bool FCogDebugSettings::FilterBySelection = true;
|
||||
bool FCogDebugSettings::bIsFilteringBySelection = true;
|
||||
bool FCogDebugSettings::Persistent = false;
|
||||
bool FCogDebugSettings::TextShadow = true;
|
||||
bool FCogDebugSettings::Fade2D = true;
|
||||
@@ -48,7 +49,7 @@ TArray<FString> FCogDebugSettings::SecondaryBoneWildcards =
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugSettings::Reset()
|
||||
{
|
||||
FilterBySelection = true;
|
||||
bIsFilteringBySelection = true;
|
||||
Persistent = false;
|
||||
TextShadow = true;
|
||||
Fade2D = true;
|
||||
@@ -68,7 +69,32 @@ void FCogDebugSettings::Reset()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugSettings::IsDebugActiveForObject(const UObject* WorldContextObject)
|
||||
{
|
||||
if (FilterBySelection == false)
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (World->GetNetMode() == NM_DedicatedServer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Result = IsDebugActiveForObject_Internal(WorldContextObject, Selection.Get(), bIsFilteringBySelection);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugSettings::IsReplicatedDebugActiveForObject(const UObject* WorldContextObject, const AActor* ServerSelection, bool IsServerFilteringBySelection)
|
||||
{
|
||||
return IsDebugActiveForObject_Internal(WorldContextObject, ServerSelection, IsServerFilteringBySelection);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugSettings::IsDebugActiveForObject_Internal(const UObject* WorldContextObject, const AActor* InSelection, bool InIsFilteringBySelection)
|
||||
{
|
||||
if (InIsFilteringBySelection == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -78,7 +104,7 @@ bool FCogDebugSettings::IsDebugActiveForObject(const UObject* WorldContextObject
|
||||
return true;
|
||||
}
|
||||
|
||||
const AActor* SelectionPtr = Selection.Get();
|
||||
const AActor* SelectionPtr = InSelection;
|
||||
if (SelectionPtr == nullptr)
|
||||
{
|
||||
return true;
|
||||
@@ -116,9 +142,37 @@ AActor* FCogDebugSettings::GetSelection()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugSettings::SetSelection(AActor* Value)
|
||||
void FCogDebugSettings::SetSelection(UWorld* World, AActor* Value)
|
||||
{
|
||||
Selection = Value;
|
||||
|
||||
if (World != nullptr && World->GetNetMode() == NM_Client)
|
||||
{
|
||||
if (ACogDebugReplicator* Replicator = ACogDebugReplicator::GetLocalReplicator(*World))
|
||||
{
|
||||
Replicator->Server_SetSelection(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool FCogDebugSettings::GetIsFilteringBySelection()
|
||||
{
|
||||
return bIsFilteringBySelection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugSettings::SetIsFilteringBySelection(UWorld* World, bool Value)
|
||||
{
|
||||
bIsFilteringBySelection = Value;
|
||||
|
||||
if (World != nullptr && World->GetNetMode() == NM_Client)
|
||||
{
|
||||
if (ACogDebugReplicator* Replicator = ACogDebugReplicator::GetLocalReplicator(*World))
|
||||
{
|
||||
Replicator->Server_SetIsFilteringBySelection(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@ FCogDebugShape FCogDebugShape::MakePoint(const FVector& Location, const float Si
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawPoint(UWorld* World)
|
||||
void FCogDebugShape::DrawPoint(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -60,7 +60,7 @@ FCogDebugShape FCogDebugShape::MakeSegment(const FVector& StartLocation, const F
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawSegment(UWorld* World)
|
||||
void FCogDebugShape::DrawSegment(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -100,7 +100,7 @@ FCogDebugShape FCogDebugShape::MakeArrow(const FVector& StartLocation, const FVe
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawArrow(UWorld* World)
|
||||
void FCogDebugShape::DrawArrow(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -141,7 +141,7 @@ FCogDebugShape FCogDebugShape::MakeAxes(const FVector& Location, const FRotator&
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawAxes(UWorld* World)
|
||||
void FCogDebugShape::DrawAxes(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -181,7 +181,7 @@ FCogDebugShape FCogDebugShape::MakeBox(const FVector& Center, const FRotator& Ro
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawBox(UWorld* World)
|
||||
void FCogDebugShape::DrawBox(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -220,7 +220,7 @@ FCogDebugShape FCogDebugShape::MakeSolidBox(const FVector& Center, const FRotato
|
||||
}
|
||||
|
||||
|
||||
void FCogDebugShape::DrawSolidBox(UWorld* World)
|
||||
void FCogDebugShape::DrawSolidBox(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -260,7 +260,7 @@ FCogDebugShape FCogDebugShape::MakeCone(const FVector& Location, const FVector&
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawCone(UWorld* World)
|
||||
void FCogDebugShape::DrawCone(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -303,7 +303,7 @@ FCogDebugShape FCogDebugShape::MakeCylinder(const FVector& Center, const float R
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawCylinder(UWorld* World)
|
||||
void FCogDebugShape::DrawCylinder(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -345,7 +345,7 @@ FCogDebugShape FCogDebugShape::MakeCircle(const FVector& Center, const FRotator&
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawCicle(UWorld* World)
|
||||
void FCogDebugShape::DrawCicle(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -387,7 +387,7 @@ FCogDebugShape FCogDebugShape::MakeCircleArc(const FVector& Center, const FRotat
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawCicleArc(UWorld* World)
|
||||
void FCogDebugShape::DrawCicleArc(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -430,7 +430,7 @@ FCogDebugShape FCogDebugShape::MakeCapsule(const FVector& Center, const FQuat& R
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawCapsule(UWorld* World)
|
||||
void FCogDebugShape::DrawCapsule(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -472,7 +472,7 @@ FCogDebugShape FCogDebugShape::MakeFlatCapsule(const FVector2D& Start, const FVe
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawFlatCapsule(UWorld* World)
|
||||
void FCogDebugShape::DrawFlatCapsule(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -514,7 +514,7 @@ FCogDebugShape FCogDebugShape::MakeBone(const FVector& BoneLocation, const FVect
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawBone(UWorld* World)
|
||||
void FCogDebugShape::DrawBone(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -560,7 +560,7 @@ FCogDebugShape FCogDebugShape::MakePolygon(const TArray<FVector>& Verts, const F
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::DrawPolygon(UWorld* World)
|
||||
void FCogDebugShape::DrawPolygon(UWorld* World) const
|
||||
{
|
||||
#if ENABLE_COG
|
||||
|
||||
@@ -590,7 +590,7 @@ void FCogDebugShape::DrawPolygon(UWorld* World)
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugShape::Draw(UWorld* World)
|
||||
void FCogDebugShape::Draw(UWorld* World) const
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
|
||||
@@ -85,6 +85,16 @@ public:
|
||||
UFUNCTION(Client, Reliable)
|
||||
void Client_SendCategoriesVerbosity(const TArray<FCogServerCategoryData>& Categories);
|
||||
|
||||
AActor* GetServerSelection() const { return ServerSelection.Get(); }
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void Server_SetSelection(AActor* Value);
|
||||
|
||||
bool IsServerFilteringBySelection() const { return bIsServerFilteringBySelection; }
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void Server_SetIsFilteringBySelection(bool Value);
|
||||
|
||||
protected:
|
||||
friend FCogReplicatorNetPack;
|
||||
|
||||
@@ -92,8 +102,10 @@ protected:
|
||||
|
||||
uint32 bHasAuthority : 1;
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(Replicated)
|
||||
FCogReplicatorNetPack ReplicatedData;
|
||||
|
||||
TWeakObjectPtr<AActor> ServerSelection = nullptr;
|
||||
|
||||
bool bIsServerFilteringBySelection = true;
|
||||
};
|
||||
|
||||
@@ -9,10 +9,16 @@ public:
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static bool IsDebugActiveForObject(const UObject* WorldContextObject);
|
||||
|
||||
static bool IsReplicatedDebugActiveForObject(const UObject* WorldContextObject, const AActor* ServerSelection, bool IsServerFilteringBySelection);
|
||||
|
||||
static AActor* GetSelection();
|
||||
|
||||
static void SetSelection(AActor* Value);
|
||||
static void SetSelection(UWorld* World, AActor* Value);
|
||||
|
||||
static bool GetIsFilteringBySelection();
|
||||
|
||||
static void SetIsFilteringBySelection(UWorld* World, bool Value);
|
||||
|
||||
static bool GetDebugPersistent(bool bPersistent);
|
||||
|
||||
static float GetDebugDuration(bool bPersistent);
|
||||
@@ -37,11 +43,6 @@ public:
|
||||
|
||||
static void Reset();
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
static TWeakObjectPtr<AActor> Selection;
|
||||
|
||||
static bool FilterBySelection;
|
||||
|
||||
static bool Persistent;
|
||||
|
||||
static bool TextShadow;
|
||||
@@ -71,4 +72,12 @@ public:
|
||||
static float TextSize;
|
||||
|
||||
static TArray<FString> SecondaryBoneWildcards;
|
||||
|
||||
private:
|
||||
|
||||
static bool IsDebugActiveForObject_Internal(const UObject* WorldContextObject, const AActor* InSelection, bool InIsFilteringBySelection);
|
||||
|
||||
static TWeakObjectPtr<AActor> Selection;
|
||||
|
||||
static bool bIsFilteringBySelection;
|
||||
};
|
||||
|
||||
@@ -58,22 +58,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 MakePolygon(const TArray<FVector>& Verts, const FColor& Color, const bool bPersistent, const uint8 DepthPriority);
|
||||
|
||||
void DrawPoint(UWorld* World);
|
||||
void DrawSegment(UWorld* World);
|
||||
void DrawBone(UWorld* World);
|
||||
void DrawArrow(UWorld* World);
|
||||
void DrawAxes(UWorld* World);
|
||||
void DrawBox(UWorld* World);
|
||||
void DrawSolidBox(UWorld* World);
|
||||
void DrawCone(UWorld* World);
|
||||
void DrawCylinder(UWorld* World);
|
||||
void DrawCicle(UWorld* World);
|
||||
void DrawCicleArc(UWorld* World);
|
||||
void DrawCapsule(UWorld* World);
|
||||
void DrawFlatCapsule(UWorld* World);
|
||||
void DrawPolygon(UWorld* World);
|
||||
void DrawPoint(UWorld* World) const;
|
||||
void DrawSegment(UWorld* World) const;
|
||||
void DrawBone(UWorld* World) const;
|
||||
void DrawArrow(UWorld* World) const;
|
||||
void DrawAxes(UWorld* World) const;
|
||||
void DrawBox(UWorld* World) const;
|
||||
void DrawSolidBox(UWorld* World) const;
|
||||
void DrawCone(UWorld* World) const;
|
||||
void DrawCylinder(UWorld* World) const;
|
||||
void DrawCicle(UWorld* World) const;
|
||||
void DrawCicleArc(UWorld* World) const;
|
||||
void DrawCapsule(UWorld* World) const;
|
||||
void DrawFlatCapsule(UWorld* World) const;
|
||||
void DrawPolygon(UWorld* World) const;
|
||||
|
||||
void Draw(UWorld* World);
|
||||
void Draw(UWorld* World) const;
|
||||
};
|
||||
|
||||
FArchive& operator<<(FArchive& Ar, FCogDebugShape& Shape);
|
||||
|
||||
@@ -178,4 +178,4 @@ void ACogEngineReplicator::Server_ResetPossession_Implementation()
|
||||
}
|
||||
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void UCogEngineWindow_DebugSettings::ResetConfig()
|
||||
{
|
||||
Super::ResetConfig();
|
||||
|
||||
FilterBySelection = true;
|
||||
bIsFilteringBySelection = true;
|
||||
Persistent = false;
|
||||
TextShadow = true;
|
||||
Fade2D = true;
|
||||
@@ -39,7 +39,6 @@ void UCogEngineWindow_DebugSettings::PostInitProperties()
|
||||
{
|
||||
Super::PostInitProperties();
|
||||
|
||||
FCogDebugSettings::FilterBySelection = FilterBySelection;
|
||||
FCogDebugSettings::Persistent = Persistent;
|
||||
FCogDebugSettings::TextShadow = TextShadow;
|
||||
FCogDebugSettings::Fade2D = Fade2D;
|
||||
@@ -54,6 +53,8 @@ void UCogEngineWindow_DebugSettings::PostInitProperties()
|
||||
FCogDebugSettings::GradientColorIntensity = GradientColorIntensity;
|
||||
FCogDebugSettings::GradientColorSpeed = GradientColorSpeed;
|
||||
FCogDebugSettings::TextSize = TextSize;
|
||||
|
||||
FCogDebugSettings::SetIsFilteringBySelection(GetWorld(), bIsFilteringBySelection);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -61,7 +62,6 @@ void UCogEngineWindow_DebugSettings::PreSaveConfig()
|
||||
{
|
||||
Super::PreSaveConfig();
|
||||
|
||||
FilterBySelection = FCogDebugSettings::FilterBySelection;
|
||||
Persistent = FCogDebugSettings::Persistent;
|
||||
TextShadow = FCogDebugSettings::TextShadow;
|
||||
Fade2D = FCogDebugSettings::Fade2D;
|
||||
@@ -76,6 +76,8 @@ void UCogEngineWindow_DebugSettings::PreSaveConfig()
|
||||
GradientColorIntensity = FCogDebugSettings::GradientColorIntensity;
|
||||
GradientColorSpeed = FCogDebugSettings::GradientColorSpeed;
|
||||
TextSize = FCogDebugSettings::TextSize;
|
||||
|
||||
bIsFilteringBySelection = FCogDebugSettings::GetIsFilteringBySelection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -99,7 +101,11 @@ void UCogEngineWindow_DebugSettings::RenderContent()
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Filter by selection", &FCogDebugSettings::FilterBySelection);
|
||||
if (ImGui::Checkbox("Filter by selection", &bIsFilteringBySelection))
|
||||
{
|
||||
FCogDebugSettings::SetIsFilteringBySelection(GetWorld(), bIsFilteringBySelection);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("If checked, only show the debug of the currently selected actor. Otherwise show the debug of all actors.");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CogEngineWindow_LogCategories.h"
|
||||
|
||||
#include "CogDebugHelper.h"
|
||||
#include "CogDebugSettings.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "CogDebugLog.h"
|
||||
|
||||
@@ -48,6 +49,8 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
{
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
{
|
||||
FCogWindowWidgets::HelpMarker("If checked, only show the debug of the currently selected actor. Otherwise show the debug of all actors.");
|
||||
|
||||
ImGui::Checkbox("Show detailed verbosity", &bShowAllVerbosity);
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("Show the verbosity level of each log category.");
|
||||
|
||||
@@ -86,9 +86,8 @@ void UCogEngineWindow_Selection::TryReapplySelection() const
|
||||
AActor* Actor = *It;
|
||||
if (GetNameSafe(Actor) == SelectionName)
|
||||
{
|
||||
FCogDebugSettings::SetSelection(Actor);
|
||||
SetGlobalSelection(Actor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +157,7 @@ void UCogEngineWindow_Selection::RenderTick(float DeltaTime)
|
||||
|
||||
if (FCogDebugSettings::GetSelection() == nullptr)
|
||||
{
|
||||
FCogDebugSettings::SetSelection(GetLocalPlayerPawn());
|
||||
SetGlobalSelection(GetLocalPlayerPawn());
|
||||
}
|
||||
|
||||
if (bSelectionModeActive)
|
||||
@@ -254,7 +253,7 @@ bool UCogEngineWindow_Selection::DrawSelectionCombo()
|
||||
const FString ActorName = GetNameSafe(Actor);
|
||||
if (ImGui::Selectable(TCHAR_TO_ANSI(*ActorName), bIsSelected))
|
||||
{
|
||||
FCogDebugSettings::SetSelection(Actor);
|
||||
SetGlobalSelection(Actor);
|
||||
SelectionChanged = true;
|
||||
}
|
||||
|
||||
@@ -294,7 +293,7 @@ void UCogEngineWindow_Selection::DrawActorContextMenu(AActor* Actor)
|
||||
if (ImGui::Button("Reset Selection", ImVec2(-1, 0)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
FCogDebugSettings::SetSelection(GetLocalPlayerPawn());
|
||||
SetGlobalSelection(GetLocalPlayerPawn());
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
@@ -399,7 +398,7 @@ void UCogEngineWindow_Selection::TickSelectionMode()
|
||||
{
|
||||
if (HoveredActor != nullptr)
|
||||
{
|
||||
FCogDebugSettings::SetSelection(HoveredActor);
|
||||
SetGlobalSelection(HoveredActor);
|
||||
}
|
||||
|
||||
DeactivateSelectionMode();
|
||||
@@ -590,7 +589,7 @@ void UCogEngineWindow_Selection::RenderMainMenuWidget(bool Draw, float& Width)
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("X", ImVec2(ResetButtonWidth, 0)))
|
||||
{
|
||||
FCogDebugSettings::SetSelection(nullptr);
|
||||
SetGlobalSelection(nullptr);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
@@ -601,3 +600,15 @@ void UCogEngineWindow_Selection::RenderMainMenuWidget(bool Draw, float& Width)
|
||||
ImGui::PopStyleVar(1);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogEngineWindow_Selection::SetGlobalSelection(AActor* Value) const
|
||||
{
|
||||
FCogDebugSettings::SetSelection(GetWorld(), Value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
AActor* UCogEngineWindow_Selection::GetGlobalSelection(AActor* Value) const
|
||||
{
|
||||
return FCogDebugSettings::GetSelection();
|
||||
}
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
private:
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool FilterBySelection = true;
|
||||
bool bIsFilteringBySelection = true;
|
||||
|
||||
UPROPERTY(Config)
|
||||
bool Persistent = false;
|
||||
|
||||
@@ -42,13 +42,17 @@ protected:
|
||||
|
||||
virtual void RenderMainMenuWidget(bool Draw, float& Width) override;
|
||||
|
||||
bool DrawSelectionCombo();
|
||||
virtual bool DrawSelectionCombo();
|
||||
|
||||
void DrawActorContextMenu(AActor* Actor);
|
||||
virtual void DrawActorContextMenu(AActor* Actor);
|
||||
|
||||
void ActivateSelectionMode();
|
||||
virtual void ActivateSelectionMode();
|
||||
|
||||
void HackWaitInputRelease();
|
||||
virtual void HackWaitInputRelease();
|
||||
|
||||
virtual void SetGlobalSelection(AActor* Value) const;
|
||||
|
||||
virtual AActor* GetGlobalSelection(AActor* Value) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ ACogSampleCharacter::ACogSampleCharacter(const FObjectInitializer& ObjectInitial
|
||||
|
||||
AbilitySystem = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT("AbilitySystem"));
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Full);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -108,6 +108,7 @@ void ACogSampleCharacter::BeginPlay()
|
||||
}
|
||||
|
||||
TryFinishInitialize();
|
||||
RefreshServerAnimTickOption();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -639,6 +640,29 @@ void ACogSampleCharacter::OnScaleAttributeChanged(const FOnAttributeChangeData&
|
||||
|
||||
MARK_PROPERTY_DIRTY_FROM_NAME(ACogSampleCharacter, Scale, this);
|
||||
OnRep_Scale();
|
||||
|
||||
RefreshServerAnimTickOption();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogSampleCharacter::RefreshServerAnimTickOption()
|
||||
{
|
||||
const UCapsuleComponent* Capsule = GetCapsuleComponent();
|
||||
if (Capsule == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
USkeletalMeshComponent* SkeletalMesh = GetMesh();
|
||||
if (SkeletalMesh == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const float ScaledHalfHeight = Capsule->GetScaledCapsuleHalfHeight();
|
||||
const bool IsBigEnoughToSimulateBonesOnServer = ScaledHalfHeight > 200;
|
||||
SkeletalMesh->VisibilityBasedAnimTickOption = IsBigEnoughToSimulateBonesOnServer ? EVisibilityBasedAnimTickOption::AlwaysTickPoseAndRefreshBones
|
||||
: EVisibilityBasedAnimTickOption::OnlyTickMontagesWhenNotRendered;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -230,9 +230,11 @@ public:
|
||||
int32 ApplyRootMotion(const FCogSampleRootMotionParams& Params);
|
||||
|
||||
private:
|
||||
|
||||
friend class ACogSamplePlayerController;
|
||||
|
||||
void RefreshServerAnimTickOption();
|
||||
|
||||
|
||||
UPROPERTY()
|
||||
AController* InitialController = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user