Merge of the two project copies into one self-contained plugin (the superset: variable_op + variables.py, full pcg_op runtime/declarative/preset ops, the CreateWidgetFloatAnimation widget tool, and full Voxel graph authoring). Made fully project- and machine-agnostic — no hardcoded paths: - New src/projectPaths.js auto-detects the host .uproject (walk-up), project name, Editor build target, log file, and engine install (EngineAssociation via launcher manifest/registry, else installed-engine scan). All overridable via UE_* env vars. - Rewired buildOrchestrator/insights/launcher/insightsExporter/server.js and the Python workers (cpp_scaffold, live_coding, apply_graph, console) off the old C:/Github/ihy, IHY*, E:/UE_Versions and UE_5.7 literals onto the resolver. - Voxel made optional: Build.cs auto-detects the Voxel plugin (env UE_MCP_WITH_VOXEL override) and the C++ compiles to stubs under WITH_MCP_VOXEL, so the module builds in projects without Voxel; .uplugin marks Voxel optional. - De-branded the agent-gateway and docs; scrubbed a leaked API key; excluded node_modules/Binaries/Intermediate/__pycache__/secrets from the repo. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
80 lines
3.1 KiB
C++
80 lines
3.1 KiB
C++
// 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
|
|
);
|
|
};
|