// Headless capture helpers for the UEBlueprintMCP plugin. // // Lets external agents SEE editor content WITHOUT opening any editor tab/window: // * RenderAssetThumbnailToPNG — renders ANY asset (StaticMesh, SkeletalMesh, // Material, Texture, Blueprint, Niagara, AnimSequence, Sound, ...) using the // editor's per-class thumbnail renderer. No asset editor needs to be open. // * CaptureEditorSceneToPNG — renders the current editor world from an // arbitrary camera via an offscreen SceneCaptureComponent2D. No level // viewport / PIE required. // // Both write a PNG to disk and return its absolute path. Called from Python via // unreal.MCPCaptureLibrary. #pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "MCPCaptureLibrary.generated.h" UCLASS() class UEBLUEPRINTMCPEDITOR_API UMCPCaptureLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: /** * Render an asset's thumbnail to a PNG file, headlessly. * Works for every asset type that has a registered thumbnail renderer, which * is effectively all of them (meshes, materials, textures, blueprints, * niagara systems, anim sequences, sounds, data assets, ...). The asset * editor does NOT need to be open. * * @param AssetPath Object path, e.g. "/Game/Meshes/SM_Rock" (no class prefix needed). * @param OutputAbsPath Absolute directory to write into (created if missing). * @param FileNameNoExt File name WITHOUT extension. ".png" is appended. * @param Width Pixels, clamped [16, 2048]. * @param Height Pixels, clamped [16, 2048]. * @param OutFullPath On success, absolute path of the written PNG. * @param OutError On failure, a short description. */ UFUNCTION(BlueprintCallable, Category = "MCP|Capture", meta = (DisplayName = "Render Asset Thumbnail To PNG")) static bool RenderAssetThumbnailToPNG( const FString& AssetPath, const FString& OutputAbsPath, const FString& FileNameNoExt, int32 Width, int32 Height, FString& OutFullPath, FString& OutError ); /** * Render the active editor world from an arbitrary camera to a PNG, headlessly, * using an offscreen SceneCaptureComponent2D. No level viewport is needed. * * @param Location World-space camera location. * @param Rotation World-space camera rotation (pitch/yaw/roll). * @param FOV Horizontal field of view in degrees (clamped [5, 170]). * @param OutputAbsPath Absolute directory to write into (created if missing). * @param FileNameNoExt File name WITHOUT extension. ".png" is appended. * @param Width Pixels, clamped [16, 4096]. * @param Height Pixels, clamped [16, 4096]. * @param OutFullPath On success, absolute path of the written PNG. * @param OutError On failure, a short description. */ UFUNCTION(BlueprintCallable, Category = "MCP|Capture", meta = (DisplayName = "Capture Editor Scene To PNG")) static bool CaptureEditorSceneToPNG( FVector Location, FRotator Rotation, float FOV, const FString& OutputAbsPath, const FString& FileNameNoExt, int32 Width, int32 Height, FString& OutFullPath, FString& OutError ); };