Files
UnrealEngine/Engine/Source/Editor/RewindDebuggerInterface/Public/IRewindDebugger.h
2025-05-18 13:04:45 +08:00

148 lines
4.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_7
#include "CoreMinimal.h"
#endif // UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_7
#include "RewindDebuggerTypes.h"
#include "TraceServices/Model/Frames.h"
#include "IRewindDebugger.generated.h"
REWINDDEBUGGERINTERFACE_API DECLARE_LOG_CATEGORY_EXTERN(LogRewindDebugger, Log, All);
namespace TraceServices { class IAnalysisSession; }
namespace RewindDebugger
{
class FRewindDebuggerTrack;
class FPropertiesTrack;
}
class IGameplayProvider;
struct FObjectInfo;
struct FDebugObjectInfo
{
FDebugObjectInfo() = default;
FDebugObjectInfo(const RewindDebugger::FObjectId& Id, const FString& Name)
: Id(Id)
, ObjectName(Name)
, bExpanded(true)
{
}
/** @return Part of the Id representing the UObject */
uint64 GetUObjectId() const
{
return Id.GetMainId();
}
RewindDebugger::FObjectId Id;
FString ObjectName;
TArray<TSharedPtr<FDebugObjectInfo>> Children;
bool bExpanded = false;
#if WITH_EDITORONLY_DATA
UE_DEPRECATED(5.7, "Use ObjectIdentifier instead")
uint64 ObjectId = 0;
#endif
};
UCLASS()
class REWINDDEBUGGERINTERFACE_API URewindDebuggerTrackContextMenuContext : public UObject
{
GENERATED_BODY()
public:
TSharedPtr<FDebugObjectInfo> SelectedObject;
TArray<FName> TypeHierarchy;
TSharedPtr<RewindDebugger::FRewindDebuggerTrack> SelectedTrack;
};
class REWINDDEBUGGERINTERFACE_API UE_DEPRECATED(5.7, "Use URewindDebuggerTrackContextMenuContext instead") UComponentContextMenuContext : public URewindDebuggerTrackContextMenuContext
{
};
/**
* IRewindDebugger
* Public interface to rewind debugger
*/
class REWINDDEBUGGERINTERFACE_API IRewindDebugger
{
public:
IRewindDebugger();
virtual ~IRewindDebugger();
/** @return the time the debugger is scrubbed to, in seconds since the capture started (or the recording duration while the game is running) */
virtual double CurrentTraceTime() const = 0;
/** @return the time the debugger is scrubbed to, in seconds since the recording started */
virtual double GetScrubTime() const = 0;
/** @return the current visible range in trace/profiler units (same units as CurrentTraceTime) */
virtual const TRange<double>& GetCurrentTraceRange() const = 0;
/** @return the current visible range in Rewind Debugger recording time units */
virtual const TRange<double>& GetCurrentViewRange() const = 0;
/** @return the current analysis session */
virtual const TraceServices::IAnalysisSession* GetAnalysisSession() const = 0;
/** @return insights id for the selected target actor */
virtual uint64 GetTargetActorId() const = 0;
/** @return list of all components of the selected target actor (with the actor as the first element in the list)*/
virtual TArray<TSharedPtr<FDebugObjectInfo>>& GetDebuggedObjects() = 0;
UE_DEPRECATED(5.7, "Use GetDebuggedObjects instead")
virtual TArray<TSharedPtr<FDebugObjectInfo>>& GetDebugComponents() final
{
return GetDebuggedObjects();
}
/** @return Whether the given object id is one of the object currently debugged, or one of its children. */
virtual bool IsObjectCurrentlyDebugged(uint64 InObjectId) const = 0;
UE_DEPRECATED(5.7, "Use IsObjectCurrentlyDebugged instead")
virtual bool IsContainedByDebugComponent(uint64 InObjectId) const final
{
return IsObjectCurrentlyDebugged(InObjectId);
}
/** @return the currently selected debug object */
virtual TSharedPtr<FDebugObjectInfo> GetSelectedObject() const = 0;
/** @return the currently selected track */
virtual TSharedPtr<RewindDebugger::FRewindDebuggerTrack> GetSelectedTrack() const = 0;
/** @return position of the selected target actor (returns true if position is valid) */
virtual bool GetTargetActorPosition(FVector& OutPosition) const = 0;
/** @return the world that the debugger is replaying in */
virtual UWorld* GetWorldToVisualize() const = 0;
/** @return whether the recording is active */
virtual bool IsRecording() const = 0;
/** @return whether a trace file is loaded from disk */
virtual bool IsTraceFileLoaded() const = 0;
/** @return PIE is running and not paused */
virtual bool IsPIESimulating() const = 0;
/** @return the length of the current recording */
virtual double GetRecordingDuration() const = 0;
/** Opens the Rewind Debugger details panel tab */
virtual void OpenDetailsPanel() = 0;
/** @return the object information of the first object inheriting from AActor in the outer chain of ObjectId */
virtual const FObjectInfo* FindOwningActorInfo(const IGameplayProvider* GameplayProvider, uint64 ObjectId) const = 0;
virtual bool ShouldDisplayWorld(uint64 WorldId) = 0;
/** @return the current IRewindDebugger instance */
static IRewindDebugger* Instance();
protected:
static IRewindDebugger* InternalInstance;
};