40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "MCPHandler.h"
|
|
#include "MCPFetcher.h"
|
|
#include "MCPUtils.h"
|
|
#include "EdGraph/EdGraphNode.h"
|
|
#include "UMCPHandler_GetNodeComment.generated.h"
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
UCLASS()
|
|
class UMCPHandler_GetNodeComment : public UObject, public IMCPHandler
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(meta=(Description="Path to the node, e.g. /Game/Foo,graph:EventGraph,node:MyNode"))
|
|
FString Node;
|
|
|
|
virtual FString GetDescription() const override
|
|
{
|
|
return TEXT("Get the comment text and bubble visibility of a node.");
|
|
}
|
|
|
|
virtual void Handle(const FJsonObject* Json, FStringBuilderBase& Result) override
|
|
{
|
|
MCPFetcher F(Result);
|
|
UEdGraphNode* FoundNode = F.Walk(Node).Cast<UEdGraphNode>();
|
|
if (!FoundNode) return;
|
|
|
|
Result.Appendf(TEXT("Node: %s\n"), *MCPUtils::FormatName(FoundNode));
|
|
Result.Appendf(TEXT("Comment: %s\n"), *FoundNode->NodeComment);
|
|
Result.Appendf(TEXT("BubbleVisible: %s\n"), FoundNode->bCommentBubbleVisible ? TEXT("true") : TEXT("false"));
|
|
}
|
|
};
|