45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingHandler.h"
|
|
#include "WingServer.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingUtils.h"
|
|
#include "WingFunctionArgs.h"
|
|
#include "GraphNode_SetArgs.generated.h"
|
|
|
|
UCLASS()
|
|
class UWing_GraphNode_SetArgs : public UObject, public IWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(meta=(Description="Path to a graph node (function entry, function result, custom event, or tunnel)"))
|
|
FString Node;
|
|
|
|
UPROPERTY(meta=(Description="Args e.g. 'int x,float y'"))
|
|
FString Args;
|
|
|
|
virtual FString GetDescription() const override
|
|
{
|
|
return TEXT("Set the user-defined pins (arguments or return values) on a function entry, result, custom event, or tunnel node.");
|
|
}
|
|
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F;
|
|
UEdGraphNode* NodeObj = F.Walk(Node).Cast<UEdGraphNode>();
|
|
if (!NodeObj) return;
|
|
|
|
if (!WingFunctionArgs::HasArgs(NodeObj))
|
|
{
|
|
UWingServer::Printf(TEXT("ERROR: Node does not support editable args\n"));
|
|
return;
|
|
}
|
|
|
|
if (!WingFunctionArgs::SetArgs(NodeObj, Args)) return;
|
|
|
|
UWingServer::Printf(TEXT("Args set to: %s\n"), *WingFunctionArgs::GetArgs(NodeObj));
|
|
}
|
|
};
|