46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "WingServer.h"
|
|
#include "WingHandler.h"
|
|
#include "WingFetcher.h"
|
|
#include "WingUtils.h"
|
|
#include "EdGraph/EdGraphNode.h"
|
|
#include "GraphNode_Rename.generated.h"
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
UCLASS()
|
|
class UWing_GraphNode_Rename : public UWingHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(EditAnywhere, meta=(Description="Target node"))
|
|
FString Node;
|
|
|
|
UPROPERTY(EditAnywhere, meta=(Description="New name for the node"))
|
|
FString Name;
|
|
|
|
virtual void Register() override
|
|
{
|
|
UWingServer::AddHandler(this,
|
|
TEXT("Rename a graph node. Works on custom events, timelines, "
|
|
"composite nodes, comment nodes, and other renameable node types."));
|
|
}
|
|
virtual void Handle() override
|
|
{
|
|
WingFetcher F(WingOut::Stdout);
|
|
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
|
if (!FoundNode) return;
|
|
|
|
if (!WingUtils::CheckCanRename(FoundNode, Name, WingOut::Stdout)) return;
|
|
FoundNode->OnRenameNode(Name);
|
|
|
|
WingOut::Stdout.Printf(TEXT("Renamed node to %s\n"), *Name);
|
|
}
|
|
};
|