60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingHandler.h"
|
|
#include "WingServer.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingVariables.h"
|
|
#include "Kismet2/KismetEditorUtilities.h"
|
|
#include "GraphVariables_Dump.generated.h"
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
UCLASS()
|
|
class UWing_GraphVariables_Dump : public UObject, public IWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(meta=(Description="Path to a function graph (e.g. '/Game/MyBP,graph:MyFunction')"))
|
|
FString Graph;
|
|
|
|
virtual FString GetDescription() const override
|
|
{
|
|
return TEXT("List all arguments, return values, and local variables of a function graph.");
|
|
}
|
|
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F;
|
|
UEdGraph* G = F.Walk(Graph).Cast<UEdGraph>();
|
|
if (!G) return;
|
|
|
|
FStringBuilderBase &Output = UWingServer::GetPrintBuffer();
|
|
TWeakObjectPtr<UK2Node_EditablePinBase> EntryNode;
|
|
TWeakObjectPtr<UK2Node_EditablePinBase> ResultNode;
|
|
FBlueprintEditorUtils::GetEntryAndResultNodes(G, EntryNode, ResultNode);
|
|
WingVariables Arguments = WingVariables::ParseEditablePinBase(EntryNode.Get());
|
|
WingVariables ReturnValues = WingVariables::ParseEditablePinBase(EntryNode.Get());
|
|
WingVariables Locals = WingVariables::ParseFunctionLocalVariables(EntryNode.Get());
|
|
if (!Arguments.GetVariables().IsEmpty())
|
|
{
|
|
Output.Appendf(TEXT("Arguments:\n"));
|
|
Arguments.PrintAll(Output, 4);
|
|
}
|
|
if (!ReturnValues.GetVariables().IsEmpty())
|
|
{
|
|
Output.Appendf(TEXT("ReturnValues:\n"));
|
|
ReturnValues.PrintAll(Output, 4);
|
|
}
|
|
if (!Locals.GetVariables().IsEmpty())
|
|
{
|
|
Output.Appendf(TEXT("LocalVariables:\n"));
|
|
Locals.PrintAll(Output, 4);
|
|
}
|
|
}
|
|
};
|