#pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "MCPVoxelGraphLibrary.generated.h" class UEdGraph; UCLASS() class UEBLUEPRINTMCPEDITOR_API UMCPVoxelGraphLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static bool IsVoxelGraphAsset(UObject* Asset); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString ListTerminalGraphsJson(UObject* Asset); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static UEdGraph* FindTerminalEdGraph(UObject* Asset, const FString& Terminal); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString DumpTerminalGraphJson(UObject* Asset, const FString& Terminal); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString GetSelectedNodesJson(UObject* Asset, const FString& Terminal); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString SpawnCommentNode(UEdGraph* Graph, FVector2D Position, FVector2D Size, const FString& Comment, FLinearColor Color); // Returns a JSON catalogue of every spawnable Voxel node (struct nodes + function-library nodes). // Filter is an optional case-insensitive substring matched against id / display name / category. UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString ListNodeTypesJson(const FString& Filter, int32 Limit); // Spawns a functional Voxel node (UVoxelGraphNode_Struct) identified by NodeId // (struct name, struct path, display name, or "Library.Function" for function nodes). // Returns the new node GUID as string, or empty on failure. UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString SpawnStructNode(UEdGraph* Graph, const FString& NodeId, FVector2D Position); // Registers a graph property and returns its new GUID as JSON {ok, guid, name, type}. // Kind: "parameter" (graph parameter), "input"/"output" (function in/out), "local" (local variable). // TypeStr: float|double|int|bool|vector2d|vector|color|name (defaults to float). UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString AddGraphPropertyJson(UObject* Asset, const FString& Terminal, const FString& Kind, const FString& Name, const FString& TypeStr, const FString& Category); // Lists graph properties of the given Kind as JSON {ok, properties:[{guid,name,type,category}]}. UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString ListGraphPropertiesJson(UObject* Asset, const FString& Terminal, const FString& Kind); // Spawns a usage node for an existing property (Ref = guid or name). bDeclaration only matters // for Kind "local" (declaration vs usage). Returns the new node GUID, or empty on failure. UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString SpawnPropertyNode(UEdGraph* Graph, const FString& Kind, const FString& Ref, FVector2D Position, bool bDeclaration); // Spawns a "Call Function" node for a function terminal graph (FunctionRef = terminal guid or name). // Returns the new node GUID, or empty on failure. UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static FString SpawnCallFunctionNode(UEdGraph* Graph, const FString& FunctionRef, FVector2D Position); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static bool NotifyGraphChanged(UEdGraph* Graph, bool bCompile); UFUNCTION(BlueprintCallable, Category = "MCP|VoxelGraph") static bool OpenVoxelGraphAsset(UObject* Asset); };