- Add MCP server with real Unreal Remote Execution Protocol (UDP 6766 + TCP 6776) - Implement 12 MCP tools: project intelligence, scene manipulation, debug/profiling, blueprint ops - Add enhanced .uasset parser with UE4/UE5 support - Create /blueprint-workflow skill (analyze, bp-to-cpp, cpp-to-bp, transform, optimize) - Include 21 passing tests - Add complete user documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
261 lines
5.6 KiB
Markdown
261 lines
5.6 KiB
Markdown
# Blueprint Workflow Skill
|
|
|
|
You are executing a Blueprint workflow command for Unreal Engine. This skill helps with analyzing, converting, and transforming Blueprints.
|
|
|
|
## Command: {{command}}
|
|
## Arguments: {{args}}
|
|
|
|
---
|
|
|
|
## Instructions by Command
|
|
|
|
### If command is `analyze`
|
|
|
|
1. Use `read_blueprint` tool to parse the Blueprint
|
|
2. Use `profile_blueprint` tool if editor is connected
|
|
3. Analyze for common issues:
|
|
- Heavy Event Tick usage (operations per frame)
|
|
- Blueprint casts (expensive operations)
|
|
- Tick-dependent logic that could be event-driven
|
|
- Large Blueprint graphs that should be split
|
|
- Missing async loading for assets
|
|
- Component lookups that should be cached
|
|
|
|
4. Report findings in this format:
|
|
```
|
|
## Performance Analysis: <Blueprint Name>
|
|
|
|
### Issues Found
|
|
🔴 HIGH: <issue description>
|
|
→ Suggestion: <fix>
|
|
|
|
🟡 MEDIUM: <issue description>
|
|
→ Suggestion: <fix>
|
|
|
|
🟢 LOW: <issue description>
|
|
→ Suggestion: <fix>
|
|
|
|
### Metrics
|
|
- Estimated Tick Cost: <X> operations/frame
|
|
- Complexity Score: <LOW/MEDIUM/HIGH>
|
|
- Optimization Potential: <percentage>%
|
|
|
|
### Recommendations
|
|
1. <recommendation>
|
|
2. <recommendation>
|
|
```
|
|
|
|
---
|
|
|
|
### If command is `bp-to-cpp`
|
|
|
|
1. Use `read_blueprint` tool to parse the Blueprint structure
|
|
2. Extract:
|
|
- Variables (types, defaults, replication)
|
|
- Functions (parameters, return types)
|
|
- Events (delegates, dispatchers)
|
|
- Components
|
|
|
|
3. Generate C++ code following Epic standards:
|
|
- Proper UCLASS, UPROPERTY, UFUNCTION macros
|
|
- Blueprint-friendly specifiers (BlueprintCallable, BlueprintReadWrite)
|
|
- Network replication if needed (Replicated, ReplicatedUsing)
|
|
- Categories for organization
|
|
|
|
4. Output format:
|
|
```cpp
|
|
// <ClassName>.h
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "<ParentClass>.h"
|
|
#include "<ClassName>.generated.h"
|
|
|
|
UCLASS(Blueprintable)
|
|
class MYPROJECT_API <AClassName> : public <AParentClass>
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
<AClassName>();
|
|
|
|
// Properties
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "...")
|
|
<Type> <PropertyName>;
|
|
|
|
// Functions
|
|
UFUNCTION(BlueprintCallable, Category = "...")
|
|
<ReturnType> <FunctionName>(<Params>);
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
};
|
|
```
|
|
|
|
```cpp
|
|
// <ClassName>.cpp
|
|
#include "<ClassName>.h"
|
|
|
|
<AClassName>::<AClassName>()
|
|
{
|
|
// Set defaults
|
|
}
|
|
|
|
void <AClassName>::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
}
|
|
|
|
<ReturnType> <AClassName>::<FunctionName>(<Params>)
|
|
{
|
|
// Implementation
|
|
}
|
|
```
|
|
|
|
5. Note any Blueprint-specific logic that cannot be directly converted
|
|
|
|
---
|
|
|
|
### If command is `cpp-to-bp`
|
|
|
|
1. Use `scan_cpp_classes` to find the C++ class
|
|
2. Extract exposed properties and functions (UPROPERTY, UFUNCTION with Blueprint specifiers)
|
|
3. Use `create_blueprint_from_cpp` tool to create the Blueprint
|
|
|
|
4. If editor not connected, generate a Python script:
|
|
```python
|
|
import unreal
|
|
|
|
# Create Blueprint from <CppClass>
|
|
factory = unreal.BlueprintFactory()
|
|
factory.set_editor_property('parent_class', unreal.find_class('<CppClass>'))
|
|
|
|
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
|
|
blueprint = asset_tools.create_asset(
|
|
'<BlueprintName>',
|
|
'<OutputPath>',
|
|
unreal.Blueprint,
|
|
factory
|
|
)
|
|
|
|
if blueprint:
|
|
unreal.EditorAssetLibrary.save_asset('<OutputPath>/<BlueprintName>')
|
|
unreal.log('Created: <OutputPath>/<BlueprintName>')
|
|
```
|
|
|
|
5. Report what was created:
|
|
```
|
|
## Blueprint Created: <BlueprintName>
|
|
|
|
### Parent Class
|
|
<CppClass>
|
|
|
|
### Exposed Properties (tweakable in Blueprint)
|
|
- <PropertyName>: <Type> = <Default>
|
|
- ...
|
|
|
|
### Callable Functions
|
|
- <FunctionName>(<Params>) → <ReturnType>
|
|
- ...
|
|
|
|
### Events
|
|
- <EventName>
|
|
- ...
|
|
|
|
### Location
|
|
<OutputPath>/<BlueprintName>
|
|
```
|
|
|
|
---
|
|
|
|
### If command is `transform`
|
|
|
|
1. Use `read_blueprint` to get current Blueprint structure
|
|
2. Understand the modification request: "{{args}}"
|
|
3. Design the changes needed:
|
|
- New variables
|
|
- New functions
|
|
- Modified logic
|
|
- New components
|
|
|
|
4. Generate the transformation:
|
|
- If simple: Generate Python script to modify Blueprint
|
|
- If complex: Generate new C++ base class + new Blueprint
|
|
|
|
5. Report the transformation:
|
|
```
|
|
## Blueprint Transformation: <BlueprintName>
|
|
|
|
### Requested Change
|
|
"<modification_description>"
|
|
|
|
### Changes Made
|
|
1. Added variable: <name> (<type>)
|
|
2. Added function: <name>()
|
|
3. Modified: <what was changed>
|
|
|
|
### New Features
|
|
- <feature description>
|
|
|
|
### Generated Files
|
|
- <file1>
|
|
- <file2>
|
|
|
|
### Next Steps
|
|
1. <what user needs to do>
|
|
```
|
|
|
|
---
|
|
|
|
### If command is `optimize`
|
|
|
|
1. First run `analyze` workflow internally
|
|
2. Identify optimization opportunities:
|
|
- Event Tick → Events + Timers
|
|
- Blueprint casts → Interfaces
|
|
- Heavy logic → C++ conversion candidates
|
|
- Repeated operations → Caching
|
|
|
|
3. For each HIGH impact issue:
|
|
- Generate optimized C++ code
|
|
- Or generate Python script to refactor Blueprint
|
|
|
|
4. Report:
|
|
```
|
|
## Optimization Report: <BlueprintName>
|
|
|
|
### Before
|
|
- Tick Cost: <X> ops/frame
|
|
- Complexity: <SCORE>
|
|
|
|
### After (Estimated)
|
|
- Tick Cost: <Y> ops/frame
|
|
- Complexity: <SCORE>
|
|
- **Performance Gain: +<Z>%**
|
|
|
|
### Optimizations Applied
|
|
1. <optimization description>
|
|
- Before: <what it was>
|
|
- After: <what it became>
|
|
- Gain: +<X>%
|
|
|
|
### Generated Files
|
|
- <file1> - <description>
|
|
- <file2> - <description>
|
|
|
|
### Manual Steps Required
|
|
1. <step>
|
|
2. <step>
|
|
```
|
|
|
|
---
|
|
|
|
## Important Notes
|
|
|
|
- Always use MCP tools when available (`read_blueprint`, `create_blueprint_from_cpp`, etc.)
|
|
- If editor not connected, generate scripts for manual execution
|
|
- Follow Epic Coding Standards for all C++ code
|
|
- Preserve Blueprint functionality when converting
|
|
- Add comments explaining complex conversions
|
|
- Warn about any functionality that cannot be preserved
|