#pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "MCPNiagaraLibrary.generated.h" class UNiagaraSystem; class UNiagaraEmitter; class UNiagaraScript; class UNiagaraRendererProperties; /** * Editor-only helpers wrapping Niagara authoring APIs for the MCP server. * All methods are no-ops/return defaults outside the editor. */ UCLASS() class UMCPNiagaraLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: /** Create an empty UNiagaraSystem asset at the given /Game/... path. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static bool CreateNiagaraSystem(const FString& PackagePath); /** List emitter handle names on the system. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static TArray GetEmitterHandleNames(UNiagaraSystem* System); /** Add an emitter (asset) to the system. Returns the new handle name or empty on failure. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static FString AddEmitterToSystem(UNiagaraSystem* System, UNiagaraEmitter* SourceEmitter, const FString& EmitterName); /** Remove an emitter handle (by handle name) from the system. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static bool RemoveEmitterFromSystem(UNiagaraSystem* System, const FString& EmitterName); /** * List module nodes (function-call nodes) in a stack group. * GroupName: EmitterSpawn | EmitterUpdate | ParticleSpawn | ParticleUpdate | SystemSpawn | SystemUpdate * EmitterName ignored for SystemSpawn/SystemUpdate. * Returns module names in evaluation order. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static TArray ListModules(UNiagaraSystem* System, const FString& EmitterName, const FString& GroupName); /** * Insert a module script into the stack group. Index = -1 appends. * Returns the spawned module's function name (used as ModuleName for subsequent ops), or empty on failure. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static FString AddModuleToStack(UNiagaraSystem* System, const FString& EmitterName, const FString& GroupName, UNiagaraScript* ModuleScript, int32 Index); /** Remove a module node from the stack group by name. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static bool RemoveModuleFromStack(UNiagaraSystem* System, const FString& EmitterName, const FString& GroupName, const FString& ModuleName); /** Add a renderer (UNiagaraRendererProperties subclass) to an emitter. Returns the renderer class name or empty. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static FString AddRendererToEmitter(UNiagaraSystem* System, const FString& EmitterName, UClass* RendererClass); /** Remove all renderers of a given class from an emitter. Returns count removed. */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static int32 RemoveRenderersFromEmitter(UNiagaraSystem* System, const FString& EmitterName, UClass* RendererClass); /** Recompile the Niagara system (and its emitters). */ UFUNCTION(BlueprintCallable, Category = "MCP|Niagara") static bool RequestCompile(UNiagaraSystem* System); };