Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeEditorModule/Private/SStateTreeDebuggerView.h
yoan stamant 64c8dca7cb [StateTreeDebugger]
Initial version of the debugger
- currently compiled by StateTreeModule and StateTreeEditorModule using WITH_STATETREE_DEBUGGER
- currently not exposed to UI by StateTree settings 'bUseDebugger'
- in this version only one instance per asset can be debugged
- using Trace services to read events generated by statetree instances.
- can connect to any traces (Editor, Client, Server) as long as the compiled statetree matches
#rb mieszko.zielinski
#preflight 641088a30e1f02786b509663

[CL 24639409 by yoan stamant in ue5-main branch]
2023-03-14 13:35:46 -04:00

83 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#if WITH_STATETREE_DEBUGGER
#include "Debugger/StateTreeTraceTypes.h"
#include "Widgets/SCompoundWidget.h"
namespace UE::StateTreeDebugger { struct FFrameIndexSpan; }
struct FStateTreeDebugger;
struct FStateTreeInstanceDebugId;
class FStateTreeEditor;
class FStateTreeViewModel;
class FUICommandList;
class IMessageLogListing;
class UStateTree;
class SStateTreeDebuggerView : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SStateTreeDebuggerView) {}
SLATE_END_ARGS()
SStateTreeDebuggerView();
~SStateTreeDebuggerView();
void Construct(const FArguments& InArgs, const UStateTree* InStateTree, TSharedRef<FStateTreeViewModel> InStateTreeViewModel, TSharedRef<FUICommandList> InCommandList);
private:
TSharedRef<SWidget> OnGetDebuggerInstancesMenu() const;
TSharedRef<SWidget> OnGetDebuggerTracesMenu() const;
void OnPIEStarted(bool bIsSimulating) const;
void OnPIEStopped(bool bIsSimulating) const;
void OnPIEPaused(bool bIsSimulating) const;
void OnPIEResumed(bool bIsSimulating) const;
void OnPIESingleStepped(bool bIsSimulating) const;
void OnTracesUpdated(const TConstArrayView<const FStateTreeTraceEventVariantType> Events, const TConstArrayView<UE::StateTreeDebugger::FFrameIndexSpan> Spans) const;
void OnBreakpointHit(const FStateTreeInstanceDebugId InstanceId, const FStateTreeStateHandle StateHandle, const TSharedPtr<FUICommandList> ActionList) const;
void BindDebuggerToolbarCommands(const TSharedRef<FUICommandList> ToolkitCommands);
/**
* Stores raw log information so it can be processed
*/
struct FPendingLogMessage
{
FString Message;
ELogVerbosity::Type Verbosity = ELogVerbosity::NoLogging;
FName Category;
FPendingLogMessage()
{
}
FPendingLogMessage(const TCHAR* InMessage, const ELogVerbosity::Type InVerbosity, const FName& InCategory)
: Message(InMessage)
, Verbosity(InVerbosity)
, Category(InCategory)
{
}
};
bool CanStepBack() const;
void StepBack() const;
bool CanStepForward() const;
void StepForward() const;
bool CanToggleBreakpoint() const;
void ToggleBreakpoint() const;
TSharedPtr<FStateTreeDebugger> Debugger;
TSharedPtr<FStateTreeViewModel> StateTreeViewModel;
TWeakObjectPtr<const UStateTree> StateTree;
TSharedPtr<SWidget> DebuggerTraces;
TSharedPtr<IMessageLogListing> DebuggerTraceListing;
};
#endif // WITH_STATETREE_DEBUGGER