Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/Debugger/StateTreeTraceProvider.h

44 lines
1.8 KiB
C
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#if WITH_STATETREE_DEBUGGER
#include "IStateTreeTraceProvider.h"
#include "Model/PointTimeline.h"
#include "StateTreeTypes.h" // required to compile TMap<FStateTreeInstanceDebugId, ...>
namespace TraceServices { class IAnalysisSession; }
enum class EStateTreeTraceInstanceEventType : uint8;
class UStateTree;
namespace UE::StateTreeDebugger { struct FInstanceDescriptor; }
class FStateTreeTraceProvider : public IStateTreeTraceProvider
{
public:
static FName ProviderName;
explicit FStateTreeTraceProvider(TraceServices::IAnalysisSession& InSession);
void AppendEvent(FStateTreeInstanceDebugId InInstanceId, double InTime, const FStateTreeTraceEventVariantType& InEvent);
void AppendInstanceEvent(
const UStateTree* InStateTree,
const FStateTreeInstanceDebugId InInstanceId,
const TCHAR* InInstanceName,
double Time,
EStateTreeTraceInstanceEventType EventType);
protected:
/** IStateTreeDebuggerProvider interface */
virtual void GetInstances(TArray<UE::StateTreeDebugger::FInstanceDescriptor>& OutInstances) const override;
virtual bool ReadTimelines(const FStateTreeInstanceDebugId InstanceId, TFunctionRef<void(const FStateTreeInstanceDebugId ProcessedInstanceId, const FEventsTimeline&)> Callback) const override;
virtual bool ReadTimelines(const UStateTree& StateTree, TFunctionRef<void(const FStateTreeInstanceDebugId ProcessedInstanceId, const FEventsTimeline&)> Callback) const override;
private:
TraceServices::IAnalysisSession& Session;
TMap<FStateTreeInstanceDebugId, uint32> InstanceIdToDebuggerEntryTimelines;
TArray<UE::StateTreeDebugger::FInstanceDescriptor> Descriptors;
TArray<TSharedRef<TraceServices::TPointTimeline<FStateTreeTraceEventVariantType>>> EventsTimelines;
};
#endif // WITH_STATETREE_DEBUGGER