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

227 lines
4.3 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 "IRewindDebugger.h"
#include "Widgets/SWidget.h"
#include "Textures/SlateIcon.h"
namespace TraceServices
{
class IAnalysisSession;
}
struct FToolMenuSection;
namespace RewindDebugger
{
class FRewindDebuggerTrack
{
public:
FRewindDebuggerTrack()
{
}
virtual ~FRewindDebuggerTrack()
{
}
bool GetIsExpanded() const
{
return bExpanded;
}
void SetIsExpanded(const bool bIsExpanded)
{
bExpanded = bIsExpanded;
}
bool GetIsSelected() const
{
return bSelected;
}
void SetIsSelected(const bool bIsSelected)
{
bSelected = bIsSelected;
}
bool GetIsTreeHovered() const
{
return bTreeHovered;
}
void SetIsTreeHovered(const bool bIsHovered)
{
bTreeHovered = bIsHovered;
}
bool GetIsTrackHovered() const
{
return bTrackHovered;
}
void SetIsTrackHovered(const bool bIsHovered)
{
bTrackHovered = bIsHovered;
}
bool GetIsHovered() const
{
return bTrackHovered || bTreeHovered;
}
/** Update should do work to compute children etc. for the current time range. Return true if children have changed. */
bool Update()
{
return UpdateInternal();
}
/** Get a widget to show in the timeline view for this track */
TSharedPtr<SWidget> GetTimelineView()
{
return GetTimelineViewInternal();
}
/** Get a widget to show in the details tab, when this track is selected */
TSharedPtr<SWidget> GetDetailsView()
{
return GetDetailsViewInternal();
}
/** unique name for track (must match creator name if track is created by an IRewindDebuggerViewCreator) */
FName GetName() const
{
return GetNameInternal();
}
/** icon to display in the tree view */
FSlateIcon GetIcon()
{
return GetIconInternal();
}
/** display name for track in Tree View */
FText GetDisplayName() const
{
return GetDisplayNameInternal();
}
/** insights main UObject id for an object associated with this track */
uint64 GetUObjectId() const
{
return GetObjectIdInternal();
}
UE_DEPRECATED(5.7, "Use GetUObjectID instead.")
uint64 GetObjectId() const
{
return GetUObjectId ();
}
/** insights object id for an object associated with this track */
FObjectId GetAssociatedObjectId() const
{
return FObjectId(GetObjectIdInternal(), GetChildElementIdInternal());
}
/** iterates over all sub-tracks of this track and call Iterator function */
void IterateSubTracks(TFunction<void(TSharedPtr<FRewindDebuggerTrack> SubTrack)> IteratorFunction)
{
IterateSubTracksInternal(IteratorFunction);
}
/** returns true for tracks that contain debug data (used for filtering out parts of the hierarchy with no useful information in them) */
bool HasDebugData() const
{
return HasDebugDataInternal();
}
/** Called when a track is double-clicked. Returns true if the track handled the double click */
bool HandleDoubleClick()
{
return HandleDoubleClickInternal();
}
bool IsVisible() const
{
return bVisible;
}
void SetIsVisible(const bool bInIsVisible)
{
bVisible = bInIsVisible;
}
/** Called to generate context menu for the current selected track */
virtual void BuildContextMenu(FToolMenuSection& InMenuSection) {};
private:
virtual bool UpdateInternal()
{
return false;
}
virtual TSharedPtr<SWidget> GetTimelineViewInternal()
{
return TSharedPtr<SWidget>();
}
virtual TSharedPtr<SWidget> GetDetailsViewInternal()
{
return TSharedPtr<SWidget>();
}
virtual FSlateIcon GetIconInternal()
{
return FSlateIcon();
}
virtual FName GetNameInternal() const
{
return "";
}
virtual FText GetDisplayNameInternal() const
{
return FText();
}
virtual uint64 GetObjectIdInternal() const
{
return {};
}
virtual uint64 GetChildElementIdInternal() const
{
return INDEX_NONE;
}
virtual bool HasDebugDataInternal() const
{
return true;
}
virtual void IterateSubTracksInternal(TFunction<void(TSharedPtr<FRewindDebuggerTrack> SubTrack)> IteratorFunction)
{
}
virtual bool HandleDoubleClickInternal()
{
IRewindDebugger::Instance()->OpenDetailsPanel();
return true;
};
bool bSelected : 1 = false;
bool bTrackHovered : 1 = false;
bool bTreeHovered : 1 = false;
bool bExpanded : 1 = true;
bool bVisible : 1 = true;
};
} // namespace RewindDebugger