// Vision-loop helper for the UEBlueprintMCP plugin. // Renders a UMG WidgetBlueprint to a PNG file so external agents can SEE // what they just authored. Called from Python via unreal.MCPWidgetRenderLibrary. #pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "MCPWidgetRenderLibrary.generated.h" class UUserWidget; UCLASS() class UEBLUEPRINTMCPEDITOR_API UMCPWidgetRenderLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: /** * Render a UserWidget class to a PNG file on disk. * Returns true on success and fills OutFullPath with the absolute file path. * * @param WidgetClass A UUserWidget subclass (e.g. GeneratedClass of a WidgetBlueprint). * @param OutputAbsPath Absolute directory path where the PNG should be written. * The folder is created if missing. * @param FileNameNoExt File name WITHOUT extension. ".png" is appended automatically. * @param Width Texture width in pixels (clamped to [16, 8192]). * @param Height Texture height in pixels (clamped to [16, 8192]). * @param OutFullPath On success, the absolute path of the written PNG. * @param OutError On failure, a short description of what went wrong. */ UFUNCTION(BlueprintCallable, Category = "MCP|UI", meta = (DisplayName = "Render Widget To PNG")) static bool RenderWidgetToPNG( TSubclassOf WidgetClass, const FString& OutputAbsPath, const FString& FileNameNoExt, int32 Width, int32 Height, FString& OutFullPath, FString& OutError ); };