Files
UnrealEngineUWP/Engine/Source/Developer/GameplayDebugger/Classes/GameplayDebuggingComponent.h
Marc Audy 67e3197eff Copying //UE4/Dev-Framework to //UE4/Dev-Main (Source: //UE4/Dev-Framework @ 2964666)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 2945310 on 2016/04/15 by Jon.Nabozny

	Fix UI locking Angular Rotation Offset for PhysicsConstraintComponents when the motion is for axes is Free or Locked.
	#JIRA UE-29368

Change 2945490 on 2016/04/15 by Jon.Nabozny

	Remove extraneous changes introduced in CL-2945310.

Change 2946706 on 2016/04/18 by James.Golding

	Checkin of slice test assets

Change 2947895 on 2016/04/19 by Benn.Gallagher

	PR #2292: Use ref instead of copy in FAnimNode_ModifyBone::EvaluateBoneTransforms (Contributed by MiKom)
	#jira UE-29567

Change 2947944 on 2016/04/19 by Benn.Gallagher

	Fixed a few extra needless bone container copies

Change 2948279 on 2016/04/19 by Marc.Audy

	Add well defined Map and Set Property names

Change 2948280 on 2016/04/19 by Marc.Audy

	Properly name parameters

Change 2948792 on 2016/04/19 by Marc.Audy

	Remove unused ini class name settings

Change 2948917 on 2016/04/19 by Aaron.McLeran

	UE-29654 FadeIn invalidates Audio Components in 4.11

Change 2949567 on 2016/04/20 by James.Golding

	- Add SliceProceduralMesh utility to UKismetProceduralMeshLibrary. It will slice the ProcMeshComp with a plan, including simple collision geom, and optionally create cap geometry, and create an addition ProceduralMeshComponent for the other half
	- Add support for simple collision on ProceduralMeshComponent, and added bUseComplexAsSimpleCollision to allow it to be used
	- Move GeomTools.h and .cpp from Editor to Engine module, so it can be used at runtime. Also move utils into an FGeomTools namespace.
	- Add GetSectionFromStaticMesh and CopyProceduralMeshFromStaticMeshComponent utilities to UKismetProceduralMeshLibrary
	- Expose UStaticMesh::GetNumLODs to BP, and add BP exposed UStaticMesh:: GetNumSections function

Change 2950482 on 2016/04/20 by Aaron.McLeran

	FORT-22973  SoundMix Fade Time not fading audio properly

	- Bug was due to bApplyToChildren case where the FSoundClassAdjuster wasn't getting the interpolated value before calling RecursiveApplyAdjuster in the case of non-overriden sound mixes.

Change 2951102 on 2016/04/21 by Thomas.Sarkanen

	Un-deprecated blueprint functions for attachment/detachment

	Renamed functions to <FuncName> (Deprecated).
	Hid functions in the BP context menu so new ones cant be added.

	#jira UE-23216 - "Snap to Target, Keep World Scale" when attaching doesn't work properly if parent is scaled.

Change 2951173 on 2016/04/21 by James.Golding

	Fix cap geom generation when more than one polygon is generated
	Fix CIS warning in KismetProceduralMeshLibrary.cpp

Change 2951334 on 2016/04/21 by Osman.Tsjardiwal

	Add CapMaterial param to SliceProceduralMesh util

Change 2951528 on 2016/04/21 by Marc.Audy

	Fix spelling errors in comments

Change 2952933 on 2016/04/22 by Lukasz.Furman

	fixed behavior tree getting stuck on instantly finished gameplay tasks
	copy of CL# 2952930

Change 2953948 on 2016/04/24 by James.Golding

	Put #if WITH_EDITOR back into FPoly::Triangulate to fix non-editor builds (FPoly::Finalize not available in non-editor)

Change 2954558 on 2016/04/25 by Marc.Audy

	Make USceneComponent::Attach* members private and remove deprecation messages and pragmas disabling/enabling deprecation throughout SceneComponent.h/cpp
	#jira UE-29038

Change 2954865 on 2016/04/25 by Aaron.McLeran

	UE-29763 Use HMD audio device only in VR preview mode, not for other PIE session types.

Change 2955009 on 2016/04/25 by Zak.Middleton

	#ue4 - Wrap call from UCharacterMovementComponent::PostPhysicsTickComponent() to UpdateBasedMovement() in a FScopedMovementUpdate to accumulate moves with better perf.

Change 2955878 on 2016/04/26 by Benn.Gallagher

	[Epic Friday] - Added spherical constraints to anim dynamics

Change 2956380 on 2016/04/26 by Lina.Halper

	PR #2298: Step interpolation for UAnimSequence (Contributed by douglaslassance)

Change 2956383 on 2016/04/26 by Lina.Halper

	Fixed to match coding standard

Change 2957866 on 2016/04/27 by Zak.Middleton

	#ue4 - Add max depenetration distance settings for CharacterMovementComponent. Add controls to throttle logging when character is stuck in geometry so it doesn't spam the log.

	- Depenetration settings are separated based on whether overlapping a Pawn versus other geometry, and furthermore by whether the Character is a proxy or not. Simulated proxies typically should not depenetrate a large amount because that effectively ignores the server authoritative location update.

	- "Stuck" logging is controlled by the console var "p.CharacterStuckWarningPeriod". Set to number of seconds between logged events, or less than zero to disable logging.

	#tests QA-Surfaces multiplayer, walking in to moving objects and pawns.

Change 2957953 on 2016/04/27 by Aaron.McLeran

	UE-30018 Fixing up audio component ref-counting to prevent triggering notifications when an audio component is still active after a sound finishes playing.

Change 2958011 on 2016/04/27 by Jon.Nabozny

	CalcAABB wasn't properly accounting for current transform on Convex elements, causing bad results.
	#JIRA UE-29525

Change 2958321 on 2016/04/27 by Lukasz.Furman

	path following update pass, added flags to request result, fixed AITask stacking vs scripted/BP move requests

Change 2959506 on 2016/04/28 by Aaron.McLeran

	PR #2330: Fix for ambient sounds not stopping when active and told to play again (Contributed by hgamiel)

Change 2959686 on 2016/04/28 by Marc.Audy

	Correctly handle multiple viewpoints when significance is being sorted descending

Change 2959773 on 2016/04/28 by Marc.Audy

	Fix shadowing warning

Change 2959785 on 2016/04/28 by Aaron.McLeran

	UE-30083 Sound concatenator node doesn't progress if child nodes don't produce wave instances

Change 2960852 on 2016/04/29 by Marc.Audy

	Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2960738

Change 2960946 on 2016/04/29 by Marc.Audy

	Fix post merge compile error

Change 2962501 on 2016/05/02 by Marc.Audy

	Remove interim GetMutableAttach accessors and use the variables directly now that they are private

Change 2962535 on 2016/05/02 by Marc.Audy

	Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2962478

Change 2962578 on 2016/05/02 by Marc.Audy

	Switch ObjectGraphMove to using UserFlags instead of custom move data

Change 2962651 on 2016/05/02 by Marc.Audy

	VS2015 shadow variable fixes

Change 2962662 on 2016/05/02 by Lukasz.Furman

	deprecated old implementation of gameplay debugger
	#jira UE-30011

Change 2962919 on 2016/05/02 by Marc.Audy

	VS2015 shadow variable fixes

Change 2963475 on 2016/05/02 by Mieszko.Zielinski

	Made SimpleMoveToLocation/Actor not reset velocity if agent not already at goal #UE4

	#jira UE-30176

Change 2964098 on 2016/05/03 by Marc.Audy

	Spelling fix

Change 2964099 on 2016/05/03 by Marc.Audy

	VS2015 shadow variable fixes

Change 2964156 on 2016/05/03 by Marc.Audy

	VS2015 shadow variable fixes

Change 2964272 on 2016/05/03 by Marc.Audy

	VS2015 Shadow Variable fixes

Change 2964395 on 2016/05/03 by Marc.Audy

	VS2015 Shadow Variable Fixes

Change 2964460 on 2016/05/03 by Marc.Audy

	Reschedule coolingdown tick functions during pause frames.
	#jira UE-30221

Change 2964666 on 2016/05/03 by Marc.Audy

	Fix shipping compile error

[CL 2964775 by Marc Audy in Main branch]
2016-05-03 15:44:33 -04:00

357 lines
9.8 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
//////////////////////////////////////////////////////////////////////////
// THIS CLASS IS NOW DEPRECATED AND WILL BE REMOVED IN NEXT VERSION
// Please check GameplayDebugger.h for details.
#pragma once
#include "Components/PrimitiveComponent.h"
#include "GameplayDebuggingTypes.h"
#include "EnvironmentQuery/EQSQueryResultSourceInterface.h"
#include "EnvironmentQuery/EnvQueryDebugHelpers.h"
#include "Debug/DebugDrawService.h"
#include "GameplayDebuggingComponent.generated.h"
#define WITH_EQS 1
struct FDebugContext;
//struct FEnvQueryInstance;
UENUM()
namespace EDebugComponentMessage
{
enum Type
{
EnableExtendedView,
DisableExtendedView,
ActivateReplication,
DeactivateReplilcation,
ActivateDataView,
DeactivateDataView,
SetMultipleDataViews,
};
}
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnDebuggingTargetChanged, class AActor* /*Owner of debugging component*/, bool /*is being debugged now*/);
DECLARE_LOG_CATEGORY_EXTERN(LogGameplayDebugger, Log, All);
UENUM()
enum class EGameplayDebuggerShapeElement : uint8
{
Invalid,
String,
SinglePoint,
Segment,
Box,
Cone,
Cylinder,
Capsule,
Polygon,
};
USTRUCT()
struct FGameplayDebuggerShapeElement
{
GENERATED_USTRUCT_BODY()
/** points defining shape */
UPROPERTY()
TArray<FVector> Points;
UPROPERTY()
float ThicknesOrRadius;
/** description of shape */
UPROPERTY()
FString Description;
/** color of shape */
UPROPERTY()
FColor Color;
/** type of shape */
UPROPERTY()
EGameplayDebuggerShapeElement Type;
FGameplayDebuggerShapeElement() : Type(EGameplayDebuggerShapeElement::Invalid) {}
EGameplayDebuggerShapeElement GetType() const { return Type; }
FColor GetFColor() const { return Color; }
static FGameplayDebuggerShapeElement MakePoint(const FVector& Location, const float Radius, const FColor& Color, const FString& Description);
static FGameplayDebuggerShapeElement MakeSegment(const FVector& StartLocation, const FVector& EndLocation, const float Thickness, const FColor& Color, const FString& Description);
static FGameplayDebuggerShapeElement MakeBox(const FVector& Center, const FVector& Extent, const FColor& Color, const FString& Description);
static FGameplayDebuggerShapeElement MakeCone(const FVector& Location, const FVector& Direction, const float Length, const FColor& Color, const FString& Description);
static FGameplayDebuggerShapeElement MakeCylinder(const FVector& Center, const float Radius, const float HalfHeight, const FColor& Color, const FString& Description);
static FGameplayDebuggerShapeElement MakeCapsule(const FVector& Center, const float Radius, const float HalfHeight, const FColor& Color, const FString& Description);
static FGameplayDebuggerShapeElement MakePolygon(const TArray<FVector>& Verts, const FColor& Color, const FString& Description);
};
UCLASS(config=Engine)
class GAMEPLAYDEBUGGER_API UGameplayDebuggingComponent : public UPrimitiveComponent, public IEQSQueryResultSourceInterface
{
GENERATED_UCLASS_BODY()
friend class AGameplayDebuggingHUDComponent;
struct FPathCorridorPolygons
{
TArray<FVector> Points;
FColor Color;
};
UPROPERTY(globalconfig)
FString DebugComponentClassName;
UPROPERTY(Replicated)
int32 ShowExtendedInformatiomCounter;
UPROPERTY(Replicated)
TArray<int32> ReplicateViewDataCounters;
UPROPERTY(Replicated)
FString ControllerName;
UPROPERTY(Replicated)
FString PawnName;
UPROPERTY(Replicated)
FString PawnClass;
UPROPERTY(Replicated)
FString DebugIcon;
UPROPERTY(Replicated)
FString MovementBaseInfo;
UPROPERTY(Replicated)
FString MovementModeInfo;
UPROPERTY(Replicated)
FString PathFollowingInfo;
UPROPERTY(Replicated)
FString CurrentAITask;
UPROPERTY(Replicated)
FString CurrentAIState;
UPROPERTY(Replicated)
FString CurrentAIAssets;
UPROPERTY(Replicated)
FString GameplayTasksState;
UPROPERTY(Replicated)
FString NavDataInfo;
UPROPERTY(Replicated)
FString AbilityInfo;
UPROPERTY(Replicated)
FString MontageInfo;
UPROPERTY(Replicated)
FString BrainComponentName;
UPROPERTY(Replicated)
FString BrainComponentString;
UPROPERTY(ReplicatedUsing = OnRep_UpdateBlackboard)
TArray<uint8> BlackboardRepData;
FString BlackboardString;
/** Begin path replication data */
UPROPERTY(Replicated)
TArray<FVector> PathPoints;
UPROPERTY(ReplicatedUsing = OnRep_PathCorridorData)
TArray<uint8> PathCorridorData;
TArray<FPathCorridorPolygons> PathCorridorPolygons;
/** End path replication data*/
UPROPERTY(ReplicatedUsing = OnRep_UpdateNavmesh)
TArray<uint8> NavmeshRepData;
/** Begin EQS replication data */
UPROPERTY(ReplicatedUsing = OnRep_UpdateEQS)
TArray<uint8> EQSRepData;
/** local EQS debug data, decoded from EQSRepData blob */
#if USE_EQS_DEBUGGER || ENABLE_VISUAL_LOG
TArray<EQSDebug::FQueryData> EQSLocalData;
#endif
/** End EQS replication data */
UPROPERTY(Replicated)
int32 NextPathPointIndex;
UPROPERTY(Replicated)
uint32 bIsUsingPathFollowing : 1;
UPROPERTY(Replicated)
uint32 bIsUsingCharacter : 1;
UPROPERTY(Replicated)
uint32 bIsUsingBehaviorTree : 1;
UPROPERTY(Replicated)
uint32 bIsUsingAbilities : 1;
uint32 bDrawEQSLabels:1;
uint32 bDrawEQSFailedItems : 1;
/** Start - Perception System */
UPROPERTY(Replicated)
FString PerceptionLegend;
UPROPERTY(Replicated)
float DistanceFromPlayer;
UPROPERTY(Replicated)
float DistanceFromSensor;
UPROPERTY(Replicated)
FVector SensingComponentLocation;
UPROPERTY(Replicated)
TArray<FGameplayDebuggerShapeElement> PerceptionShapeElements;
/** End - Perception System */
UFUNCTION()
virtual void OnCycleDetailsView();
UFUNCTION()
virtual void OnRep_UpdateEQS();
UFUNCTION()
virtual void OnRep_UpdateBlackboard();
virtual bool GetComponentClassCanReplicate() const override{ return true; }
UFUNCTION()
virtual void OnRep_UpdateNavmesh();
UFUNCTION()
virtual void OnRep_ActivationCounter();
UFUNCTION(exec)
void ServerReplicateData(uint32 InMessage, uint32 DataView);
UFUNCTION(reliable, server, WithValidation)
void ServerCollectNavmeshData(FVector_NetQuantize10 TargetLocation);
UFUNCTION(reliable, server, WithValidation)
void ServerDiscardNavmeshData();
void PrepareNavMeshData(struct FNavMeshSceneProxyData*) const;
UFUNCTION()
virtual void OnRep_PathCorridorData();
virtual void Activate(bool bReset=false) override;
virtual void Deactivate() override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void EnableDebugDraw(bool bEnable, bool InFocusedComponent = false);
bool ShouldReplicateData(EAIDebugDrawDataView::Type InView) const { return ReplicateViewDataCounters[InView] > 0 /*true*/; }
#if !ENABLE_OLD_GAMEPLAY_DEBUGGER
DEPRECATED_FORGAME(4.13, "GameplayDebuggingComponent class is now deprecated, please check GameplayDebugger.h for details.")
#endif // !ENABLE_OLD_GAMEPLAY_DEBUGGER
virtual void CollectDataToReplicate(bool bCollectExtendedData);
//=============================================================================
// controller related stuff
//=============================================================================
UPROPERTY(Replicated)
AActor* TargetActor;
UFUNCTION(Reliable, Client, WithValidation)
void ClientEnableTargetSelection(bool bEnable);
void SetActorToDebug(AActor* Actor);
FORCEINLINE AActor* GetSelectedActor() const
{
return TargetActor && TargetActor->IsPendingKill() == false ? TargetActor : nullptr;
}
void SetEQSIndex(int32 Index) { CurrentEQSIndex = Index; }
int32 GetEQSIndex() { return CurrentEQSIndex; }
//=============================================================================
// EQS debugging
//=============================================================================
uint32 bEnableClientEQSSceneProxy : 1;
void EnableClientEQSSceneProxy(bool bEnable) { bEnableClientEQSSceneProxy = bEnable; MarkRenderStateDirty(); }
bool IsClientEQSSceneProxyEnabled() { return bEnableClientEQSSceneProxy; }
// IEQSQueryResultSourceInterface start
virtual const struct FEnvQueryResult* GetQueryResult() const override;
virtual const struct FEnvQueryInstance* GetQueryInstance() const override;
virtual bool GetShouldDebugDrawLabels() const override { return bDrawEQSLabels; }
virtual bool GetShouldDrawFailedItems() const override{ return bDrawEQSFailedItems; }
// IEQSQueryResultSourceInterface end
protected:
virtual void CollectEQSData();
public:
//=============================================================================
// Rendering
//=============================================================================
virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
virtual FBoxSphereBounds CalcBounds(const FTransform &LocalToWorld) const override;
virtual void CreateRenderState_Concurrent() override;
virtual void DestroyRenderState_Concurrent() override;
void SelectTargetToDebug();
protected:
#if WITH_RECAST
ARecastNavMesh* GetNavData();
#endif
virtual void CollectPathData();
virtual void CollectBasicData();
virtual void CollectBehaviorTreeData();
virtual void CollectPerceptionData();
virtual void CollectBasicMovementData(APawn* MyPawn);
virtual void CollectBasicPathData(APawn* MyPawn);
virtual void CollectBasicBehaviorData(APawn* MyPawn);
virtual void CollectBasicAbilityData(APawn* MyPawn);
virtual void CollectBasicAnimationData(APawn* MyPawn);
FNavPathWeakPtr CurrentPath;
float LastStoredPathTimeStamp;
uint32 bEnabledTargetSelection : 1;
#if WITH_EDITOR
uint32 bWasSelectedInEditor : 1;
#endif
UPROPERTY(ReplicatedUsing = OnRep_ActivationCounter)
uint8 ActivationCounter;
float NextTargrtSelectionTime;
/** navmesh data passed to rendering component */
FBox NavMeshBounds;
TWeakObjectPtr<APlayerController> PlayerOwner;
int32 CurrentEQSIndex;
TSharedPtr<FEnvQueryInstance> CachedQueryInstance;
public:
static FName DefaultComponentName;
static FOnDebuggingTargetChanged OnDebuggingTargetChangedDelegate;
};