2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-06-10 13:56:35 -04:00
|
|
|
#include "GameplayDebuggerPrivate.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "Net/UnrealNetwork.h"
|
2014-06-10 13:56:35 -04:00
|
|
|
#include "DebugRenderSceneProxy.h"
|
|
|
|
|
#include "AI/Navigation/RecastNavMeshGenerator.h"
|
|
|
|
|
#include "NavMeshRenderingHelpers.h"
|
|
|
|
|
#include "AI/Navigation/NavigationSystem.h"
|
2014-09-03 05:20:46 -04:00
|
|
|
#include "EnvironmentQuery/EnvQueryTypes.h"
|
2014-08-07 17:34:29 -04:00
|
|
|
#include "EnvironmentQuery/EnvQueryManager.h"
|
|
|
|
|
#include "EnvironmentQuery/EQSRenderingComponent.h"
|
|
|
|
|
#include "EnvironmentQuery/EnvQueryTest.h"
|
2014-08-21 20:30:51 -04:00
|
|
|
#include "BehaviorTree/BlackboardComponent.h"
|
2015-01-19 06:07:32 -05:00
|
|
|
#include "BehaviorTree/BehaviorTreeComponent.h"
|
|
|
|
|
#include "AbilitySystemComponent.h"
|
2014-05-29 17:06:50 -04:00
|
|
|
#include "AIController.h"
|
|
|
|
|
#include "BrainComponent.h"
|
2014-06-10 13:56:35 -04:00
|
|
|
#include "BehaviorTreeDelegates.h"
|
2014-06-11 09:53:20 -04:00
|
|
|
#include "GameFramework/PlayerState.h"
|
2015-01-19 14:24:10 -05:00
|
|
|
#include "GameFramework/Character.h"
|
2015-01-19 15:35:35 -05:00
|
|
|
#include "GameFramework/CharacterMovementComponent.h"
|
2014-08-21 20:30:51 -04:00
|
|
|
#include "Engine/Channel.h"
|
2015-01-19 18:04:11 -05:00
|
|
|
#include "Animation/AnimMontage.h"
|
2015-05-12 17:23:03 -04:00
|
|
|
#include "GameplayAbilitiesModule.h"
|
2014-06-10 13:56:35 -04:00
|
|
|
|
2014-11-25 09:36:16 -05:00
|
|
|
#if WITH_EDITOR
|
|
|
|
|
#include "Editor/EditorEngine.h"
|
|
|
|
|
#include "GeomTools.h"
|
|
|
|
|
#endif // WITH_EDITOR
|
|
|
|
|
|
2014-06-10 13:56:35 -04:00
|
|
|
#include "GameplayDebuggingComponent.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-04-30 17:34:38 -04:00
|
|
|
DEFINE_LOG_CATEGORY(LogGDT);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// Composite Scene proxy
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
class FDebugRenderSceneCompositeProxy : public FDebugRenderSceneProxy
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FDebugRenderSceneCompositeProxy(const UPrimitiveComponent* InComponent)
|
|
|
|
|
: FDebugRenderSceneProxy(InComponent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual ~FDebugRenderSceneCompositeProxy()
|
|
|
|
|
{
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
delete ChildProxies[Index];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void DrawStaticElements(FStaticPrimitiveDrawInterface* PDI) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
ChildProxies[Index]->DrawStaticElements(PDI);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 18:24:52 -04:00
|
|
|
virtual void GetDynamicMeshElements(const TArray<const FSceneView*>& Views, const FSceneViewFamily& ViewFamily, uint32 VisibilityMap, FMeshElementCollector& Collector) const override
|
|
|
|
|
{
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
ChildProxies[Index]->GetDynamicMeshElements(Views, ViewFamily, VisibilityMap, Collector);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void RegisterDebugDrawDelgate() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
ChildProxies[Index]->RegisterDebugDrawDelgate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void UnregisterDebugDrawDelgate() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
ChildProxies[Index]->UnregisterDebugDrawDelgate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView* View) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FPrimitiveViewRelevance Result;
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
Result |= ChildProxies[Index]->GetViewRelevance(View);
|
|
|
|
|
}
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-01 07:20:55 -04:00
|
|
|
virtual uint32 GetMemoryFootprint( void ) const override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return sizeof( *this ) + GetAllocatedSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32 GetAllocatedSize( void ) const
|
|
|
|
|
{
|
|
|
|
|
uint32 Size = 0;
|
|
|
|
|
for (int32 Index = 0; Index < ChildProxies.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
ChildProxies[Index]->GetMemoryFootprint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Size + ChildProxies.GetAllocatedSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddChild(FDebugRenderSceneProxy* NewChild)
|
|
|
|
|
{
|
|
|
|
|
ChildProxies.AddUnique(NewChild);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
TArray<FDebugRenderSceneProxy*> ChildProxies;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// UGameplayDebuggingComponent
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
|
|
|
|
|
FName UGameplayDebuggingComponent::DefaultComponentName = TEXT("GameplayDebuggingComponent");
|
|
|
|
|
FOnDebuggingTargetChanged UGameplayDebuggingComponent::OnDebuggingTargetChangedDelegate;
|
|
|
|
|
|
2014-10-14 10:29:11 -04:00
|
|
|
UGameplayDebuggingComponent::UGameplayDebuggingComponent(const FObjectInitializer& ObjectInitializer)
|
|
|
|
|
: Super(ObjectInitializer)
|
2014-03-14 14:13:41 -04:00
|
|
|
, bDrawEQSLabels(true)
|
|
|
|
|
, bDrawEQSFailedItems(true)
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
DebugComponentClassName = TEXT("/Script/GameplayDebugger.GameplayDebuggingComponent");
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
PrimaryComponentTick.bCanEverTick = true;
|
|
|
|
|
bWantsInitializeComponent = true;
|
2015-06-11 10:20:48 -04:00
|
|
|
bAutoActivate = false;
|
2014-03-14 14:13:41 -04:00
|
|
|
PrimaryComponentTick.bStartWithTickEnabled = false;
|
|
|
|
|
|
2015-01-27 10:22:55 -05:00
|
|
|
LastStoredPathTimeStamp = -1.f;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
ShowExtendedInformatiomCounter = 0;
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
bWasSelectedInEditor = false;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
bHiddenInGame = false;
|
|
|
|
|
bEnabledTargetSelection = false;
|
2014-04-23 19:29:53 -04:00
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
bEnableClientEQSSceneProxy = false;
|
|
|
|
|
NextTargrtSelectionTime = 0;
|
2014-04-23 19:29:53 -04:00
|
|
|
ReplicateViewDataCounters.Init(0, EAIDebugDrawDataView::MAX);
|
2014-08-21 20:30:51 -04:00
|
|
|
|
|
|
|
|
AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner());
|
|
|
|
|
if (Replicator)
|
|
|
|
|
{
|
|
|
|
|
Replicator->OnChangeEQSQuery.AddUObject(this, &UGameplayDebuggingComponent::OnChangeEQSQuery);
|
2014-11-25 09:36:16 -05:00
|
|
|
FGameplayDebuggerSettings Settings = GameplayDebuggerSettings(Replicator);
|
|
|
|
|
for (int32 Index = EAIDebugDrawDataView::Empty + 1; Index < EAIDebugDrawDataView::MAX; ++Index)
|
|
|
|
|
{
|
|
|
|
|
ReplicateViewDataCounters[Index] = Settings.CheckFlag(Index);
|
|
|
|
|
}
|
2014-08-21 20:30:51 -04:00
|
|
|
}
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::Activate(bool bReset)
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-09-09 12:17:30 -04:00
|
|
|
Super::Activate(bReset);
|
2014-04-24 15:04:22 -04:00
|
|
|
SetComponentTickEnabled(true);
|
2014-09-09 12:17:30 -04:00
|
|
|
SetIsReplicated(true);
|
2014-06-10 13:56:35 -04:00
|
|
|
#else
|
|
|
|
|
Super::Activate(bReset);
|
|
|
|
|
#endif
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::Deactivate()
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-09-09 12:17:30 -04:00
|
|
|
Super::Deactivate();
|
2014-04-24 15:04:22 -04:00
|
|
|
SetComponentTickEnabled(false);
|
2014-09-09 12:17:30 -04:00
|
|
|
SetIsReplicated(false);
|
2014-06-10 13:56:35 -04:00
|
|
|
#else
|
|
|
|
|
Super::Deactivate();
|
|
|
|
|
#endif
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
|
|
|
|
|
{
|
|
|
|
|
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, ReplicateViewDataCounters);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, ShowExtendedInformatiomCounter);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, ControllerName)
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, PawnName);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, DebugIcon);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, PawnClass);
|
|
|
|
|
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, bIsUsingCharacter);
|
2015-02-19 07:14:31 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, MovementBaseInfo);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, MovementModeInfo);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, MontageInfo);
|
|
|
|
|
|
2015-01-19 06:07:32 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, bIsUsingPathFollowing);
|
2015-02-19 07:14:31 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, PathFollowingInfo);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, NavDataInfo);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, PathPoints);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, PathCorridorData);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, NextPathPointIndex);
|
|
|
|
|
|
2015-01-19 06:07:32 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, bIsUsingBehaviorTree);
|
2015-02-19 07:14:31 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, CurrentAITask);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, CurrentAIState);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, CurrentAIAssets);
|
|
|
|
|
|
2015-01-19 06:07:32 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, bIsUsingAbilities);
|
2015-02-19 07:14:31 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, AbilityInfo);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-08-21 20:30:51 -04:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, BrainComponentName);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, BrainComponentString);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, BlackboardRepData);
|
|
|
|
|
|
2015-01-19 06:07:32 -05:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, NavmeshRepData);
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, TargetActor);
|
2014-04-23 19:29:53 -04:00
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, EQSRepData);
|
2014-09-29 21:43:13 -04:00
|
|
|
|
|
|
|
|
DOREPLIFETIME(UGameplayDebuggingComponent, SensingComponentLocation);
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2015-02-19 07:14:31 -05:00
|
|
|
bool UGameplayDebuggingComponent::ClientEnableTargetSelection_Validate(bool bEnable)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-19 07:14:31 -05:00
|
|
|
void UGameplayDebuggingComponent::ClientEnableTargetSelection_Implementation(bool bEnable)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
bEnabledTargetSelection = bEnable;
|
2015-02-19 07:14:31 -05:00
|
|
|
if (bEnabledTargetSelection && World && World->GetNetMode() != NM_DedicatedServer)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
NextTargrtSelectionTime = 0;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::SetActorToDebug(AActor* Actor)
|
|
|
|
|
{
|
|
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-04-24 14:07:47 -04:00
|
|
|
if (TargetActor != Actor)
|
|
|
|
|
{
|
|
|
|
|
MarkRenderStateDirty();
|
|
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
TargetActor = Actor;
|
2014-09-09 12:17:30 -04:00
|
|
|
EQSLocalData.Reset();
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
|
|
|
|
|
{
|
|
|
|
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-02-19 07:14:31 -05:00
|
|
|
if (World && World->GetNetMode() != NM_DedicatedServer)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if (bEnabledTargetSelection)
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner());
|
|
|
|
|
if (Replicator)
|
|
|
|
|
{
|
2014-06-25 09:28:40 -04:00
|
|
|
if (Replicator->GetLocalPlayerOwner())
|
2014-06-10 13:56:35 -04:00
|
|
|
{
|
2014-06-25 09:28:40 -04:00
|
|
|
SelectTargetToDebug();
|
2014-06-10 13:56:35 -04:00
|
|
|
}
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
|
2015-02-19 07:14:31 -05:00
|
|
|
if (World && World->GetNetMode() < NM_Client)
|
|
|
|
|
{
|
|
|
|
|
CollectDataToReplicate(true);
|
|
|
|
|
}
|
2014-08-21 20:30:51 -04:00
|
|
|
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-25 09:28:40 -04:00
|
|
|
void UGameplayDebuggingComponent::SelectTargetToDebug()
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-06-25 09:28:40 -04:00
|
|
|
AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner());
|
2015-04-13 06:23:53 -04:00
|
|
|
|
|
|
|
|
UGameplayDebuggingControllerComponent* GDC = Replicator->FindComponentByClass<UGameplayDebuggingControllerComponent>();
|
|
|
|
|
APlayerController* MyPC = GDC && GDC->GetDebugCameraController().IsValid() ? GDC->GetDebugCameraController().Get() : Replicator->GetLocalPlayerOwner();
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
if (MyPC )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-02-19 07:14:31 -05:00
|
|
|
float bestAim = 0;
|
2014-03-14 14:13:41 -04:00
|
|
|
FVector CamLocation;
|
|
|
|
|
FRotator CamRotation;
|
|
|
|
|
check(MyPC->PlayerCameraManager != NULL);
|
|
|
|
|
MyPC->PlayerCameraManager->GetCameraViewPoint(CamLocation, CamRotation);
|
|
|
|
|
FVector FireDir = CamRotation.Vector();
|
|
|
|
|
UWorld* World = MyPC->GetWorld();
|
|
|
|
|
check( World );
|
|
|
|
|
|
|
|
|
|
APawn* PossibleTarget = NULL;
|
|
|
|
|
for (FConstPawnIterator Iterator = World->GetPawnIterator(); Iterator; ++Iterator )
|
|
|
|
|
{
|
|
|
|
|
APawn* NewTarget = *Iterator;
|
2014-07-14 19:41:38 -04:00
|
|
|
if (NewTarget == NULL || NewTarget == MyPC->GetPawn()
|
|
|
|
|
|| (NewTarget->PlayerState != NULL && NewTarget->PlayerState->bIsABot == false)
|
|
|
|
|
|| NewTarget->GetActorEnableCollision() == false)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-19 07:14:31 -05:00
|
|
|
if (NewTarget != MyPC->GetPawn())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// look for best controlled pawn target
|
|
|
|
|
const FVector AimDir = NewTarget->GetActorLocation() - CamLocation;
|
|
|
|
|
float FireDist = AimDir.SizeSquared();
|
2014-04-24 15:04:22 -04:00
|
|
|
// only find targets which are < 25000 units away
|
|
|
|
|
if (FireDist < 625000000.f)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FireDist = FMath::Sqrt(FireDist);
|
2015-02-19 07:14:31 -05:00
|
|
|
float newAim = FVector::DotProduct(FireDir, AimDir);
|
|
|
|
|
newAim = newAim / FireDist;
|
2014-03-14 14:13:41 -04:00
|
|
|
if (newAim > bestAim)
|
|
|
|
|
{
|
|
|
|
|
PossibleTarget = NewTarget;
|
|
|
|
|
bestAim = newAim;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-19 07:14:31 -05:00
|
|
|
if (PossibleTarget != NULL && PossibleTarget != GetSelectedActor())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-03-06 15:13:38 -05:00
|
|
|
if (AGameplayDebuggingReplicator* DebuggingReplicator = Cast<AGameplayDebuggingReplicator>(GetOwner()))
|
2014-08-07 17:34:29 -04:00
|
|
|
{
|
2015-03-06 15:13:38 -05:00
|
|
|
DebuggingReplicator->ServerSetActorToDebug(Cast<AActor>(PossibleTarget));
|
2015-04-24 14:07:47 -04:00
|
|
|
MarkRenderStateDirty();
|
2014-08-07 17:34:29 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-10 13:56:35 -04:00
|
|
|
ServerReplicateData(EDebugComponentMessage::ActivateReplication, EAIDebugDrawDataView::Empty);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-10 13:56:35 -04:00
|
|
|
void UGameplayDebuggingComponent::CollectDataToReplicate(bool bCollectExtendedData)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-04-24 14:07:47 -04:00
|
|
|
const AActor *SelectedActor = GetSelectedActor();
|
|
|
|
|
if (!SelectedActor || SelectedActor->IsPendingKill())
|
2014-06-10 13:56:35 -04:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-30 17:34:38 -04:00
|
|
|
if (ShouldReplicateData(EAIDebugDrawDataView::Basic) || ShouldReplicateData(EAIDebugDrawDataView::OverHead))
|
|
|
|
|
{
|
|
|
|
|
CollectBasicData();
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-09 12:17:30 -04:00
|
|
|
AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner());
|
|
|
|
|
const bool bDrawFullData = Replicator->GetSelectedActorToDebug() == GetSelectedActor();
|
|
|
|
|
if (bDrawFullData && ShouldReplicateData(EAIDebugDrawDataView::Basic))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
CollectPathData();
|
|
|
|
|
}
|
2014-04-30 17:34:38 -04:00
|
|
|
|
2014-09-09 12:17:30 -04:00
|
|
|
if (bCollectExtendedData && bDrawFullData)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-30 17:34:38 -04:00
|
|
|
if (ShouldReplicateData(EAIDebugDrawDataView::BehaviorTree))
|
|
|
|
|
{
|
|
|
|
|
CollectBehaviorTreeData();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 17:06:50 -04:00
|
|
|
#if WITH_EQS
|
2014-04-30 17:34:38 -04:00
|
|
|
if (ShouldReplicateData(EAIDebugDrawDataView::EQS))
|
|
|
|
|
{
|
2014-08-07 17:34:29 -04:00
|
|
|
bool bEnabledEnvironmentQueryEd = true;
|
|
|
|
|
if (GConfig)
|
|
|
|
|
{
|
|
|
|
|
GConfig->GetBool(TEXT("EnvironmentQueryEd"), TEXT("EnableEnvironmentQueryEd"), bEnabledEnvironmentQueryEd, GEngineIni);
|
|
|
|
|
}
|
2014-08-21 20:30:51 -04:00
|
|
|
|
2014-08-07 17:34:29 -04:00
|
|
|
if (bEnabledEnvironmentQueryEd)
|
|
|
|
|
{
|
|
|
|
|
CollectEQSData();
|
|
|
|
|
}
|
2014-04-30 17:34:38 -04:00
|
|
|
}
|
2014-05-29 17:06:50 -04:00
|
|
|
#endif // WITH_EQS
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectBasicData()
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
APawn* MyPawn = Cast<APawn>(GetSelectedActor());
|
2014-03-14 14:13:41 -04:00
|
|
|
PawnName = MyPawn->GetHumanReadableName();
|
|
|
|
|
PawnClass = MyPawn->GetClass()->GetName();
|
2015-01-19 06:07:32 -05:00
|
|
|
AAIController* MyController = Cast<AAIController>(MyPawn->Controller);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-01-19 06:07:32 -05:00
|
|
|
bIsUsingCharacter = MyPawn->IsA(ACharacter::StaticClass());
|
|
|
|
|
|
|
|
|
|
if (MyController)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if (MyController->IsPendingKill() == false)
|
|
|
|
|
{
|
|
|
|
|
ControllerName = MyController->GetName();
|
|
|
|
|
DebugIcon = MyController->GetDebugIcon();
|
2015-01-19 06:07:32 -05:00
|
|
|
|
|
|
|
|
CollectBasicMovementData(MyPawn);
|
|
|
|
|
CollectBasicPathData(MyPawn);
|
|
|
|
|
CollectBasicBehaviorData(MyPawn);
|
|
|
|
|
CollectBasicAbilityData(MyPawn);
|
|
|
|
|
CollectBasicAnimationData(MyPawn);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ControllerName = TEXT("Controller PENDING KILL");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ControllerName = TEXT("No Controller");
|
|
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2015-01-19 06:07:32 -05:00
|
|
|
void UGameplayDebuggingComponent::CollectBasicMovementData(APawn* MyPawn)
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
UCharacterMovementComponent* CharMovement = Cast<UCharacterMovementComponent>(MyPawn->GetMovementComponent());
|
|
|
|
|
if (CharMovement)
|
|
|
|
|
{
|
|
|
|
|
UPrimitiveComponent* FloorComponent = MyPawn->GetMovementBase();
|
|
|
|
|
AActor* FloorActor = FloorComponent ? FloorComponent->GetOwner() : nullptr;
|
|
|
|
|
MovementBaseInfo = FloorComponent ? FString::Printf(TEXT("%s.%s"), *GetNameSafe(FloorActor), *FloorComponent->GetName()) : TEXT("None");
|
|
|
|
|
|
|
|
|
|
MovementModeInfo = CharMovement->GetMovementName();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MovementBaseInfo = TEXT("");
|
|
|
|
|
MovementModeInfo = TEXT("");
|
|
|
|
|
}
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectBasicPathData(APawn* MyPawn)
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(MyPawn->GetWorld());
|
|
|
|
|
AAIController* MyAIController = Cast<AAIController>(MyPawn->GetController());
|
|
|
|
|
|
2015-04-24 14:07:47 -04:00
|
|
|
const ANavigationData* NavData = NavSys ? NavSys->GetNavDataForProps(MyAIController->GetNavAgentPropertiesRef()) : nullptr;
|
2015-03-17 09:44:38 -04:00
|
|
|
if (NavData)
|
|
|
|
|
{
|
|
|
|
|
NavDataInfo = NavData->GetConfig().Name.ToString();
|
|
|
|
|
}
|
2015-01-19 06:07:32 -05:00
|
|
|
|
|
|
|
|
UPathFollowingComponent* PFC = MyAIController->GetPathFollowingComponent();
|
|
|
|
|
bIsUsingPathFollowing = (PFC != nullptr);
|
|
|
|
|
|
|
|
|
|
if (PFC)
|
|
|
|
|
{
|
|
|
|
|
TArray<FString> Tokens;
|
|
|
|
|
TArray<EPathFollowingDebugTokens::Type> Flags;
|
|
|
|
|
if (PFC)
|
|
|
|
|
{
|
|
|
|
|
PFC->GetDebugStringTokens(Tokens, Flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PathFollowingInfo = FString();
|
|
|
|
|
for (int32 Idx = 0; Idx < Tokens.Num(); Idx++)
|
|
|
|
|
{
|
|
|
|
|
switch (Flags[Idx])
|
|
|
|
|
{
|
|
|
|
|
case EPathFollowingDebugTokens::Description:
|
|
|
|
|
PathFollowingInfo += Tokens[Idx];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EPathFollowingDebugTokens::ParamName:
|
|
|
|
|
PathFollowingInfo += TEXT(", {yellow}");
|
|
|
|
|
PathFollowingInfo += Tokens[Idx];
|
|
|
|
|
PathFollowingInfo += TEXT(":");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EPathFollowingDebugTokens::PassedValue:
|
|
|
|
|
PathFollowingInfo += TEXT("{yellow}");
|
|
|
|
|
PathFollowingInfo += Tokens[Idx];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EPathFollowingDebugTokens::FailedValue:
|
|
|
|
|
PathFollowingInfo += TEXT("{orange}");
|
|
|
|
|
PathFollowingInfo += Tokens[Idx];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PathFollowingInfo = TEXT("");
|
|
|
|
|
}
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectBasicBehaviorData(APawn* MyPawn)
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
AAIController* MyAIController = Cast<AAIController>(MyPawn->GetController());
|
|
|
|
|
UBehaviorTreeComponent* BTC = MyAIController ? Cast<UBehaviorTreeComponent>(MyAIController->BrainComponent) : nullptr;
|
|
|
|
|
bIsUsingBehaviorTree = (BTC != nullptr);
|
|
|
|
|
|
|
|
|
|
if (BTC)
|
|
|
|
|
{
|
|
|
|
|
CurrentAITask = BTC->DescribeActiveTasks();
|
|
|
|
|
CurrentAIState = BTC->IsRunning() ? TEXT("Running") : BTC->IsPaused() ? TEXT("Paused") : TEXT("Inactive");
|
|
|
|
|
CurrentAIAssets = BTC->DescribeActiveTrees();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CurrentAITask = TEXT("");
|
|
|
|
|
CurrentAIState = TEXT("");
|
|
|
|
|
CurrentAIAssets = TEXT("");
|
|
|
|
|
}
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectBasicAbilityData(APawn* MyPawn)
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-05-12 17:23:03 -04:00
|
|
|
if (IGameplayAbilitiesModule::IsAvailable())
|
2015-01-19 06:07:32 -05:00
|
|
|
{
|
2015-05-12 17:23:03 -04:00
|
|
|
bool bUsingAbilities;
|
|
|
|
|
IGameplayAbilitiesModule& AbilitiesModule = FModuleManager::LoadModuleChecked<IGameplayAbilitiesModule>("GameplayAbilities");
|
|
|
|
|
AbilitiesModule.GetActiveAbilitiesDebugDataForActor(MyPawn, AbilityInfo, bUsingAbilities);
|
|
|
|
|
bIsUsingAbilities = bUsingAbilities;
|
2015-01-19 06:07:32 -05:00
|
|
|
}
|
2015-05-12 17:23:03 -04:00
|
|
|
else
|
2015-01-19 06:07:32 -05:00
|
|
|
{
|
2015-05-12 17:23:03 -04:00
|
|
|
bIsUsingAbilities = false;
|
2015-01-19 06:07:32 -05:00
|
|
|
AbilityInfo = TEXT("None");
|
|
|
|
|
}
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectBasicAnimationData(APawn* MyPawn)
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
ACharacter* MyChar = Cast<ACharacter>(MyPawn);
|
|
|
|
|
MontageInfo = MyChar ? GetNameSafe(MyChar->GetCurrentMontage()) : TEXT("");
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-01-19 06:07:32 -05:00
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void UGameplayDebuggingComponent::CollectBehaviorTreeData()
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-04-23 19:29:53 -04:00
|
|
|
if (!ShouldReplicateData(EAIDebugDrawDataView::BehaviorTree))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-28 16:05:15 -04:00
|
|
|
BrainComponentName = TEXT("");
|
|
|
|
|
BrainComponentString = TEXT("");
|
|
|
|
|
|
2014-06-10 13:56:35 -04:00
|
|
|
APawn* MyPawn = Cast<APawn>(GetSelectedActor());
|
2014-08-28 16:05:15 -04:00
|
|
|
AAIController* MyController = Cast<AAIController>(MyPawn->Controller);
|
|
|
|
|
if (MyController != NULL && MyController->BrainComponent != NULL && MyController->IsPendingKillPending() == false)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-08-21 20:30:51 -04:00
|
|
|
BrainComponentName = MyController->BrainComponent != NULL ? MyController->BrainComponent->GetName() : TEXT("");
|
2014-08-25 11:07:28 -04:00
|
|
|
BrainComponentString = MyController->BrainComponent != NULL ? MyController->BrainComponent->GetDebugInfoString() : TEXT("");
|
2014-08-21 20:30:51 -04:00
|
|
|
|
|
|
|
|
BlackboardString = MyController->BrainComponent->GetBlackboardComponent() ? MyController->BrainComponent->GetBlackboardComponent()->GetDebugInfoString(EBlackboardDescription::KeyWithValue) : TEXT("");
|
|
|
|
|
|
|
|
|
|
if (World && World->GetNetMode() != NM_Standalone)
|
|
|
|
|
{
|
|
|
|
|
TArray<uint8> UncompressedBuffer;
|
|
|
|
|
FMemoryWriter ArWriter(UncompressedBuffer);
|
|
|
|
|
|
|
|
|
|
ArWriter << BlackboardString;
|
|
|
|
|
|
|
|
|
|
const int32 HeaderSize = sizeof(int32);
|
|
|
|
|
BlackboardRepData.Init(0, HeaderSize + FMath::TruncToInt(1.1f * UncompressedBuffer.Num()));
|
|
|
|
|
|
|
|
|
|
const int32 UncompressedSize = UncompressedBuffer.Num();
|
|
|
|
|
int32 CompressedSize = BlackboardRepData.Num() - HeaderSize;
|
2014-09-29 04:23:44 -04:00
|
|
|
uint8* DestBuffer = BlackboardRepData.GetData();
|
2014-08-21 20:30:51 -04:00
|
|
|
FMemory::Memcpy(DestBuffer, &UncompressedSize, HeaderSize);
|
|
|
|
|
DestBuffer += HeaderSize;
|
|
|
|
|
|
|
|
|
|
FCompression::CompressMemory((ECompressionFlags)(COMPRESS_ZLIB | COMPRESS_BiasMemory),
|
|
|
|
|
(void*)DestBuffer, CompressedSize, (void*)UncompressedBuffer.GetData(), UncompressedSize);
|
|
|
|
|
|
|
|
|
|
BlackboardRepData.SetNum(CompressedSize + HeaderSize, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
}
|
|
|
|
|
void UGameplayDebuggingComponent::OnRep_UpdateBlackboard()
|
|
|
|
|
{
|
|
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
if (World && World->GetNetMode() != NM_Standalone)
|
|
|
|
|
{
|
|
|
|
|
TArray<uint8> UncompressedBuffer;
|
|
|
|
|
int32 UncompressedSize = 0;
|
|
|
|
|
const int32 HeaderSize = sizeof(int32);
|
2014-09-29 04:23:44 -04:00
|
|
|
uint8* SrcBuffer = (uint8*)BlackboardRepData.GetData();
|
2014-08-21 20:30:51 -04:00
|
|
|
FMemory::Memcpy(&UncompressedSize, SrcBuffer, HeaderSize);
|
|
|
|
|
SrcBuffer += HeaderSize;
|
|
|
|
|
const int32 CompressedSize = BlackboardRepData.Num() - HeaderSize;
|
|
|
|
|
|
|
|
|
|
UncompressedBuffer.AddZeroed(UncompressedSize);
|
|
|
|
|
|
2014-09-29 04:23:44 -04:00
|
|
|
FCompression::UncompressMemory((ECompressionFlags)(COMPRESS_ZLIB), (void*)UncompressedBuffer.GetData(), UncompressedSize, SrcBuffer, CompressedSize);
|
2014-08-21 20:30:51 -04:00
|
|
|
FMemoryReader ArReader(UncompressedBuffer);
|
|
|
|
|
|
|
|
|
|
ArReader << BlackboardString;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectPathData()
|
|
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
APawn* MyPawn = Cast<APawn>(GetSelectedActor());
|
2014-11-25 09:36:16 -05:00
|
|
|
|
|
|
|
|
bool bRefreshRendering = false;
|
2014-03-14 14:13:41 -04:00
|
|
|
if (AAIController *MyController = Cast<AAIController>(MyPawn->Controller))
|
|
|
|
|
{
|
2014-11-26 04:21:03 -05:00
|
|
|
if (MyController->PathFollowingComponent && MyController->PathFollowingComponent->GetPath().IsValid())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-01-19 06:07:32 -05:00
|
|
|
NextPathPointIndex = MyController->PathFollowingComponent->GetNextPathIndex();
|
|
|
|
|
|
2014-11-26 04:21:03 -05:00
|
|
|
const FNavPathSharedPtr& NewPath = MyController->PathFollowingComponent->GetPath();
|
2015-01-27 10:22:55 -05:00
|
|
|
if (CurrentPath.HasSameObject(NewPath.Get()) == false || NewPath->GetTimeStamp() > LastStoredPathTimeStamp)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-01-27 10:22:55 -05:00
|
|
|
LastStoredPathTimeStamp = NewPath->GetTimeStamp();
|
|
|
|
|
|
2014-11-25 09:36:16 -05:00
|
|
|
FVisualLogEntry Snapshot;
|
|
|
|
|
NewPath->DescribeSelfToVisLog(&Snapshot);
|
2015-01-27 10:22:55 -05:00
|
|
|
PathCorridorPolygons.Reset(Snapshot.ElementsToDraw.Num());
|
2015-02-24 07:01:10 -05:00
|
|
|
FPathCorridorPolygons Polygon;
|
|
|
|
|
for (FVisualLogShapeElement& CurrentShape : Snapshot.ElementsToDraw)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
|
|
|
|
if (CurrentShape.GetType() == EVisualLoggerShapeElement::Polygon)
|
|
|
|
|
{
|
2015-02-24 07:01:10 -05:00
|
|
|
Polygon.Color = CurrentShape.GetFColor();
|
|
|
|
|
Polygon.Points.Reset();
|
|
|
|
|
Polygon.Points.Append(CurrentShape.Points);
|
|
|
|
|
PathCorridorPolygons.Add(Polygon);
|
2014-11-25 09:36:16 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
PathPoints.Reset();
|
2014-07-14 19:41:38 -04:00
|
|
|
for (int32 Index=0; Index < NewPath->GetPathPoints().Num(); ++Index)
|
2014-05-22 14:14:52 -04:00
|
|
|
{
|
2014-07-14 19:41:38 -04:00
|
|
|
PathPoints.Add(NewPath->GetPathPoints()[Index].Location);
|
2014-05-22 14:14:52 -04:00
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
CurrentPath = NewPath;
|
2014-11-25 09:36:16 -05:00
|
|
|
|
|
|
|
|
if (PathCorridorPolygons.Num() && World && World->GetNetMode() != NM_Client)
|
|
|
|
|
{
|
|
|
|
|
PathCorridorData.Reset();
|
|
|
|
|
TArray<uint8> HelpBuffer;
|
|
|
|
|
FMemoryWriter ArWriter(HelpBuffer);
|
|
|
|
|
int32 NumPolygons = PathCorridorPolygons.Num();
|
|
|
|
|
ArWriter << NumPolygons;
|
2015-02-24 07:01:10 -05:00
|
|
|
for (const FPathCorridorPolygons& CurrentPoly : PathCorridorPolygons)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
2015-02-24 07:01:10 -05:00
|
|
|
FColor Color = CurrentPoly.Color;
|
|
|
|
|
ArWriter << Color;
|
|
|
|
|
int32 NumVerts = CurrentPoly.Points.Num();
|
2014-11-25 09:36:16 -05:00
|
|
|
ArWriter << NumVerts;
|
2015-02-24 07:01:10 -05:00
|
|
|
for (auto Vert : CurrentPoly.Points)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
|
|
|
|
ArWriter << Vert;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-19 07:14:31 -05:00
|
|
|
PathCorridorData = HelpBuffer;
|
2014-11-25 09:36:16 -05:00
|
|
|
}
|
|
|
|
|
bRefreshRendering = true;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-01-19 06:07:32 -05:00
|
|
|
NextPathPointIndex = INDEX_NONE;
|
2014-03-14 14:13:41 -04:00
|
|
|
CurrentPath = NULL;
|
|
|
|
|
PathPoints.Reset();
|
2014-11-25 09:36:16 -05:00
|
|
|
PathCorridorPolygons.Reset();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
2014-11-25 09:36:16 -05:00
|
|
|
|
|
|
|
|
if (bRefreshRendering && World && World->GetNetMode() != NM_DedicatedServer)
|
|
|
|
|
{
|
|
|
|
|
UpdateBounds();
|
|
|
|
|
MarkRenderStateDirty();
|
|
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-11-25 09:36:16 -05:00
|
|
|
void UGameplayDebuggingComponent::OnRep_PathCorridorData()
|
|
|
|
|
{
|
|
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
if (World && World->GetNetMode() != NM_DedicatedServer)
|
|
|
|
|
{
|
2015-02-19 07:14:31 -05:00
|
|
|
FMemoryReader ArReader(PathCorridorData);
|
2014-11-25 09:36:16 -05:00
|
|
|
int32 NumPolygons = 0;
|
|
|
|
|
ArReader << NumPolygons;
|
|
|
|
|
PathCorridorPolygons.Reset(NumPolygons);
|
|
|
|
|
for (int32 PolyIndex = 0; PolyIndex < NumPolygons; ++PolyIndex)
|
|
|
|
|
{
|
2015-02-24 07:01:10 -05:00
|
|
|
FPathCorridorPolygons Polygon;
|
|
|
|
|
FColor Color;
|
|
|
|
|
ArReader << Polygon.Color;
|
|
|
|
|
|
2014-11-25 09:36:16 -05:00
|
|
|
int32 NumVerts = 0;
|
|
|
|
|
ArReader << NumVerts;
|
|
|
|
|
for (int32 VertIndex = 0; VertIndex < NumVerts; ++VertIndex)
|
|
|
|
|
{
|
|
|
|
|
FVector CurrentVertex;
|
|
|
|
|
ArReader << CurrentVertex;
|
2015-02-24 07:01:10 -05:00
|
|
|
Polygon.Points.Add(CurrentVertex);
|
2014-11-25 09:36:16 -05:00
|
|
|
}
|
2015-02-19 07:14:31 -05:00
|
|
|
if (NumVerts > 2)
|
|
|
|
|
{
|
2015-02-24 07:01:10 -05:00
|
|
|
PathCorridorPolygons.Add(Polygon);
|
2015-02-19 07:14:31 -05:00
|
|
|
}
|
2014-11-25 09:36:16 -05:00
|
|
|
}
|
|
|
|
|
UpdateBounds();
|
|
|
|
|
MarkRenderStateDirty();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void UGameplayDebuggingComponent::EnableDebugDraw(bool bEnable, bool InFocusedComponent)
|
|
|
|
|
{
|
2014-09-09 12:17:30 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-05-29 17:06:50 -04:00
|
|
|
#if WITH_EQS
|
2014-09-09 12:17:30 -04:00
|
|
|
EnableClientEQSSceneProxy(bEnable);
|
2014-05-29 17:06:50 -04:00
|
|
|
#endif // WITH_EQS
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-10 13:56:35 -04:00
|
|
|
void UGameplayDebuggingComponent::ServerReplicateData(uint32 InMessage, uint32 InDataView)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-06-10 13:56:35 -04:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
|
|
|
EDebugComponentMessage::Type Message = (EDebugComponentMessage::Type)InMessage;
|
|
|
|
|
EAIDebugDrawDataView::Type DataView = (EAIDebugDrawDataView::Type) InDataView;
|
|
|
|
|
switch (Message)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
case EDebugComponentMessage::EnableExtendedView:
|
|
|
|
|
ShowExtendedInformatiomCounter++;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EDebugComponentMessage::DisableExtendedView:
|
2014-04-23 19:29:53 -04:00
|
|
|
ShowExtendedInformatiomCounter = FMath::Max(0, ShowExtendedInformatiomCounter - 1);
|
2014-03-14 14:13:41 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EDebugComponentMessage::ActivateReplication:
|
|
|
|
|
Activate();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EDebugComponentMessage::DeactivateReplilcation:
|
2014-09-09 12:17:30 -04:00
|
|
|
Deactivate();
|
2014-03-14 14:13:41 -04:00
|
|
|
break;
|
|
|
|
|
|
2014-04-23 19:29:53 -04:00
|
|
|
case EDebugComponentMessage::ActivateDataView:
|
2014-05-08 08:55:44 -04:00
|
|
|
if (ReplicateViewDataCounters.IsValidIndex(DataView))
|
2014-04-23 19:29:53 -04:00
|
|
|
{
|
|
|
|
|
ReplicateViewDataCounters[DataView] += 1;
|
|
|
|
|
}
|
2014-05-08 08:55:44 -04:00
|
|
|
break;
|
2014-04-23 19:29:53 -04:00
|
|
|
|
|
|
|
|
case EDebugComponentMessage::DeactivateDataView:
|
2014-05-08 08:55:44 -04:00
|
|
|
if (ReplicateViewDataCounters.IsValidIndex(DataView))
|
2014-04-23 19:29:53 -04:00
|
|
|
{
|
|
|
|
|
ReplicateViewDataCounters[DataView] = FMath::Max(0, ReplicateViewDataCounters[DataView] - 1);
|
|
|
|
|
}
|
2014-05-08 08:55:44 -04:00
|
|
|
break;
|
2014-04-23 19:29:53 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-06-10 13:56:35 -04:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-04-23 19:29:53 -04:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// EQS Data
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2014-08-21 20:30:51 -04:00
|
|
|
void UGameplayDebuggingComponent::OnChangeEQSQuery()
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-09-22 15:19:39 -04:00
|
|
|
if (++CurrentEQSIndex >= EQSLocalData.Num())
|
2014-08-21 20:30:51 -04:00
|
|
|
{
|
|
|
|
|
CurrentEQSIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateBounds();
|
|
|
|
|
MarkRenderStateDirty();
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-08-21 20:30:51 -04:00
|
|
|
}
|
|
|
|
|
|
2014-04-23 19:29:53 -04:00
|
|
|
const FEnvQueryResult* UGameplayDebuggingComponent::GetQueryResult() const
|
|
|
|
|
{
|
|
|
|
|
return CachedQueryInstance.Get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FEnvQueryInstance* UGameplayDebuggingComponent::GetQueryInstance() const
|
|
|
|
|
{
|
|
|
|
|
return CachedQueryInstance.Get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::OnRep_UpdateEQS()
|
|
|
|
|
{
|
2014-08-14 09:13:50 -04:00
|
|
|
#if USE_EQS_DEBUGGER
|
2014-04-23 19:29:53 -04:00
|
|
|
// decode scoring data
|
2014-05-08 08:55:44 -04:00
|
|
|
if (World && World->GetNetMode() == NM_Client)
|
2014-04-23 19:29:53 -04:00
|
|
|
{
|
|
|
|
|
TArray<uint8> UncompressedBuffer;
|
|
|
|
|
int32 UncompressedSize = 0;
|
|
|
|
|
const int32 HeaderSize = sizeof(int32);
|
2014-09-29 04:23:44 -04:00
|
|
|
uint8* SrcBuffer = (uint8*)EQSRepData.GetData();
|
2014-04-23 19:29:53 -04:00
|
|
|
FMemory::Memcpy(&UncompressedSize, SrcBuffer, HeaderSize);
|
|
|
|
|
SrcBuffer += HeaderSize;
|
|
|
|
|
const int32 CompressedSize = EQSRepData.Num() - HeaderSize;
|
|
|
|
|
|
|
|
|
|
UncompressedBuffer.AddZeroed(UncompressedSize);
|
|
|
|
|
|
2014-09-29 04:23:44 -04:00
|
|
|
FCompression::UncompressMemory((ECompressionFlags)(COMPRESS_ZLIB), (void*)UncompressedBuffer.GetData(), UncompressedSize, SrcBuffer, CompressedSize);
|
2014-04-23 19:29:53 -04:00
|
|
|
FMemoryReader ArReader(UncompressedBuffer);
|
|
|
|
|
|
|
|
|
|
ArReader << EQSLocalData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateBounds();
|
|
|
|
|
MarkRenderStateDirty();
|
2014-08-14 09:13:50 -04:00
|
|
|
#endif //USE_EQS_DEBUGGER
|
2014-04-23 19:29:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CollectEQSData()
|
|
|
|
|
{
|
|
|
|
|
#if USE_EQS_DEBUGGER
|
|
|
|
|
if (!ShouldReplicateData(EAIDebugDrawDataView::EQS))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UWorld* World = GetWorld();
|
|
|
|
|
UEnvQueryManager* QueryManager = World ? UEnvQueryManager::GetCurrent(World) : NULL;
|
2014-08-07 17:34:29 -04:00
|
|
|
const AActor* Owner = GetSelectedActor();
|
2014-09-22 15:19:39 -04:00
|
|
|
AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner());
|
2014-04-23 19:29:53 -04:00
|
|
|
|
|
|
|
|
if (QueryManager == NULL || Owner == NULL)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-21 20:30:51 -04:00
|
|
|
auto AllQueries = QueryManager->GetDebugger().GetAllQueriesForOwner(Owner);
|
2014-09-16 10:40:22 -04:00
|
|
|
const class APawn* OwnerAsPawn = Cast<class APawn>(Owner);
|
|
|
|
|
if (OwnerAsPawn != NULL && OwnerAsPawn->GetController())
|
|
|
|
|
{
|
|
|
|
|
const auto& AllControllerQueries = QueryManager->GetDebugger().GetAllQueriesForOwner(OwnerAsPawn->GetController());
|
|
|
|
|
AllQueries.Append(AllControllerQueries);
|
|
|
|
|
}
|
2014-09-22 15:19:39 -04:00
|
|
|
struct FEnvQueryInfoSort
|
|
|
|
|
{
|
|
|
|
|
FORCEINLINE bool operator()(const FEQSDebugger::FEnvQueryInfo& A, const FEQSDebugger::FEnvQueryInfo& B) const
|
|
|
|
|
{
|
|
|
|
|
return (A.Timestamp < B.Timestamp);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
TArray<FEQSDebugger::FEnvQueryInfo> QueriesToSort = AllQueries;
|
|
|
|
|
QueriesToSort.Sort(FEnvQueryInfoSort()); //sort queries by timestamp
|
|
|
|
|
QueriesToSort.SetNum(FMath::Min<int32>(Replicator->MaxEQSQueries, AllQueries.Num()));
|
|
|
|
|
|
|
|
|
|
for (int32 Index = AllQueries.Num() - 1; Index >= 0; --Index)
|
|
|
|
|
{
|
|
|
|
|
auto &CurrentQuery = AllQueries[Index];
|
|
|
|
|
if (QueriesToSort.Find(CurrentQuery) == INDEX_NONE)
|
|
|
|
|
{
|
|
|
|
|
AllQueries.RemoveAt(Index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EQSLocalData.Reset();
|
|
|
|
|
for (int32 Index = 0; Index < FMath::Min<int32>(Replicator->MaxEQSQueries, AllQueries.Num()); ++Index)
|
2014-04-23 19:29:53 -04:00
|
|
|
{
|
2014-08-21 20:30:51 -04:00
|
|
|
EQSDebug::FQueryData* CurrentLocalData = NULL;
|
|
|
|
|
CachedQueryInstance = AllQueries[Index].Instance;
|
2014-09-22 15:19:39 -04:00
|
|
|
const float CachedTimestamp = AllQueries[Index].Timestamp;
|
2014-08-21 20:30:51 -04:00
|
|
|
|
|
|
|
|
if (!CurrentLocalData)
|
|
|
|
|
{
|
|
|
|
|
EQSLocalData.AddZeroed();
|
|
|
|
|
CurrentLocalData = &EQSLocalData[EQSLocalData.Num()-1];
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-17 10:07:57 -04:00
|
|
|
if (CachedQueryInstance.IsValid())
|
|
|
|
|
{
|
|
|
|
|
UEnvQueryDebugHelpers::QueryToDebugData(*CachedQueryInstance, *CurrentLocalData);
|
|
|
|
|
}
|
2014-08-21 20:30:51 -04:00
|
|
|
CurrentLocalData->Timestamp = AllQueries[Index].Timestamp;
|
2014-04-23 19:29:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArray<uint8> UncompressedBuffer;
|
|
|
|
|
FMemoryWriter ArWriter(UncompressedBuffer);
|
|
|
|
|
|
|
|
|
|
ArWriter << EQSLocalData;
|
|
|
|
|
|
|
|
|
|
const int32 UncompressedSize = UncompressedBuffer.Num();
|
|
|
|
|
const int32 HeaderSize = sizeof(int32);
|
2014-05-06 06:26:25 -04:00
|
|
|
EQSRepData.Init(0, HeaderSize + FMath::TruncToInt(1.1f * UncompressedSize));
|
2014-04-23 19:29:53 -04:00
|
|
|
|
|
|
|
|
int32 CompressedSize = EQSRepData.Num() - HeaderSize;
|
2014-09-29 04:23:44 -04:00
|
|
|
uint8* DestBuffer = EQSRepData.GetData();
|
2014-04-23 19:29:53 -04:00
|
|
|
FMemory::Memcpy(DestBuffer, &UncompressedSize, HeaderSize);
|
|
|
|
|
DestBuffer += HeaderSize;
|
|
|
|
|
|
|
|
|
|
FCompression::CompressMemory((ECompressionFlags)(COMPRESS_ZLIB | COMPRESS_BiasMemory), (void*)DestBuffer, CompressedSize, (void*)UncompressedBuffer.GetData(), UncompressedSize);
|
|
|
|
|
|
|
|
|
|
EQSRepData.SetNum(CompressedSize + HeaderSize, false);
|
|
|
|
|
|
2014-05-08 08:55:44 -04:00
|
|
|
if (World && World->GetNetMode() != NM_DedicatedServer)
|
2014-04-23 19:29:53 -04:00
|
|
|
{
|
|
|
|
|
OnRep_UpdateEQS();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// NavMesh rendering
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
void UGameplayDebuggingComponent::OnRep_UpdateNavmesh()
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2015-05-06 11:05:00 -04:00
|
|
|
NavMeshBounds = FBox(FVector(-HALF_WORLD_MAX1, -HALF_WORLD_MAX1, -HALF_WORLD_MAX1), FVector(HALF_WORLD_MAX1, HALF_WORLD_MAX1, HALF_WORLD_MAX1));
|
2014-03-14 14:13:41 -04:00
|
|
|
UpdateBounds();
|
|
|
|
|
MarkRenderStateDirty();
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UGameplayDebuggingComponent::ServerCollectNavmeshData_Validate(FVector_NetQuantize10 TargetLocation)
|
|
|
|
|
{
|
|
|
|
|
bool bIsValid = false;
|
|
|
|
|
#if WITH_RECAST
|
|
|
|
|
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
|
2014-05-22 14:14:52 -04:00
|
|
|
bIsValid = NavSys && NavSys->GetMainNavData(FNavigationSystem::DontCreate);
|
2014-03-14 14:13:41 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return bIsValid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UGameplayDebuggingComponent::ServerDiscardNavmeshData_Validate()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace NavMeshDebug
|
|
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
struct FShortVector
|
|
|
|
|
{
|
|
|
|
|
int16 X;
|
|
|
|
|
int16 Y;
|
|
|
|
|
int16 Z;
|
|
|
|
|
|
|
|
|
|
FShortVector()
|
|
|
|
|
:X(0), Y(0), Z(0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FShortVector(const FVector& Vec)
|
|
|
|
|
: X(Vec.X)
|
|
|
|
|
, Y(Vec.Y)
|
|
|
|
|
, Z(Vec.Z)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
FShortVector& operator=(const FVector& R)
|
|
|
|
|
{
|
|
|
|
|
X = R.X;
|
|
|
|
|
Y = R.Y;
|
|
|
|
|
Z = R.Z;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector ToVector() const
|
|
|
|
|
{
|
|
|
|
|
return FVector(X, Y, Z);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct FOffMeshLinkFlags
|
|
|
|
|
{
|
|
|
|
|
uint8 Radius : 6;
|
|
|
|
|
uint8 Direction : 1;
|
|
|
|
|
uint8 ValidEnds : 1;
|
|
|
|
|
};
|
2014-03-14 14:13:41 -04:00
|
|
|
struct FOffMeshLink
|
|
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
FShortVector Left;
|
|
|
|
|
FShortVector Right;
|
2014-03-14 14:13:41 -04:00
|
|
|
FColor Color;
|
2014-04-24 15:04:22 -04:00
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
FOffMeshLinkFlags PackedFlags;
|
|
|
|
|
uint8 ByteFlags;
|
|
|
|
|
};
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct FAreaPolys
|
|
|
|
|
{
|
2014-08-20 05:56:42 -04:00
|
|
|
TArray<int32> Indices;
|
2014-03-14 14:13:41 -04:00
|
|
|
FColor Color;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct FTileData
|
|
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
FVector Location;
|
2014-03-14 14:13:41 -04:00
|
|
|
TArray<FAreaPolys> Areas;
|
2014-04-24 15:04:22 -04:00
|
|
|
TArray<FShortVector> Verts;
|
2014-03-14 14:13:41 -04:00
|
|
|
TArray<FOffMeshLink> Links;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
FArchive& operator<<(FArchive& Ar, NavMeshDebug::FShortVector& ShortVector)
|
|
|
|
|
{
|
|
|
|
|
Ar << ShortVector.X;
|
|
|
|
|
Ar << ShortVector.Y;
|
|
|
|
|
Ar << ShortVector.Z;
|
|
|
|
|
return Ar;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
FArchive& operator<<(FArchive& Ar, NavMeshDebug::FOffMeshLink& Data)
|
|
|
|
|
{
|
|
|
|
|
Ar << Data.Left;
|
|
|
|
|
Ar << Data.Right;
|
2014-04-24 15:04:22 -04:00
|
|
|
Ar << Data.Color.R;
|
|
|
|
|
Ar << Data.Color.G;
|
|
|
|
|
Ar << Data.Color.B;
|
|
|
|
|
Ar << Data.ByteFlags;
|
2014-03-14 14:13:41 -04:00
|
|
|
return Ar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FArchive& operator<<(FArchive& Ar, NavMeshDebug::FAreaPolys& Data)
|
|
|
|
|
{
|
|
|
|
|
Ar << Data.Indices;
|
2014-04-24 15:04:22 -04:00
|
|
|
Ar << Data.Color.R;
|
|
|
|
|
Ar << Data.Color.G;
|
|
|
|
|
Ar << Data.Color.B;
|
2014-09-29 21:43:13 -04:00
|
|
|
Data.Color.A = 255;
|
2014-03-14 14:13:41 -04:00
|
|
|
return Ar;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
FArchive& operator<<(FArchive& Ar, NavMeshDebug::FTileData& Data)
|
|
|
|
|
{
|
|
|
|
|
Ar << Data.Areas;
|
2014-04-24 15:04:22 -04:00
|
|
|
Ar << Data.Location;
|
2014-03-14 14:13:41 -04:00
|
|
|
Ar << Data.Verts;
|
|
|
|
|
Ar << Data.Links;
|
|
|
|
|
return Ar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::ServerDiscardNavmeshData_Implementation()
|
|
|
|
|
{
|
|
|
|
|
NavmeshRepData.Empty();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
FORCEINLINE bool LineInCorrectDistance(const FVector& PlayerLoc, const FVector& Start, const FVector& End, float CorrectDistance = -1)
|
|
|
|
|
{
|
|
|
|
|
const float MaxDistance = CorrectDistance > 0 ? (CorrectDistance*CorrectDistance) : ARecastNavMesh::GetDrawDistanceSq();
|
|
|
|
|
|
|
|
|
|
if ((FVector::DistSquared(Start, PlayerLoc) > MaxDistance || FVector::DistSquared(End, PlayerLoc) > MaxDistance))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
Merging Dev->Main CL#2294650 using UE4-Fortnite-To-UE4
CL#2272587
Added "BlueprintReadWrite" to bNoneIsAllowedValue in FBlackboardKeySelector to avoid breaking any usage of it in blueprints through Break node which people were already using. That matches the usage for AllowedTypes, which is conceptually a related idea and was already set to BlueprintReadWrite.
CL#2272599
Fixed crash when AI were killed in the same frame they were spawning into the world.
CL#2274068
behavior tree search can be reverted, task will be aborted AFTER finding a valid replacement
fix for move action crashing on pawn's death
CL#2274177
fixed behavior tree's search range when there are mutliple restart requests in the same frame
CL#2274359
Fixes RotateToFaceBBEntry not working correctly when focusing on an actor
- the GetFocalPoint call to AIController had different behavior if you called it with a priority vs. without
- with a priority we would just look at the Priorities and return the position, but that position was never being updated for Actors
- without a priority we would go through all the priorities, check for an Actor, and if it existed we would return its location
- while I could have just modified the RotateToFaceBBEntry call to just call GetFocusActor for the appropriate focus priority, this seems like the better fix)
- solution was to make the GetFocalPoint with a focus priority work exactly like the one without the focus priority. while I would have liked to reduce the copy/paste code between the functions it didn't seem like a good idea.
Also fixed Precision not considering vectors that were in the same direction (>= vs just > with the angle threshold value)
CL#2274719
Fix crash related to AnimCameraActor.
TTP #344968 CRASH: TAKER: If the world owner leaves the game in the middle of a Taker Soul sucking another player, the Client will crash.
CL#2274988
#UE4 Proper handling of saving level assets that were created without a valid non-read only path. TTP#344899
CL#2275045
#UE4: Include "IHttpBase.h" in IHttpResponse.h since it's using a base class from there (they're truly dependent). Would be nice if this file just had the enum though.
CL#2275152
TTP# 336668
Moved the input check for VOIP from the child widgets into the base SFortHUDLayer to capture that event on different screens. Removed code duplication.
CL#2275528
Fixed StaticMeshComponent destruction blocking on the rendering thread instead of using the UObject async destruction interface
CL#2275960
fixed behavior tree search being discarded after merge with non discardable request
decorator observers will be added even after failed search
CL#2276294
Added support to EQS "Dot" test for 2D dot-product AND taking absolute value of dot-product (for biasing for lateral over forward/back).
They are separate options which can be used together or separately.
CL#2277344
fixed BT decorator indices for abort range preview in editor
CL#2277473
NavCollision settings of static mesh will persist through reimport
ttp# 344853
CL#2277509
fixed multiple nodes connected to special pins in behavior tree editor
CL#2278042
Fixes EQS not returning the best item when the last EQS test is a filter.
- To do this, on the last test if we know it's just a filter and eventually we will use the first item that passes the test, then we sort prior to filtering.
Made the filter and score test types display "Filter Only" & "Score Only"
CL#2278111
Improved EQS Dot test "Description Title" to display "Absolute" and " 2D" as appropriate.
CL#2278115
Added "Random" EQS test, which can be used for adding a random value to items.
Potentially needed for hunting EQS query Phil is working on, and should be useful for other cases as well.
CL#2278286
Fixes crash when trying to use the VisLog due to a spelling correction made in CL 2276628.
CL#2281762
Moved VLOG in Vlog Redirect function to avoid ensure
- Ensure was caused because we were trying to log to a redirect when the redirect hadn't be set yet
CL#2282248
Fixed EQS "Random" test to work with ANY query item type, not just VectorBase item types.
CL#2282639
Enhanced debug information data for single item in EQS Debugger (GameplayDebugger feature) #ue4
- Fixed few compilation issues with disabled USE_EQS_DEBUGGER flag
- Fixed crash in EQSRenderingComponent
- Fixed EQS debug data for sorted EQS itesm (it's slower way to sort items but only with active USE_EQS_DEBUGGER flag)
CL#2282678
fixed crash on reimporting static mesh without NavCollision data
ttp# 345454
CL#2282919
Renamed BTTask_MoveDirectlyToward.bForceMoveToLocation to more clear bDisablePathUpdateOnGoalLocationChange #UE4
- also fixed a bug in FortBTTask_GameMoveDirectlyToward that was misusing that variable. This addressed TTP#343489
CL#2282927
Fixed paths rendering while using GameplayDebugger (client/server too) #Fortnite
CL#2283374
Fixes crowd following AIs (ie. regular husks) trying to rotate in the direction of their CrowdAgentMoveDirection while falling or not moving
(Fixes ttp 344776)
CL#2283475
Comment/code refactor that occurred but wasn't saved prior to check in of CL 2283374
CL#2283644
#UE4 Fix various issues seen when changing graphics settings with r.detailmode causes all components to reregister
Fix it so particle system components track if they were active when unregistering, reactivate on next register if true
Fix it so character movement components don't throw away timestamp data on unregister, this broke networking entirely
Fix it so single anim skeletal meshes restore state accross reinitializations
CL#2283688
Make bPendingKillPending no longer a UProperty so it won't be serialized.
Fixes TTPs 342221, 342634
CL#2283879
#UE4 Fix it so the scalability settings are correctly written to the user config file when saving settings, and are properly reset to in memory values when reset. Has been broken since they got refactored.
CL#2284368
fixed crash on using blueprint-based EQS contexts in PIE
CL#2284405
HotSpots auto expire #UE4
Also, Fortnite-specific:
- made FortAIHotSpotManager the owner of hotspots spawning process
- added support for having multiple hotspots assigned to one BuildingSMActor, one per approach vector
CL#2285167
Fixed Fortnite client to match FriendsService API change for pending invites
CL#2285650
#UE4: Allow JsonObjectConverter to convert Strings to FDateTime fields using ISO-8601
CL#2286127
fixed pathfinding eqs test
CL#2286208
fixed EQS tests reverting to Score Only settings after reopening editor
ttp# 345719
CL#2286296
Game Invites work in Fortnite again
Fixed game to match a backend API change
CL#2286378
Removing TickAnim from InitAnim as that seems unnecessary and should avoid if we can.
CL#2286408
- TTP#345476 Slate: Fixed MenuPlacement_AboveAnchor not being respected.
CL#2286777
Fixed bug in GameplayDebuggingComponent which would cause debug display of EQS queries sharing the same name never to update after the initial query of a certain name is made. (In Fortnite, Goal Manager queries all have the same name, and the data would never update. In fact, even choosing a second actor would not clear out the data from the earlier actor, because they weren't updating data when the Timestamp updated.)
CL#2289211
Fix for TTP #345752 "CRASH: DEDICATED SERVER: ToggleAILogging with a gate active causes a server crash"
CL#2289279
LatentActionManager: value from iterator (over ObjectToActionListMap) was invalidated, when ObjectToActionListMap was changed.
Unique Ptr should be used instead of SharedPtr, but UniquePtr is currently not compatible with TMap.
CL#2289897
Fixes flying AIs (like the Taker) trying to move their feet to their destination, causing them to float higher than they should be.
CL#2290041
Fix a number of properties in the Action_Move hierarchy that aren't exposed and therefore aren't duplicated when we duplicate Pawn Actions.
CL#2290210
#UE4 Fix it so UEngine::ShutdownWorldNetDriver shuts down all net drivers associated with a world and not just a primary one. Fixes a crash when transferring maps with an active beacon net driver. Also fix issue where UEngine::ShutdownAllNetDrivers would miss some net drivers due to indexes being removed
- Duplicating actions occurs as part of adding a Pawn Action Sequence comprised of multiple Pawn Actions. The bug causes undesired behavior because the properties that were set on the initial Pawn Action are not carried over to the duplicate.
- We will continue to use the feet location as the origin of the Actor for determining requested velocity with walking AIs, but use the Actor's location as the origin for non-walking AIs
CL#2290255
#UE4 Fix to previous netdriver checkin, only kill world net drivers if the world is actively set, idle net drivers are fine and needed for beacons to work properly
CL#2290585
Fixed some PawnActions' bool properties not being marked as UPROPERTIES #UE4
It was resulting in copied actions loosing parts of its configuration.
Also:
- added a parameter to PawnAction_Move to controll "finish on overlap" path following behavior
CL#2290675
Extended GameplayDebugger view in Simulation. I added a way to switch debug views, to have all functionality from PIE. #ue4
CL#2290778
fixed invalid nav nodes in paths after offseting
CL#2290784
moved pathfollowing's reachability test out of FollowPathSegment function (it's supposed to handle only velocity calculations), agent will always use feet location for moving on path segment
CL#2292104
Fixes for GameplayDebugger, it mostly fixes activation in different configurations (PIE, standalone, client-server, etc.).
CL#2292198
Fixed issues related to NavMesh rendering and EQS query switching for GameplayDebugger. #ue4
CL#2292766
Fixed crash if touch event without valid MovieStreamer
CL#2292967
GameplayDebuggingComponent now tries to pick the correct nav-mesh for the selected actor, rather than always displaying the default nav-mesh.
NOTE: If you switch from one actor to another with nav-agent properties that are associated with different nav-meshes, it may continue to display the original nav-mesh for a while until it needs to update the position where the nav-mesh should display.
CL#2293116
#UE4 #HTTP: Make LibCurl reuse connections by default on windows/android to mirror the change in CL# 2025870. Also added [Networking]UseLibCurl as an option to have LibCurl get used in addition to command line.
CL#2293217
Added suffix override to allow StagingInfo instances without platform in the staging path
This is to handle where platform is already in each build product instead of as a root dir, eg. \\WindowsClient instead of \\Windows\\WindowsClient
CL#2293263
#UE4: Make JsonObjectConverter skip null values in arrays and structs (this is consistent with skipping missing keys)
CL#2293534
fixed parent node usage in navigation octree (navmesh stays unchanged after deleting an actor)
CL#2293536
fixed updating parent chain in navoctree after removing last attached node
CL#2293543
changed navigation octree parent map to use weak object pointers (merged from main)
CL#2293952
Changes/improvements to curl http module:
- Properly get bUseCurl from a configuration file.
- Do less work when creating requests (checking commandline settings moved to CurlHttpManager).
- Do not init/shutdown unless actually used.
CL#2294062
Added virtual function OnCharacterStuckInGeometry for Characters that get stuck in geometry to CharacterMovementComponent
- Allows subclasses to define behavior when this occurs
- Comment states that this only will be called when the character is walking
[CL 2305577 by Bob Tellez in Main branch]
2014-09-22 10:33:39 -04:00
|
|
|
#if WITH_RECAST
|
|
|
|
|
ARecastNavMesh* UGameplayDebuggingComponent::GetNavData()
|
|
|
|
|
{
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
Merging Dev->Main CL#2294650 using UE4-Fortnite-To-UE4
CL#2272587
Added "BlueprintReadWrite" to bNoneIsAllowedValue in FBlackboardKeySelector to avoid breaking any usage of it in blueprints through Break node which people were already using. That matches the usage for AllowedTypes, which is conceptually a related idea and was already set to BlueprintReadWrite.
CL#2272599
Fixed crash when AI were killed in the same frame they were spawning into the world.
CL#2274068
behavior tree search can be reverted, task will be aborted AFTER finding a valid replacement
fix for move action crashing on pawn's death
CL#2274177
fixed behavior tree's search range when there are mutliple restart requests in the same frame
CL#2274359
Fixes RotateToFaceBBEntry not working correctly when focusing on an actor
- the GetFocalPoint call to AIController had different behavior if you called it with a priority vs. without
- with a priority we would just look at the Priorities and return the position, but that position was never being updated for Actors
- without a priority we would go through all the priorities, check for an Actor, and if it existed we would return its location
- while I could have just modified the RotateToFaceBBEntry call to just call GetFocusActor for the appropriate focus priority, this seems like the better fix)
- solution was to make the GetFocalPoint with a focus priority work exactly like the one without the focus priority. while I would have liked to reduce the copy/paste code between the functions it didn't seem like a good idea.
Also fixed Precision not considering vectors that were in the same direction (>= vs just > with the angle threshold value)
CL#2274719
Fix crash related to AnimCameraActor.
TTP #344968 CRASH: TAKER: If the world owner leaves the game in the middle of a Taker Soul sucking another player, the Client will crash.
CL#2274988
#UE4 Proper handling of saving level assets that were created without a valid non-read only path. TTP#344899
CL#2275045
#UE4: Include "IHttpBase.h" in IHttpResponse.h since it's using a base class from there (they're truly dependent). Would be nice if this file just had the enum though.
CL#2275152
TTP# 336668
Moved the input check for VOIP from the child widgets into the base SFortHUDLayer to capture that event on different screens. Removed code duplication.
CL#2275528
Fixed StaticMeshComponent destruction blocking on the rendering thread instead of using the UObject async destruction interface
CL#2275960
fixed behavior tree search being discarded after merge with non discardable request
decorator observers will be added even after failed search
CL#2276294
Added support to EQS "Dot" test for 2D dot-product AND taking absolute value of dot-product (for biasing for lateral over forward/back).
They are separate options which can be used together or separately.
CL#2277344
fixed BT decorator indices for abort range preview in editor
CL#2277473
NavCollision settings of static mesh will persist through reimport
ttp# 344853
CL#2277509
fixed multiple nodes connected to special pins in behavior tree editor
CL#2278042
Fixes EQS not returning the best item when the last EQS test is a filter.
- To do this, on the last test if we know it's just a filter and eventually we will use the first item that passes the test, then we sort prior to filtering.
Made the filter and score test types display "Filter Only" & "Score Only"
CL#2278111
Improved EQS Dot test "Description Title" to display "Absolute" and " 2D" as appropriate.
CL#2278115
Added "Random" EQS test, which can be used for adding a random value to items.
Potentially needed for hunting EQS query Phil is working on, and should be useful for other cases as well.
CL#2278286
Fixes crash when trying to use the VisLog due to a spelling correction made in CL 2276628.
CL#2281762
Moved VLOG in Vlog Redirect function to avoid ensure
- Ensure was caused because we were trying to log to a redirect when the redirect hadn't be set yet
CL#2282248
Fixed EQS "Random" test to work with ANY query item type, not just VectorBase item types.
CL#2282639
Enhanced debug information data for single item in EQS Debugger (GameplayDebugger feature) #ue4
- Fixed few compilation issues with disabled USE_EQS_DEBUGGER flag
- Fixed crash in EQSRenderingComponent
- Fixed EQS debug data for sorted EQS itesm (it's slower way to sort items but only with active USE_EQS_DEBUGGER flag)
CL#2282678
fixed crash on reimporting static mesh without NavCollision data
ttp# 345454
CL#2282919
Renamed BTTask_MoveDirectlyToward.bForceMoveToLocation to more clear bDisablePathUpdateOnGoalLocationChange #UE4
- also fixed a bug in FortBTTask_GameMoveDirectlyToward that was misusing that variable. This addressed TTP#343489
CL#2282927
Fixed paths rendering while using GameplayDebugger (client/server too) #Fortnite
CL#2283374
Fixes crowd following AIs (ie. regular husks) trying to rotate in the direction of their CrowdAgentMoveDirection while falling or not moving
(Fixes ttp 344776)
CL#2283475
Comment/code refactor that occurred but wasn't saved prior to check in of CL 2283374
CL#2283644
#UE4 Fix various issues seen when changing graphics settings with r.detailmode causes all components to reregister
Fix it so particle system components track if they were active when unregistering, reactivate on next register if true
Fix it so character movement components don't throw away timestamp data on unregister, this broke networking entirely
Fix it so single anim skeletal meshes restore state accross reinitializations
CL#2283688
Make bPendingKillPending no longer a UProperty so it won't be serialized.
Fixes TTPs 342221, 342634
CL#2283879
#UE4 Fix it so the scalability settings are correctly written to the user config file when saving settings, and are properly reset to in memory values when reset. Has been broken since they got refactored.
CL#2284368
fixed crash on using blueprint-based EQS contexts in PIE
CL#2284405
HotSpots auto expire #UE4
Also, Fortnite-specific:
- made FortAIHotSpotManager the owner of hotspots spawning process
- added support for having multiple hotspots assigned to one BuildingSMActor, one per approach vector
CL#2285167
Fixed Fortnite client to match FriendsService API change for pending invites
CL#2285650
#UE4: Allow JsonObjectConverter to convert Strings to FDateTime fields using ISO-8601
CL#2286127
fixed pathfinding eqs test
CL#2286208
fixed EQS tests reverting to Score Only settings after reopening editor
ttp# 345719
CL#2286296
Game Invites work in Fortnite again
Fixed game to match a backend API change
CL#2286378
Removing TickAnim from InitAnim as that seems unnecessary and should avoid if we can.
CL#2286408
- TTP#345476 Slate: Fixed MenuPlacement_AboveAnchor not being respected.
CL#2286777
Fixed bug in GameplayDebuggingComponent which would cause debug display of EQS queries sharing the same name never to update after the initial query of a certain name is made. (In Fortnite, Goal Manager queries all have the same name, and the data would never update. In fact, even choosing a second actor would not clear out the data from the earlier actor, because they weren't updating data when the Timestamp updated.)
CL#2289211
Fix for TTP #345752 "CRASH: DEDICATED SERVER: ToggleAILogging with a gate active causes a server crash"
CL#2289279
LatentActionManager: value from iterator (over ObjectToActionListMap) was invalidated, when ObjectToActionListMap was changed.
Unique Ptr should be used instead of SharedPtr, but UniquePtr is currently not compatible with TMap.
CL#2289897
Fixes flying AIs (like the Taker) trying to move their feet to their destination, causing them to float higher than they should be.
CL#2290041
Fix a number of properties in the Action_Move hierarchy that aren't exposed and therefore aren't duplicated when we duplicate Pawn Actions.
CL#2290210
#UE4 Fix it so UEngine::ShutdownWorldNetDriver shuts down all net drivers associated with a world and not just a primary one. Fixes a crash when transferring maps with an active beacon net driver. Also fix issue where UEngine::ShutdownAllNetDrivers would miss some net drivers due to indexes being removed
- Duplicating actions occurs as part of adding a Pawn Action Sequence comprised of multiple Pawn Actions. The bug causes undesired behavior because the properties that were set on the initial Pawn Action are not carried over to the duplicate.
- We will continue to use the feet location as the origin of the Actor for determining requested velocity with walking AIs, but use the Actor's location as the origin for non-walking AIs
CL#2290255
#UE4 Fix to previous netdriver checkin, only kill world net drivers if the world is actively set, idle net drivers are fine and needed for beacons to work properly
CL#2290585
Fixed some PawnActions' bool properties not being marked as UPROPERTIES #UE4
It was resulting in copied actions loosing parts of its configuration.
Also:
- added a parameter to PawnAction_Move to controll "finish on overlap" path following behavior
CL#2290675
Extended GameplayDebugger view in Simulation. I added a way to switch debug views, to have all functionality from PIE. #ue4
CL#2290778
fixed invalid nav nodes in paths after offseting
CL#2290784
moved pathfollowing's reachability test out of FollowPathSegment function (it's supposed to handle only velocity calculations), agent will always use feet location for moving on path segment
CL#2292104
Fixes for GameplayDebugger, it mostly fixes activation in different configurations (PIE, standalone, client-server, etc.).
CL#2292198
Fixed issues related to NavMesh rendering and EQS query switching for GameplayDebugger. #ue4
CL#2292766
Fixed crash if touch event without valid MovieStreamer
CL#2292967
GameplayDebuggingComponent now tries to pick the correct nav-mesh for the selected actor, rather than always displaying the default nav-mesh.
NOTE: If you switch from one actor to another with nav-agent properties that are associated with different nav-meshes, it may continue to display the original nav-mesh for a while until it needs to update the position where the nav-mesh should display.
CL#2293116
#UE4 #HTTP: Make LibCurl reuse connections by default on windows/android to mirror the change in CL# 2025870. Also added [Networking]UseLibCurl as an option to have LibCurl get used in addition to command line.
CL#2293217
Added suffix override to allow StagingInfo instances without platform in the staging path
This is to handle where platform is already in each build product instead of as a root dir, eg. \\WindowsClient instead of \\Windows\\WindowsClient
CL#2293263
#UE4: Make JsonObjectConverter skip null values in arrays and structs (this is consistent with skipping missing keys)
CL#2293534
fixed parent node usage in navigation octree (navmesh stays unchanged after deleting an actor)
CL#2293536
fixed updating parent chain in navoctree after removing last attached node
CL#2293543
changed navigation octree parent map to use weak object pointers (merged from main)
CL#2293952
Changes/improvements to curl http module:
- Properly get bUseCurl from a configuration file.
- Do less work when creating requests (checking commandline settings moved to CurlHttpManager).
- Do not init/shutdown unless actually used.
CL#2294062
Added virtual function OnCharacterStuckInGeometry for Characters that get stuck in geometry to CharacterMovementComponent
- Allows subclasses to define behavior when this occurs
- Comment states that this only will be called when the character is walking
[CL 2305577 by Bob Tellez in Main branch]
2014-09-22 10:33:39 -04:00
|
|
|
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
|
|
|
|
|
if (NavSys == NULL)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Try to get the correct nav-mesh relative to the selected actor.
|
|
|
|
|
APawn* TargetPawn = Cast<APawn>(TargetActor);
|
|
|
|
|
if (TargetPawn != NULL)
|
|
|
|
|
{
|
2015-01-13 14:55:09 -05:00
|
|
|
const FNavAgentProperties& NavAgentProperties = TargetPawn->GetNavAgentPropertiesRef();
|
2014-11-19 21:15:31 -05:00
|
|
|
return Cast<ARecastNavMesh>(NavSys->GetNavDataForProps(NavAgentProperties));
|
Merging Dev->Main CL#2294650 using UE4-Fortnite-To-UE4
CL#2272587
Added "BlueprintReadWrite" to bNoneIsAllowedValue in FBlackboardKeySelector to avoid breaking any usage of it in blueprints through Break node which people were already using. That matches the usage for AllowedTypes, which is conceptually a related idea and was already set to BlueprintReadWrite.
CL#2272599
Fixed crash when AI were killed in the same frame they were spawning into the world.
CL#2274068
behavior tree search can be reverted, task will be aborted AFTER finding a valid replacement
fix for move action crashing on pawn's death
CL#2274177
fixed behavior tree's search range when there are mutliple restart requests in the same frame
CL#2274359
Fixes RotateToFaceBBEntry not working correctly when focusing on an actor
- the GetFocalPoint call to AIController had different behavior if you called it with a priority vs. without
- with a priority we would just look at the Priorities and return the position, but that position was never being updated for Actors
- without a priority we would go through all the priorities, check for an Actor, and if it existed we would return its location
- while I could have just modified the RotateToFaceBBEntry call to just call GetFocusActor for the appropriate focus priority, this seems like the better fix)
- solution was to make the GetFocalPoint with a focus priority work exactly like the one without the focus priority. while I would have liked to reduce the copy/paste code between the functions it didn't seem like a good idea.
Also fixed Precision not considering vectors that were in the same direction (>= vs just > with the angle threshold value)
CL#2274719
Fix crash related to AnimCameraActor.
TTP #344968 CRASH: TAKER: If the world owner leaves the game in the middle of a Taker Soul sucking another player, the Client will crash.
CL#2274988
#UE4 Proper handling of saving level assets that were created without a valid non-read only path. TTP#344899
CL#2275045
#UE4: Include "IHttpBase.h" in IHttpResponse.h since it's using a base class from there (they're truly dependent). Would be nice if this file just had the enum though.
CL#2275152
TTP# 336668
Moved the input check for VOIP from the child widgets into the base SFortHUDLayer to capture that event on different screens. Removed code duplication.
CL#2275528
Fixed StaticMeshComponent destruction blocking on the rendering thread instead of using the UObject async destruction interface
CL#2275960
fixed behavior tree search being discarded after merge with non discardable request
decorator observers will be added even after failed search
CL#2276294
Added support to EQS "Dot" test for 2D dot-product AND taking absolute value of dot-product (for biasing for lateral over forward/back).
They are separate options which can be used together or separately.
CL#2277344
fixed BT decorator indices for abort range preview in editor
CL#2277473
NavCollision settings of static mesh will persist through reimport
ttp# 344853
CL#2277509
fixed multiple nodes connected to special pins in behavior tree editor
CL#2278042
Fixes EQS not returning the best item when the last EQS test is a filter.
- To do this, on the last test if we know it's just a filter and eventually we will use the first item that passes the test, then we sort prior to filtering.
Made the filter and score test types display "Filter Only" & "Score Only"
CL#2278111
Improved EQS Dot test "Description Title" to display "Absolute" and " 2D" as appropriate.
CL#2278115
Added "Random" EQS test, which can be used for adding a random value to items.
Potentially needed for hunting EQS query Phil is working on, and should be useful for other cases as well.
CL#2278286
Fixes crash when trying to use the VisLog due to a spelling correction made in CL 2276628.
CL#2281762
Moved VLOG in Vlog Redirect function to avoid ensure
- Ensure was caused because we were trying to log to a redirect when the redirect hadn't be set yet
CL#2282248
Fixed EQS "Random" test to work with ANY query item type, not just VectorBase item types.
CL#2282639
Enhanced debug information data for single item in EQS Debugger (GameplayDebugger feature) #ue4
- Fixed few compilation issues with disabled USE_EQS_DEBUGGER flag
- Fixed crash in EQSRenderingComponent
- Fixed EQS debug data for sorted EQS itesm (it's slower way to sort items but only with active USE_EQS_DEBUGGER flag)
CL#2282678
fixed crash on reimporting static mesh without NavCollision data
ttp# 345454
CL#2282919
Renamed BTTask_MoveDirectlyToward.bForceMoveToLocation to more clear bDisablePathUpdateOnGoalLocationChange #UE4
- also fixed a bug in FortBTTask_GameMoveDirectlyToward that was misusing that variable. This addressed TTP#343489
CL#2282927
Fixed paths rendering while using GameplayDebugger (client/server too) #Fortnite
CL#2283374
Fixes crowd following AIs (ie. regular husks) trying to rotate in the direction of their CrowdAgentMoveDirection while falling or not moving
(Fixes ttp 344776)
CL#2283475
Comment/code refactor that occurred but wasn't saved prior to check in of CL 2283374
CL#2283644
#UE4 Fix various issues seen when changing graphics settings with r.detailmode causes all components to reregister
Fix it so particle system components track if they were active when unregistering, reactivate on next register if true
Fix it so character movement components don't throw away timestamp data on unregister, this broke networking entirely
Fix it so single anim skeletal meshes restore state accross reinitializations
CL#2283688
Make bPendingKillPending no longer a UProperty so it won't be serialized.
Fixes TTPs 342221, 342634
CL#2283879
#UE4 Fix it so the scalability settings are correctly written to the user config file when saving settings, and are properly reset to in memory values when reset. Has been broken since they got refactored.
CL#2284368
fixed crash on using blueprint-based EQS contexts in PIE
CL#2284405
HotSpots auto expire #UE4
Also, Fortnite-specific:
- made FortAIHotSpotManager the owner of hotspots spawning process
- added support for having multiple hotspots assigned to one BuildingSMActor, one per approach vector
CL#2285167
Fixed Fortnite client to match FriendsService API change for pending invites
CL#2285650
#UE4: Allow JsonObjectConverter to convert Strings to FDateTime fields using ISO-8601
CL#2286127
fixed pathfinding eqs test
CL#2286208
fixed EQS tests reverting to Score Only settings after reopening editor
ttp# 345719
CL#2286296
Game Invites work in Fortnite again
Fixed game to match a backend API change
CL#2286378
Removing TickAnim from InitAnim as that seems unnecessary and should avoid if we can.
CL#2286408
- TTP#345476 Slate: Fixed MenuPlacement_AboveAnchor not being respected.
CL#2286777
Fixed bug in GameplayDebuggingComponent which would cause debug display of EQS queries sharing the same name never to update after the initial query of a certain name is made. (In Fortnite, Goal Manager queries all have the same name, and the data would never update. In fact, even choosing a second actor would not clear out the data from the earlier actor, because they weren't updating data when the Timestamp updated.)
CL#2289211
Fix for TTP #345752 "CRASH: DEDICATED SERVER: ToggleAILogging with a gate active causes a server crash"
CL#2289279
LatentActionManager: value from iterator (over ObjectToActionListMap) was invalidated, when ObjectToActionListMap was changed.
Unique Ptr should be used instead of SharedPtr, but UniquePtr is currently not compatible with TMap.
CL#2289897
Fixes flying AIs (like the Taker) trying to move their feet to their destination, causing them to float higher than they should be.
CL#2290041
Fix a number of properties in the Action_Move hierarchy that aren't exposed and therefore aren't duplicated when we duplicate Pawn Actions.
CL#2290210
#UE4 Fix it so UEngine::ShutdownWorldNetDriver shuts down all net drivers associated with a world and not just a primary one. Fixes a crash when transferring maps with an active beacon net driver. Also fix issue where UEngine::ShutdownAllNetDrivers would miss some net drivers due to indexes being removed
- Duplicating actions occurs as part of adding a Pawn Action Sequence comprised of multiple Pawn Actions. The bug causes undesired behavior because the properties that were set on the initial Pawn Action are not carried over to the duplicate.
- We will continue to use the feet location as the origin of the Actor for determining requested velocity with walking AIs, but use the Actor's location as the origin for non-walking AIs
CL#2290255
#UE4 Fix to previous netdriver checkin, only kill world net drivers if the world is actively set, idle net drivers are fine and needed for beacons to work properly
CL#2290585
Fixed some PawnActions' bool properties not being marked as UPROPERTIES #UE4
It was resulting in copied actions loosing parts of its configuration.
Also:
- added a parameter to PawnAction_Move to controll "finish on overlap" path following behavior
CL#2290675
Extended GameplayDebugger view in Simulation. I added a way to switch debug views, to have all functionality from PIE. #ue4
CL#2290778
fixed invalid nav nodes in paths after offseting
CL#2290784
moved pathfollowing's reachability test out of FollowPathSegment function (it's supposed to handle only velocity calculations), agent will always use feet location for moving on path segment
CL#2292104
Fixes for GameplayDebugger, it mostly fixes activation in different configurations (PIE, standalone, client-server, etc.).
CL#2292198
Fixed issues related to NavMesh rendering and EQS query switching for GameplayDebugger. #ue4
CL#2292766
Fixed crash if touch event without valid MovieStreamer
CL#2292967
GameplayDebuggingComponent now tries to pick the correct nav-mesh for the selected actor, rather than always displaying the default nav-mesh.
NOTE: If you switch from one actor to another with nav-agent properties that are associated with different nav-meshes, it may continue to display the original nav-mesh for a while until it needs to update the position where the nav-mesh should display.
CL#2293116
#UE4 #HTTP: Make LibCurl reuse connections by default on windows/android to mirror the change in CL# 2025870. Also added [Networking]UseLibCurl as an option to have LibCurl get used in addition to command line.
CL#2293217
Added suffix override to allow StagingInfo instances without platform in the staging path
This is to handle where platform is already in each build product instead of as a root dir, eg. \\WindowsClient instead of \\Windows\\WindowsClient
CL#2293263
#UE4: Make JsonObjectConverter skip null values in arrays and structs (this is consistent with skipping missing keys)
CL#2293534
fixed parent node usage in navigation octree (navmesh stays unchanged after deleting an actor)
CL#2293536
fixed updating parent chain in navoctree after removing last attached node
CL#2293543
changed navigation octree parent map to use weak object pointers (merged from main)
CL#2293952
Changes/improvements to curl http module:
- Properly get bUseCurl from a configuration file.
- Do less work when creating requests (checking commandline settings moved to CurlHttpManager).
- Do not init/shutdown unless actually used.
CL#2294062
Added virtual function OnCharacterStuckInGeometry for Characters that get stuck in geometry to CharacterMovementComponent
- Allows subclasses to define behavior when this occurs
- Comment states that this only will be called when the character is walking
[CL 2305577 by Bob Tellez in Main branch]
2014-09-22 10:33:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If it wasn't found, just get the main nav-mesh data.
|
|
|
|
|
return Cast<ARecastNavMesh>(NavSys->GetMainNavData(FNavigationSystem::DontCreate));
|
2015-02-27 09:26:32 -05:00
|
|
|
#else
|
|
|
|
|
return NULL;
|
|
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
Merging Dev->Main CL#2294650 using UE4-Fortnite-To-UE4
CL#2272587
Added "BlueprintReadWrite" to bNoneIsAllowedValue in FBlackboardKeySelector to avoid breaking any usage of it in blueprints through Break node which people were already using. That matches the usage for AllowedTypes, which is conceptually a related idea and was already set to BlueprintReadWrite.
CL#2272599
Fixed crash when AI were killed in the same frame they were spawning into the world.
CL#2274068
behavior tree search can be reverted, task will be aborted AFTER finding a valid replacement
fix for move action crashing on pawn's death
CL#2274177
fixed behavior tree's search range when there are mutliple restart requests in the same frame
CL#2274359
Fixes RotateToFaceBBEntry not working correctly when focusing on an actor
- the GetFocalPoint call to AIController had different behavior if you called it with a priority vs. without
- with a priority we would just look at the Priorities and return the position, but that position was never being updated for Actors
- without a priority we would go through all the priorities, check for an Actor, and if it existed we would return its location
- while I could have just modified the RotateToFaceBBEntry call to just call GetFocusActor for the appropriate focus priority, this seems like the better fix)
- solution was to make the GetFocalPoint with a focus priority work exactly like the one without the focus priority. while I would have liked to reduce the copy/paste code between the functions it didn't seem like a good idea.
Also fixed Precision not considering vectors that were in the same direction (>= vs just > with the angle threshold value)
CL#2274719
Fix crash related to AnimCameraActor.
TTP #344968 CRASH: TAKER: If the world owner leaves the game in the middle of a Taker Soul sucking another player, the Client will crash.
CL#2274988
#UE4 Proper handling of saving level assets that were created without a valid non-read only path. TTP#344899
CL#2275045
#UE4: Include "IHttpBase.h" in IHttpResponse.h since it's using a base class from there (they're truly dependent). Would be nice if this file just had the enum though.
CL#2275152
TTP# 336668
Moved the input check for VOIP from the child widgets into the base SFortHUDLayer to capture that event on different screens. Removed code duplication.
CL#2275528
Fixed StaticMeshComponent destruction blocking on the rendering thread instead of using the UObject async destruction interface
CL#2275960
fixed behavior tree search being discarded after merge with non discardable request
decorator observers will be added even after failed search
CL#2276294
Added support to EQS "Dot" test for 2D dot-product AND taking absolute value of dot-product (for biasing for lateral over forward/back).
They are separate options which can be used together or separately.
CL#2277344
fixed BT decorator indices for abort range preview in editor
CL#2277473
NavCollision settings of static mesh will persist through reimport
ttp# 344853
CL#2277509
fixed multiple nodes connected to special pins in behavior tree editor
CL#2278042
Fixes EQS not returning the best item when the last EQS test is a filter.
- To do this, on the last test if we know it's just a filter and eventually we will use the first item that passes the test, then we sort prior to filtering.
Made the filter and score test types display "Filter Only" & "Score Only"
CL#2278111
Improved EQS Dot test "Description Title" to display "Absolute" and " 2D" as appropriate.
CL#2278115
Added "Random" EQS test, which can be used for adding a random value to items.
Potentially needed for hunting EQS query Phil is working on, and should be useful for other cases as well.
CL#2278286
Fixes crash when trying to use the VisLog due to a spelling correction made in CL 2276628.
CL#2281762
Moved VLOG in Vlog Redirect function to avoid ensure
- Ensure was caused because we were trying to log to a redirect when the redirect hadn't be set yet
CL#2282248
Fixed EQS "Random" test to work with ANY query item type, not just VectorBase item types.
CL#2282639
Enhanced debug information data for single item in EQS Debugger (GameplayDebugger feature) #ue4
- Fixed few compilation issues with disabled USE_EQS_DEBUGGER flag
- Fixed crash in EQSRenderingComponent
- Fixed EQS debug data for sorted EQS itesm (it's slower way to sort items but only with active USE_EQS_DEBUGGER flag)
CL#2282678
fixed crash on reimporting static mesh without NavCollision data
ttp# 345454
CL#2282919
Renamed BTTask_MoveDirectlyToward.bForceMoveToLocation to more clear bDisablePathUpdateOnGoalLocationChange #UE4
- also fixed a bug in FortBTTask_GameMoveDirectlyToward that was misusing that variable. This addressed TTP#343489
CL#2282927
Fixed paths rendering while using GameplayDebugger (client/server too) #Fortnite
CL#2283374
Fixes crowd following AIs (ie. regular husks) trying to rotate in the direction of their CrowdAgentMoveDirection while falling or not moving
(Fixes ttp 344776)
CL#2283475
Comment/code refactor that occurred but wasn't saved prior to check in of CL 2283374
CL#2283644
#UE4 Fix various issues seen when changing graphics settings with r.detailmode causes all components to reregister
Fix it so particle system components track if they were active when unregistering, reactivate on next register if true
Fix it so character movement components don't throw away timestamp data on unregister, this broke networking entirely
Fix it so single anim skeletal meshes restore state accross reinitializations
CL#2283688
Make bPendingKillPending no longer a UProperty so it won't be serialized.
Fixes TTPs 342221, 342634
CL#2283879
#UE4 Fix it so the scalability settings are correctly written to the user config file when saving settings, and are properly reset to in memory values when reset. Has been broken since they got refactored.
CL#2284368
fixed crash on using blueprint-based EQS contexts in PIE
CL#2284405
HotSpots auto expire #UE4
Also, Fortnite-specific:
- made FortAIHotSpotManager the owner of hotspots spawning process
- added support for having multiple hotspots assigned to one BuildingSMActor, one per approach vector
CL#2285167
Fixed Fortnite client to match FriendsService API change for pending invites
CL#2285650
#UE4: Allow JsonObjectConverter to convert Strings to FDateTime fields using ISO-8601
CL#2286127
fixed pathfinding eqs test
CL#2286208
fixed EQS tests reverting to Score Only settings after reopening editor
ttp# 345719
CL#2286296
Game Invites work in Fortnite again
Fixed game to match a backend API change
CL#2286378
Removing TickAnim from InitAnim as that seems unnecessary and should avoid if we can.
CL#2286408
- TTP#345476 Slate: Fixed MenuPlacement_AboveAnchor not being respected.
CL#2286777
Fixed bug in GameplayDebuggingComponent which would cause debug display of EQS queries sharing the same name never to update after the initial query of a certain name is made. (In Fortnite, Goal Manager queries all have the same name, and the data would never update. In fact, even choosing a second actor would not clear out the data from the earlier actor, because they weren't updating data when the Timestamp updated.)
CL#2289211
Fix for TTP #345752 "CRASH: DEDICATED SERVER: ToggleAILogging with a gate active causes a server crash"
CL#2289279
LatentActionManager: value from iterator (over ObjectToActionListMap) was invalidated, when ObjectToActionListMap was changed.
Unique Ptr should be used instead of SharedPtr, but UniquePtr is currently not compatible with TMap.
CL#2289897
Fixes flying AIs (like the Taker) trying to move their feet to their destination, causing them to float higher than they should be.
CL#2290041
Fix a number of properties in the Action_Move hierarchy that aren't exposed and therefore aren't duplicated when we duplicate Pawn Actions.
CL#2290210
#UE4 Fix it so UEngine::ShutdownWorldNetDriver shuts down all net drivers associated with a world and not just a primary one. Fixes a crash when transferring maps with an active beacon net driver. Also fix issue where UEngine::ShutdownAllNetDrivers would miss some net drivers due to indexes being removed
- Duplicating actions occurs as part of adding a Pawn Action Sequence comprised of multiple Pawn Actions. The bug causes undesired behavior because the properties that were set on the initial Pawn Action are not carried over to the duplicate.
- We will continue to use the feet location as the origin of the Actor for determining requested velocity with walking AIs, but use the Actor's location as the origin for non-walking AIs
CL#2290255
#UE4 Fix to previous netdriver checkin, only kill world net drivers if the world is actively set, idle net drivers are fine and needed for beacons to work properly
CL#2290585
Fixed some PawnActions' bool properties not being marked as UPROPERTIES #UE4
It was resulting in copied actions loosing parts of its configuration.
Also:
- added a parameter to PawnAction_Move to controll "finish on overlap" path following behavior
CL#2290675
Extended GameplayDebugger view in Simulation. I added a way to switch debug views, to have all functionality from PIE. #ue4
CL#2290778
fixed invalid nav nodes in paths after offseting
CL#2290784
moved pathfollowing's reachability test out of FollowPathSegment function (it's supposed to handle only velocity calculations), agent will always use feet location for moving on path segment
CL#2292104
Fixes for GameplayDebugger, it mostly fixes activation in different configurations (PIE, standalone, client-server, etc.).
CL#2292198
Fixed issues related to NavMesh rendering and EQS query switching for GameplayDebugger. #ue4
CL#2292766
Fixed crash if touch event without valid MovieStreamer
CL#2292967
GameplayDebuggingComponent now tries to pick the correct nav-mesh for the selected actor, rather than always displaying the default nav-mesh.
NOTE: If you switch from one actor to another with nav-agent properties that are associated with different nav-meshes, it may continue to display the original nav-mesh for a while until it needs to update the position where the nav-mesh should display.
CL#2293116
#UE4 #HTTP: Make LibCurl reuse connections by default on windows/android to mirror the change in CL# 2025870. Also added [Networking]UseLibCurl as an option to have LibCurl get used in addition to command line.
CL#2293217
Added suffix override to allow StagingInfo instances without platform in the staging path
This is to handle where platform is already in each build product instead of as a root dir, eg. \\WindowsClient instead of \\Windows\\WindowsClient
CL#2293263
#UE4: Make JsonObjectConverter skip null values in arrays and structs (this is consistent with skipping missing keys)
CL#2293534
fixed parent node usage in navigation octree (navmesh stays unchanged after deleting an actor)
CL#2293536
fixed updating parent chain in navoctree after removing last attached node
CL#2293543
changed navigation octree parent map to use weak object pointers (merged from main)
CL#2293952
Changes/improvements to curl http module:
- Properly get bUseCurl from a configuration file.
- Do less work when creating requests (checking commandline settings moved to CurlHttpManager).
- Do not init/shutdown unless actually used.
CL#2294062
Added virtual function OnCharacterStuckInGeometry for Characters that get stuck in geometry to CharacterMovementComponent
- Allows subclasses to define behavior when this occurs
- Comment states that this only will be called when the character is walking
[CL 2305577 by Bob Tellez in Main branch]
2014-09-22 10:33:39 -04:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void UGameplayDebuggingComponent::ServerCollectNavmeshData_Implementation(FVector_NetQuantize10 TargetLocation)
|
|
|
|
|
{
|
|
|
|
|
#if WITH_RECAST
|
|
|
|
|
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
|
Merging Dev->Main CL#2294650 using UE4-Fortnite-To-UE4
CL#2272587
Added "BlueprintReadWrite" to bNoneIsAllowedValue in FBlackboardKeySelector to avoid breaking any usage of it in blueprints through Break node which people were already using. That matches the usage for AllowedTypes, which is conceptually a related idea and was already set to BlueprintReadWrite.
CL#2272599
Fixed crash when AI were killed in the same frame they were spawning into the world.
CL#2274068
behavior tree search can be reverted, task will be aborted AFTER finding a valid replacement
fix for move action crashing on pawn's death
CL#2274177
fixed behavior tree's search range when there are mutliple restart requests in the same frame
CL#2274359
Fixes RotateToFaceBBEntry not working correctly when focusing on an actor
- the GetFocalPoint call to AIController had different behavior if you called it with a priority vs. without
- with a priority we would just look at the Priorities and return the position, but that position was never being updated for Actors
- without a priority we would go through all the priorities, check for an Actor, and if it existed we would return its location
- while I could have just modified the RotateToFaceBBEntry call to just call GetFocusActor for the appropriate focus priority, this seems like the better fix)
- solution was to make the GetFocalPoint with a focus priority work exactly like the one without the focus priority. while I would have liked to reduce the copy/paste code between the functions it didn't seem like a good idea.
Also fixed Precision not considering vectors that were in the same direction (>= vs just > with the angle threshold value)
CL#2274719
Fix crash related to AnimCameraActor.
TTP #344968 CRASH: TAKER: If the world owner leaves the game in the middle of a Taker Soul sucking another player, the Client will crash.
CL#2274988
#UE4 Proper handling of saving level assets that were created without a valid non-read only path. TTP#344899
CL#2275045
#UE4: Include "IHttpBase.h" in IHttpResponse.h since it's using a base class from there (they're truly dependent). Would be nice if this file just had the enum though.
CL#2275152
TTP# 336668
Moved the input check for VOIP from the child widgets into the base SFortHUDLayer to capture that event on different screens. Removed code duplication.
CL#2275528
Fixed StaticMeshComponent destruction blocking on the rendering thread instead of using the UObject async destruction interface
CL#2275960
fixed behavior tree search being discarded after merge with non discardable request
decorator observers will be added even after failed search
CL#2276294
Added support to EQS "Dot" test for 2D dot-product AND taking absolute value of dot-product (for biasing for lateral over forward/back).
They are separate options which can be used together or separately.
CL#2277344
fixed BT decorator indices for abort range preview in editor
CL#2277473
NavCollision settings of static mesh will persist through reimport
ttp# 344853
CL#2277509
fixed multiple nodes connected to special pins in behavior tree editor
CL#2278042
Fixes EQS not returning the best item when the last EQS test is a filter.
- To do this, on the last test if we know it's just a filter and eventually we will use the first item that passes the test, then we sort prior to filtering.
Made the filter and score test types display "Filter Only" & "Score Only"
CL#2278111
Improved EQS Dot test "Description Title" to display "Absolute" and " 2D" as appropriate.
CL#2278115
Added "Random" EQS test, which can be used for adding a random value to items.
Potentially needed for hunting EQS query Phil is working on, and should be useful for other cases as well.
CL#2278286
Fixes crash when trying to use the VisLog due to a spelling correction made in CL 2276628.
CL#2281762
Moved VLOG in Vlog Redirect function to avoid ensure
- Ensure was caused because we were trying to log to a redirect when the redirect hadn't be set yet
CL#2282248
Fixed EQS "Random" test to work with ANY query item type, not just VectorBase item types.
CL#2282639
Enhanced debug information data for single item in EQS Debugger (GameplayDebugger feature) #ue4
- Fixed few compilation issues with disabled USE_EQS_DEBUGGER flag
- Fixed crash in EQSRenderingComponent
- Fixed EQS debug data for sorted EQS itesm (it's slower way to sort items but only with active USE_EQS_DEBUGGER flag)
CL#2282678
fixed crash on reimporting static mesh without NavCollision data
ttp# 345454
CL#2282919
Renamed BTTask_MoveDirectlyToward.bForceMoveToLocation to more clear bDisablePathUpdateOnGoalLocationChange #UE4
- also fixed a bug in FortBTTask_GameMoveDirectlyToward that was misusing that variable. This addressed TTP#343489
CL#2282927
Fixed paths rendering while using GameplayDebugger (client/server too) #Fortnite
CL#2283374
Fixes crowd following AIs (ie. regular husks) trying to rotate in the direction of their CrowdAgentMoveDirection while falling or not moving
(Fixes ttp 344776)
CL#2283475
Comment/code refactor that occurred but wasn't saved prior to check in of CL 2283374
CL#2283644
#UE4 Fix various issues seen when changing graphics settings with r.detailmode causes all components to reregister
Fix it so particle system components track if they were active when unregistering, reactivate on next register if true
Fix it so character movement components don't throw away timestamp data on unregister, this broke networking entirely
Fix it so single anim skeletal meshes restore state accross reinitializations
CL#2283688
Make bPendingKillPending no longer a UProperty so it won't be serialized.
Fixes TTPs 342221, 342634
CL#2283879
#UE4 Fix it so the scalability settings are correctly written to the user config file when saving settings, and are properly reset to in memory values when reset. Has been broken since they got refactored.
CL#2284368
fixed crash on using blueprint-based EQS contexts in PIE
CL#2284405
HotSpots auto expire #UE4
Also, Fortnite-specific:
- made FortAIHotSpotManager the owner of hotspots spawning process
- added support for having multiple hotspots assigned to one BuildingSMActor, one per approach vector
CL#2285167
Fixed Fortnite client to match FriendsService API change for pending invites
CL#2285650
#UE4: Allow JsonObjectConverter to convert Strings to FDateTime fields using ISO-8601
CL#2286127
fixed pathfinding eqs test
CL#2286208
fixed EQS tests reverting to Score Only settings after reopening editor
ttp# 345719
CL#2286296
Game Invites work in Fortnite again
Fixed game to match a backend API change
CL#2286378
Removing TickAnim from InitAnim as that seems unnecessary and should avoid if we can.
CL#2286408
- TTP#345476 Slate: Fixed MenuPlacement_AboveAnchor not being respected.
CL#2286777
Fixed bug in GameplayDebuggingComponent which would cause debug display of EQS queries sharing the same name never to update after the initial query of a certain name is made. (In Fortnite, Goal Manager queries all have the same name, and the data would never update. In fact, even choosing a second actor would not clear out the data from the earlier actor, because they weren't updating data when the Timestamp updated.)
CL#2289211
Fix for TTP #345752 "CRASH: DEDICATED SERVER: ToggleAILogging with a gate active causes a server crash"
CL#2289279
LatentActionManager: value from iterator (over ObjectToActionListMap) was invalidated, when ObjectToActionListMap was changed.
Unique Ptr should be used instead of SharedPtr, but UniquePtr is currently not compatible with TMap.
CL#2289897
Fixes flying AIs (like the Taker) trying to move their feet to their destination, causing them to float higher than they should be.
CL#2290041
Fix a number of properties in the Action_Move hierarchy that aren't exposed and therefore aren't duplicated when we duplicate Pawn Actions.
CL#2290210
#UE4 Fix it so UEngine::ShutdownWorldNetDriver shuts down all net drivers associated with a world and not just a primary one. Fixes a crash when transferring maps with an active beacon net driver. Also fix issue where UEngine::ShutdownAllNetDrivers would miss some net drivers due to indexes being removed
- Duplicating actions occurs as part of adding a Pawn Action Sequence comprised of multiple Pawn Actions. The bug causes undesired behavior because the properties that were set on the initial Pawn Action are not carried over to the duplicate.
- We will continue to use the feet location as the origin of the Actor for determining requested velocity with walking AIs, but use the Actor's location as the origin for non-walking AIs
CL#2290255
#UE4 Fix to previous netdriver checkin, only kill world net drivers if the world is actively set, idle net drivers are fine and needed for beacons to work properly
CL#2290585
Fixed some PawnActions' bool properties not being marked as UPROPERTIES #UE4
It was resulting in copied actions loosing parts of its configuration.
Also:
- added a parameter to PawnAction_Move to controll "finish on overlap" path following behavior
CL#2290675
Extended GameplayDebugger view in Simulation. I added a way to switch debug views, to have all functionality from PIE. #ue4
CL#2290778
fixed invalid nav nodes in paths after offseting
CL#2290784
moved pathfollowing's reachability test out of FollowPathSegment function (it's supposed to handle only velocity calculations), agent will always use feet location for moving on path segment
CL#2292104
Fixes for GameplayDebugger, it mostly fixes activation in different configurations (PIE, standalone, client-server, etc.).
CL#2292198
Fixed issues related to NavMesh rendering and EQS query switching for GameplayDebugger. #ue4
CL#2292766
Fixed crash if touch event without valid MovieStreamer
CL#2292967
GameplayDebuggingComponent now tries to pick the correct nav-mesh for the selected actor, rather than always displaying the default nav-mesh.
NOTE: If you switch from one actor to another with nav-agent properties that are associated with different nav-meshes, it may continue to display the original nav-mesh for a while until it needs to update the position where the nav-mesh should display.
CL#2293116
#UE4 #HTTP: Make LibCurl reuse connections by default on windows/android to mirror the change in CL# 2025870. Also added [Networking]UseLibCurl as an option to have LibCurl get used in addition to command line.
CL#2293217
Added suffix override to allow StagingInfo instances without platform in the staging path
This is to handle where platform is already in each build product instead of as a root dir, eg. \\WindowsClient instead of \\Windows\\WindowsClient
CL#2293263
#UE4: Make JsonObjectConverter skip null values in arrays and structs (this is consistent with skipping missing keys)
CL#2293534
fixed parent node usage in navigation octree (navmesh stays unchanged after deleting an actor)
CL#2293536
fixed updating parent chain in navoctree after removing last attached node
CL#2293543
changed navigation octree parent map to use weak object pointers (merged from main)
CL#2293952
Changes/improvements to curl http module:
- Properly get bUseCurl from a configuration file.
- Do less work when creating requests (checking commandline settings moved to CurlHttpManager).
- Do not init/shutdown unless actually used.
CL#2294062
Added virtual function OnCharacterStuckInGeometry for Characters that get stuck in geometry to CharacterMovementComponent
- Allows subclasses to define behavior when this occurs
- Comment states that this only will be called when the character is walking
[CL 2305577 by Bob Tellez in Main branch]
2014-09-22 10:33:39 -04:00
|
|
|
ARecastNavMesh* NavData = GetNavData();
|
2014-06-10 13:56:35 -04:00
|
|
|
if (NavData == NULL)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
NavmeshRepData.Empty();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const double Timer1 = FPlatformTime::Seconds();
|
|
|
|
|
|
|
|
|
|
TArray<int32> Indices;
|
|
|
|
|
int32 TileX = 0;
|
|
|
|
|
int32 TileY = 0;
|
|
|
|
|
const int32 DeltaX[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
|
|
|
|
|
const int32 DeltaY[] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
|
|
|
|
|
|
|
|
|
|
NavData->BeginBatchQuery();
|
|
|
|
|
|
|
|
|
|
// add 3x3 neighborhood of target
|
2014-04-30 17:34:38 -04:00
|
|
|
int32 TargetTileX = 0;
|
|
|
|
|
int32 TargetTileY = 0;
|
|
|
|
|
NavData->GetNavMeshTileXY(TargetLocation, TargetTileX, TargetTileY);
|
|
|
|
|
for (int32 i = 0; i < ARRAY_COUNT(DeltaX); i++)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-30 17:34:38 -04:00
|
|
|
const int32 NeiX = TargetTileX + DeltaX[i];
|
|
|
|
|
const int32 NeiY = TargetTileY + DeltaY[i];
|
|
|
|
|
if (FMath::Abs(NeiX - TileX) > 1 || FMath::Abs(NeiY - TileY) > 1)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-30 17:34:38 -04:00
|
|
|
NavData->GetNavMeshTilesAt(NeiX, NeiY, Indices);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FNavDataConfig& NavConfig = NavData->GetConfig();
|
|
|
|
|
FColor NavMeshColors[RECAST_MAX_AREAS];
|
|
|
|
|
NavMeshColors[RECAST_DEFAULT_AREA] = NavConfig.Color.DWColor() > 0 ? NavConfig.Color : NavMeshRenderColor_RecastMesh;
|
|
|
|
|
for (uint8 i = 0; i < RECAST_DEFAULT_AREA; ++i)
|
|
|
|
|
{
|
|
|
|
|
NavMeshColors[i] = NavData->GetAreaIDColor(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArray<uint8> UncompressedBuffer;
|
|
|
|
|
FMemoryWriter ArWriter(UncompressedBuffer);
|
|
|
|
|
|
|
|
|
|
int32 NumIndices = Indices.Num();
|
|
|
|
|
ArWriter << NumIndices;
|
|
|
|
|
|
|
|
|
|
for (int32 i = 0; i < NumIndices; i++)
|
|
|
|
|
{
|
|
|
|
|
FRecastDebugGeometry NavMeshGeometry;
|
2014-04-24 15:04:22 -04:00
|
|
|
NavMeshGeometry.bGatherPolyEdges = false;
|
|
|
|
|
NavMeshGeometry.bGatherNavMeshEdges = false;
|
2014-03-14 14:13:41 -04:00
|
|
|
NavData->GetDebugGeometry(NavMeshGeometry, Indices[i]);
|
|
|
|
|
|
|
|
|
|
NavMeshDebug::FTileData TileData;
|
2014-04-24 15:04:22 -04:00
|
|
|
const FBox TileBoundingBox = NavData->GetNavMeshTileBounds(Indices[i]);
|
|
|
|
|
TileData.Location = TileBoundingBox.GetCenter();
|
|
|
|
|
for (int32 VertIndex = 0; VertIndex < NavMeshGeometry.MeshVerts.Num(); ++VertIndex)
|
|
|
|
|
{
|
|
|
|
|
const NavMeshDebug::FShortVector SV = NavMeshGeometry.MeshVerts[VertIndex] - TileData.Location;
|
|
|
|
|
TileData.Verts.Add(SV);
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
for (int32 iArea = 0; iArea < RECAST_MAX_AREAS; iArea++)
|
|
|
|
|
{
|
|
|
|
|
const int32 NumTris = NavMeshGeometry.AreaIndices[iArea].Num();
|
|
|
|
|
if (NumTris)
|
|
|
|
|
{
|
|
|
|
|
NavMeshDebug::FAreaPolys AreaPolys;
|
2014-04-24 15:04:22 -04:00
|
|
|
for (int32 AreaIndicesIndex = 0; AreaIndicesIndex < NavMeshGeometry.AreaIndices[iArea].Num(); ++AreaIndicesIndex)
|
|
|
|
|
{
|
|
|
|
|
AreaPolys.Indices.Add(NavMeshGeometry.AreaIndices[iArea][AreaIndicesIndex]);
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
AreaPolys.Color = NavMeshColors[iArea];
|
|
|
|
|
TileData.Areas.Add(AreaPolys);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TileData.Links.Reserve(NavMeshGeometry.OffMeshLinks.Num());
|
|
|
|
|
for (int32 iLink = 0; iLink < NavMeshGeometry.OffMeshLinks.Num(); iLink++)
|
|
|
|
|
{
|
|
|
|
|
const FRecastDebugGeometry::FOffMeshLink& SrcLink = NavMeshGeometry.OffMeshLinks[iLink];
|
|
|
|
|
NavMeshDebug::FOffMeshLink Link;
|
2014-04-24 15:04:22 -04:00
|
|
|
Link.Left = SrcLink.Left - TileData.Location;
|
|
|
|
|
Link.Right = SrcLink.Right - TileData.Location;
|
2014-09-29 21:43:13 -04:00
|
|
|
Link.Color = ((SrcLink.Direction && SrcLink.ValidEnds) || (SrcLink.ValidEnds & FRecastDebugGeometry::OMLE_Left)) ? DarkenColor(NavMeshColors[SrcLink.AreaID]) : NavMeshRenderColor_OffMeshConnectionInvalid;
|
2014-04-24 15:04:22 -04:00
|
|
|
Link.PackedFlags.Radius = (int8)SrcLink.Radius;
|
|
|
|
|
Link.PackedFlags.Direction = SrcLink.Direction;
|
|
|
|
|
Link.PackedFlags.ValidEnds = SrcLink.ValidEnds;
|
2014-03-14 14:13:41 -04:00
|
|
|
TileData.Links.Add(Link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArWriter << TileData;
|
|
|
|
|
}
|
|
|
|
|
NavData->FinishBatchQuery();
|
|
|
|
|
|
|
|
|
|
const double Timer2 = FPlatformTime::Seconds();
|
|
|
|
|
|
|
|
|
|
const int32 HeaderSize = sizeof(int32);
|
2014-05-06 06:26:25 -04:00
|
|
|
NavmeshRepData.Init(0, HeaderSize + FMath::TruncToInt(1.1f * UncompressedBuffer.Num()));
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
const int32 UncompressedSize = UncompressedBuffer.Num();
|
|
|
|
|
int32 CompressedSize = NavmeshRepData.Num() - HeaderSize;
|
2014-09-29 04:23:44 -04:00
|
|
|
uint8* DestBuffer = NavmeshRepData.GetData();
|
2014-03-14 14:13:41 -04:00
|
|
|
FMemory::Memcpy(DestBuffer, &UncompressedSize, HeaderSize);
|
|
|
|
|
DestBuffer += HeaderSize;
|
|
|
|
|
|
|
|
|
|
FCompression::CompressMemory((ECompressionFlags)(COMPRESS_ZLIB | COMPRESS_BiasMemory),
|
|
|
|
|
(void*)DestBuffer, CompressedSize, (void*)UncompressedBuffer.GetData(), UncompressedSize);
|
|
|
|
|
|
|
|
|
|
NavmeshRepData.SetNum(CompressedSize + HeaderSize, false);
|
|
|
|
|
|
|
|
|
|
const double Timer3 = FPlatformTime::Seconds();
|
2014-06-10 13:56:35 -04:00
|
|
|
UE_LOG(LogGDT, Log, TEXT("Preparing navmesh data: %.1fkB took %.3fms (collect: %.3fms + compress %d%%: %.3fms)"),
|
2014-03-14 14:13:41 -04:00
|
|
|
NavmeshRepData.Num() / 1024.0f, 1000.0f * (Timer3 - Timer1),
|
|
|
|
|
1000.0f * (Timer2 - Timer1),
|
2014-05-06 06:26:25 -04:00
|
|
|
FMath::TruncToInt(100.0f * NavmeshRepData.Num() / UncompressedBuffer.Num()), 1000.0f * (Timer3 - Timer2));
|
2014-03-14 14:13:41 -04:00
|
|
|
#endif
|
|
|
|
|
|
2014-05-08 08:55:44 -04:00
|
|
|
if (World && World->GetNetMode() != NM_DedicatedServer)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
OnRep_UpdateNavmesh();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::PrepareNavMeshData(struct FNavMeshSceneProxyData* CurrentData) const
|
|
|
|
|
{
|
|
|
|
|
#if WITH_RECAST
|
|
|
|
|
if (CurrentData)
|
|
|
|
|
{
|
|
|
|
|
CurrentData->Reset();
|
|
|
|
|
CurrentData->bNeedsNewData = false;
|
|
|
|
|
|
|
|
|
|
// uncompress data
|
|
|
|
|
TArray<uint8> UncompressedBuffer;
|
|
|
|
|
const int32 HeaderSize = sizeof(int32);
|
|
|
|
|
if (NavmeshRepData.Num() > HeaderSize)
|
|
|
|
|
{
|
|
|
|
|
int32 UncompressedSize = 0;
|
2014-09-29 04:23:44 -04:00
|
|
|
uint8* SrcBuffer = (uint8*)NavmeshRepData.GetData();
|
2014-03-14 14:13:41 -04:00
|
|
|
FMemory::Memcpy(&UncompressedSize, SrcBuffer, HeaderSize);
|
|
|
|
|
SrcBuffer += HeaderSize;
|
|
|
|
|
const int32 CompressedSize = NavmeshRepData.Num() - HeaderSize;
|
|
|
|
|
|
|
|
|
|
UncompressedBuffer.AddZeroed(UncompressedSize);
|
|
|
|
|
|
|
|
|
|
FCompression::UncompressMemory((ECompressionFlags)(COMPRESS_ZLIB),
|
2014-09-29 04:23:44 -04:00
|
|
|
(void*)UncompressedBuffer.GetData(), UncompressedSize, SrcBuffer, CompressedSize);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// read serialized values
|
|
|
|
|
CurrentData->bEnableDrawing = (UncompressedBuffer.Num() > 0);
|
|
|
|
|
if (!CurrentData->bEnableDrawing)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FMemoryReader ArReader(UncompressedBuffer);
|
|
|
|
|
int32 NumTiles = 0;
|
|
|
|
|
ArReader << NumTiles;
|
|
|
|
|
|
2015-02-16 04:04:00 -05:00
|
|
|
int32 IndexesOffset = 0;
|
2014-03-14 14:13:41 -04:00
|
|
|
for (int32 iTile = 0; iTile < NumTiles; iTile++)
|
|
|
|
|
{
|
|
|
|
|
NavMeshDebug::FTileData TileData;
|
|
|
|
|
ArReader << TileData;
|
|
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
FVector OffsetLocation = TileData.Location;
|
|
|
|
|
TArray<FVector> Verts;
|
|
|
|
|
Verts.Reserve(TileData.Verts.Num());
|
|
|
|
|
for (int32 VertIndex = 0; VertIndex < TileData.Verts.Num(); ++VertIndex)
|
|
|
|
|
{
|
|
|
|
|
const FVector Loc = TileData.Verts[VertIndex].ToVector() + OffsetLocation;
|
|
|
|
|
Verts.Add(Loc);
|
|
|
|
|
}
|
|
|
|
|
CurrentData->Bounds += FBox(Verts);
|
2015-02-16 04:04:00 -05:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
for (int32 iArea = 0; iArea < TileData.Areas.Num(); iArea++)
|
|
|
|
|
{
|
|
|
|
|
const NavMeshDebug::FAreaPolys& SrcArea = TileData.Areas[iArea];
|
|
|
|
|
FNavMeshSceneProxyData::FDebugMeshData DebugMeshData;
|
|
|
|
|
DebugMeshData.ClusterColor = SrcArea.Color;
|
2015-02-16 04:04:00 -05:00
|
|
|
DebugMeshData.ClusterColor.A = 128;
|
|
|
|
|
|
|
|
|
|
for (int32 iTri = 0; iTri < SrcArea.Indices.Num(); iTri += 3)
|
|
|
|
|
{
|
|
|
|
|
const int32 Index0 = SrcArea.Indices[iTri + 0];
|
|
|
|
|
const int32 Index1 = SrcArea.Indices[iTri + 1];
|
|
|
|
|
const int32 Index2 = SrcArea.Indices[iTri + 2];
|
|
|
|
|
|
|
|
|
|
FVector V0 = Verts[Index0];
|
|
|
|
|
FVector V1 = Verts[Index1];
|
|
|
|
|
FVector V2 = Verts[Index2];
|
|
|
|
|
CurrentData->TileEdgeLines.Add(FDebugRenderSceneProxy::FDebugLine(V0 + CurrentData->NavMeshDrawOffset, V1 + CurrentData->NavMeshDrawOffset, NavMeshRenderColor_Recast_TileEdges));
|
|
|
|
|
CurrentData->TileEdgeLines.Add(FDebugRenderSceneProxy::FDebugLine(V1 + CurrentData->NavMeshDrawOffset, V2 + CurrentData->NavMeshDrawOffset, NavMeshRenderColor_Recast_TileEdges));
|
|
|
|
|
CurrentData->TileEdgeLines.Add(FDebugRenderSceneProxy::FDebugLine(V2 + CurrentData->NavMeshDrawOffset, V0 + CurrentData->NavMeshDrawOffset, NavMeshRenderColor_Recast_TileEdges));
|
|
|
|
|
|
|
|
|
|
AddTriangleHelper(DebugMeshData, Index0 + IndexesOffset, Index1 + IndexesOffset, Index2 + IndexesOffset);
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
for (int32 iVert = 0; iVert < Verts.Num(); iVert++)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
AddVertexHelper(DebugMeshData, Verts[iVert] + CurrentData->NavMeshDrawOffset);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
CurrentData->MeshBuilders.Add(DebugMeshData);
|
2015-02-16 04:04:00 -05:00
|
|
|
IndexesOffset += Verts.Num();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int32 i = 0; i < TileData.Links.Num(); i++)
|
|
|
|
|
{
|
|
|
|
|
const NavMeshDebug::FOffMeshLink& SrcLink = TileData.Links[i];
|
|
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
const FVector V0 = SrcLink.Left.ToVector() + OffsetLocation + CurrentData->NavMeshDrawOffset;
|
|
|
|
|
const FVector V1 = SrcLink.Right.ToVector() + OffsetLocation + CurrentData->NavMeshDrawOffset;
|
2014-03-14 14:13:41 -04:00
|
|
|
const FColor LinkColor = SrcLink.Color;
|
|
|
|
|
|
|
|
|
|
CacheArc(CurrentData->NavLinkLines, V0, V1, 0.4f, 4, LinkColor, LinkLines_LineThickness);
|
|
|
|
|
|
|
|
|
|
const FVector VOffset(0, 0, FVector::Dist(V0, V1) * 1.333f);
|
|
|
|
|
CacheArrowHead(CurrentData->NavLinkLines, V1, V0+VOffset, 30.f, LinkColor, LinkLines_LineThickness);
|
2014-04-24 15:04:22 -04:00
|
|
|
if (SrcLink.PackedFlags.Direction)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
CacheArrowHead(CurrentData->NavLinkLines, V0, V1+VOffset, 30.f, LinkColor, LinkLines_LineThickness);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if the connection as a whole is valid check if there are any of ends is invalid
|
|
|
|
|
if (LinkColor != NavMeshRenderColor_OffMeshConnectionInvalid)
|
|
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
if (SrcLink.PackedFlags.Direction && (SrcLink.PackedFlags.ValidEnds & FRecastDebugGeometry::OMLE_Left) == 0)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// left end invalid - mark it
|
2014-04-24 15:04:22 -04:00
|
|
|
DrawWireCylinder(CurrentData->NavLinkLines, V0, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1), NavMeshRenderColor_OffMeshConnectionInvalid, SrcLink.PackedFlags.Radius, 30 /*NavMesh->AgentMaxStepHeight*/, 16, 0, DefaultEdges_LineThickness);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-04-24 15:04:22 -04:00
|
|
|
if ((SrcLink.PackedFlags.ValidEnds & FRecastDebugGeometry::OMLE_Right) == 0)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
DrawWireCylinder(CurrentData->NavLinkLines, V1, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1), NavMeshRenderColor_OffMeshConnectionInvalid, SrcLink.PackedFlags.Radius, 30 /*NavMesh->AgentMaxStepHeight*/, 16, 0, DefaultEdges_LineThickness);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// rendering
|
|
|
|
|
//----------------------------------------------------------------------//
|
2014-11-25 09:36:16 -05:00
|
|
|
class FPathDebugRenderSceneProxy : public FDebugRenderSceneProxy
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FPathDebugRenderSceneProxy(const UPrimitiveComponent* InComponent, const FString &InViewFlagName)
|
|
|
|
|
: FDebugRenderSceneProxy(InComponent)
|
|
|
|
|
{
|
|
|
|
|
DrawType = FDebugRenderSceneProxy::SolidAndWireMeshes;
|
2015-02-24 07:01:10 -05:00
|
|
|
DrawAlpha = 90;
|
2014-11-25 09:36:16 -05:00
|
|
|
ViewFlagName = InViewFlagName;
|
|
|
|
|
ViewFlagIndex = uint32(FEngineShowFlags::FindIndexByName(*ViewFlagName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FPrimitiveViewRelevance GetViewRelevance(const FSceneView* View) override
|
|
|
|
|
{
|
|
|
|
|
FPrimitiveViewRelevance Result;
|
|
|
|
|
Result.bDrawRelevance = View->Family->EngineShowFlags.GetSingleFlag(ViewFlagIndex);// IsShown(View);
|
|
|
|
|
Result.bDynamicRelevance = true;
|
2015-05-21 12:32:13 -04:00
|
|
|
// ideally the TranslucencyRelevance should be filled out by the material, here we do it conservative
|
|
|
|
|
Result.bSeparateTranslucencyRelevance = Result.bNormalTranslucencyRelevance = IsShown(View);
|
2014-11-25 09:36:16 -05:00
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
FPrimitiveSceneProxy* UGameplayDebuggingComponent::CreateSceneProxy()
|
|
|
|
|
{
|
2014-09-10 05:48:38 -04:00
|
|
|
FDebugRenderSceneCompositeProxy* CompositeProxy = NULL;
|
2015-02-27 09:26:32 -05:00
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-09-10 05:48:38 -04:00
|
|
|
AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner());
|
|
|
|
|
if (!World || World->GetNetMode() == NM_DedicatedServer)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-06 11:05:00 -04:00
|
|
|
if (!Replicator || !Replicator->IsDrawEnabled() || Replicator->IsPendingKill() || IsPendingKill() || GetSelectedActor() == NULL || GetSelectedActor()->IsPendingKill())
|
2014-08-25 11:07:28 -04:00
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2014-04-23 19:29:53 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
#if WITH_RECAST
|
2014-09-10 05:48:38 -04:00
|
|
|
if (ShouldReplicateData(EAIDebugDrawDataView::NavMesh))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-08-04 08:10:19 -04:00
|
|
|
FNavMeshSceneProxyData NewNavmeshRenderData;
|
|
|
|
|
NewNavmeshRenderData.Reset();
|
|
|
|
|
NewNavmeshRenderData.bNeedsNewData = false;
|
|
|
|
|
NewNavmeshRenderData.bEnableDrawing = false;
|
|
|
|
|
PrepareNavMeshData(&NewNavmeshRenderData);
|
|
|
|
|
|
2015-05-06 11:05:00 -04:00
|
|
|
NavMeshBounds = NewNavmeshRenderData.Bounds.GetCenter().ContainsNaN() || NewNavmeshRenderData.Bounds.GetExtent().ContainsNaN() ? FBox(FVector(-HALF_WORLD_MAX1, -HALF_WORLD_MAX1, -HALF_WORLD_MAX1), FVector(HALF_WORLD_MAX1, HALF_WORLD_MAX1, HALF_WORLD_MAX1)) : NewNavmeshRenderData.Bounds;
|
2014-08-04 08:10:19 -04:00
|
|
|
CompositeProxy = CompositeProxy ? CompositeProxy : (new FDebugRenderSceneCompositeProxy(this));
|
|
|
|
|
CompositeProxy->AddChild(new FRecastRenderingSceneProxy(this, &NewNavmeshRenderData, true));
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
#endif
|
2014-04-23 19:29:53 -04:00
|
|
|
|
2014-08-14 09:13:50 -04:00
|
|
|
#if USE_EQS_DEBUGGER
|
2014-09-09 12:17:30 -04:00
|
|
|
if (ShouldReplicateData(EAIDebugDrawDataView::EQS) && IsClientEQSSceneProxyEnabled())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-09-22 15:19:39 -04:00
|
|
|
const int32 EQSIndex = EQSLocalData.Num() > 0 ? FMath::Clamp(CurrentEQSIndex, 0, EQSLocalData.Num() - 1) : INDEX_NONE;
|
2014-09-10 05:48:38 -04:00
|
|
|
if (EQSLocalData.IsValidIndex(EQSIndex))
|
2014-08-21 20:30:51 -04:00
|
|
|
{
|
|
|
|
|
CompositeProxy = CompositeProxy ? CompositeProxy : (new FDebugRenderSceneCompositeProxy(this));
|
2014-09-10 05:48:38 -04:00
|
|
|
auto& CurrentLocalData = EQSLocalData[EQSIndex];
|
2014-10-01 08:53:33 -04:00
|
|
|
|
|
|
|
|
FString ViewFlagName = TEXT("Game");
|
2014-10-01 12:09:13 -04:00
|
|
|
#if WITH_EDITOR
|
2014-10-01 08:53:33 -04:00
|
|
|
UEditorEngine* EEngine = Cast<UEditorEngine>(GEngine);
|
|
|
|
|
if (EEngine && EEngine->bIsSimulatingInEditor)
|
|
|
|
|
{
|
|
|
|
|
ViewFlagName = TEXT("DebugAI");
|
|
|
|
|
}
|
2014-10-01 12:09:13 -04:00
|
|
|
#endif
|
2015-03-11 11:39:27 -04:00
|
|
|
CompositeProxy->AddChild(new FEQSSceneProxy(this, ViewFlagName, CurrentLocalData.SolidSpheres, CurrentLocalData.Texts));
|
2014-08-21 20:30:51 -04:00
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-08-14 09:13:50 -04:00
|
|
|
#endif // USE_EQS_DEBUGGER
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-11-25 09:36:16 -05:00
|
|
|
const bool bDrawFullData = Replicator->GetSelectedActorToDebug() == GetSelectedActor();
|
|
|
|
|
if (bDrawFullData && ShouldReplicateData(EAIDebugDrawDataView::Basic))
|
|
|
|
|
{
|
|
|
|
|
CompositeProxy = CompositeProxy ? CompositeProxy : (new FDebugRenderSceneCompositeProxy(this));
|
|
|
|
|
|
|
|
|
|
TArray<FDebugRenderSceneProxy::FMesh> Meshes;
|
|
|
|
|
TArray<FDebugRenderSceneProxy::FDebugLine> Lines;
|
2015-02-24 07:01:10 -05:00
|
|
|
for (FPathCorridorPolygons& CurrentPoly : PathCorridorPolygons)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
|
|
|
|
|
2015-02-24 07:01:10 -05:00
|
|
|
if (CurrentPoly.Points.Num() > 2)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
|
|
|
|
int32 LastIndex = 0;
|
2015-02-24 07:01:10 -05:00
|
|
|
FVector FirstVertex = CurrentPoly.Points[0];
|
2014-11-25 09:36:16 -05:00
|
|
|
FDebugRenderSceneProxy::FMesh TestMesh;
|
2015-02-24 07:01:10 -05:00
|
|
|
TestMesh.Color = CurrentPoly.Color;// FColor::Green;
|
|
|
|
|
for (int32 Index = 1; Index < CurrentPoly.Points.Num()-1; Index += 1)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
2015-02-24 07:01:10 -05:00
|
|
|
TestMesh.Vertices.Add(FDynamicMeshVertex(FirstVertex));
|
|
|
|
|
TestMesh.Vertices.Add(FDynamicMeshVertex(CurrentPoly.Points[Index + 0]));
|
|
|
|
|
TestMesh.Vertices.Add(FDynamicMeshVertex(CurrentPoly.Points[Index + 1]));
|
2014-11-25 09:36:16 -05:00
|
|
|
TestMesh.Indices.Add(LastIndex++);
|
|
|
|
|
TestMesh.Indices.Add(LastIndex++);
|
|
|
|
|
TestMesh.Indices.Add(LastIndex++);
|
|
|
|
|
}
|
|
|
|
|
Meshes.Add(TestMesh);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-24 07:01:10 -05:00
|
|
|
for (int32 VIdx = 0; VIdx < CurrentPoly.Points.Num(); VIdx++)
|
2014-11-25 09:36:16 -05:00
|
|
|
{
|
|
|
|
|
Lines.Add(FDebugRenderSceneProxy::FDebugLine(
|
2015-02-24 07:01:10 -05:00
|
|
|
CurrentPoly.Points[VIdx],
|
|
|
|
|
CurrentPoly.Points[(VIdx + 1) % CurrentPoly.Points.Num()],
|
|
|
|
|
CurrentPoly.Color,
|
2014-11-25 09:36:16 -05:00
|
|
|
2)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString ViewFlagName = TEXT("Game");
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
UEditorEngine* EEngine = Cast<UEditorEngine>(GEngine);
|
|
|
|
|
if (EEngine && EEngine->bIsSimulatingInEditor)
|
|
|
|
|
{
|
|
|
|
|
ViewFlagName = TEXT("DebugAI");
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
FPathDebugRenderSceneProxy *DebugSceneProxy = new FPathDebugRenderSceneProxy(this, ViewFlagName);
|
|
|
|
|
DebugSceneProxy->Lines = Lines;
|
|
|
|
|
DebugSceneProxy->Meshes = Meshes;
|
|
|
|
|
CompositeProxy->AddChild(DebugSceneProxy);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-27 09:26:32 -05:00
|
|
|
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
2014-03-14 14:13:41 -04:00
|
|
|
return CompositeProxy;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-01 14:45:23 -04:00
|
|
|
FBoxSphereBounds UGameplayDebuggingComponent::CalcBounds(const FTransform& LocalToWorld) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FBox MyBounds;
|
|
|
|
|
MyBounds.Init();
|
|
|
|
|
|
|
|
|
|
#if WITH_RECAST
|
2014-04-24 15:04:22 -04:00
|
|
|
if (ShouldReplicateData(EAIDebugDrawDataView::NavMesh))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-24 15:04:22 -04:00
|
|
|
MyBounds = NavMeshBounds;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-08-14 09:13:50 -04:00
|
|
|
#if USE_EQS_DEBUGGER
|
2014-11-25 09:36:16 -05:00
|
|
|
if ((EQSRepData.Num() && ShouldReplicateData(EAIDebugDrawDataView::EQS)) || PathCorridorPolygons.Num())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-05-06 11:05:00 -04:00
|
|
|
MyBounds = FBox(FVector(-HALF_WORLD_MAX1, -HALF_WORLD_MAX1, -HALF_WORLD_MAX1), FVector(HALF_WORLD_MAX1, HALF_WORLD_MAX1, HALF_WORLD_MAX1));
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-08-14 09:13:50 -04:00
|
|
|
#endif // USE_EQS_DEBUGGER
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
return MyBounds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::CreateRenderState_Concurrent()
|
|
|
|
|
{
|
|
|
|
|
Super::CreateRenderState_Concurrent();
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
if (SceneProxy)
|
|
|
|
|
{
|
|
|
|
|
static_cast<FDebugRenderSceneCompositeProxy*>(SceneProxy)->RegisterDebugDrawDelgate();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UGameplayDebuggingComponent::DestroyRenderState_Concurrent()
|
|
|
|
|
{
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
if (SceneProxy)
|
|
|
|
|
{
|
|
|
|
|
static_cast<FDebugRenderSceneCompositeProxy*>(SceneProxy)->UnregisterDebugDrawDelgate();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Super::DestroyRenderState_Concurrent();
|
|
|
|
|
}
|