Add a blueprint exporter for claude code

This commit is contained in:
2026-02-15 07:13:53 -05:00
parent f88a969ab4
commit 218863d077
13 changed files with 509 additions and 115 deletions

View File

@@ -0,0 +1,50 @@
# Blueprint Text Export
Blueprints are stored as binary `.uasset` files that Claude Code cannot read directly. To work around this, a text exporter automatically converts blueprint graphs to readable text files whenever a blueprint is saved in the Unreal editor.
## How It Works
The game module (`FlxIntegrationModuleImpl` in `Source/Integration/Integration.cpp`) hooks into `UPackage::PackageSavedWithContextEvent`. When a blueprint is saved, it iterates each `UEdGraph` in the blueprint and runs `FlxBlueprintExporter` on it. The output is written to `Saved/BlueprintExports/<BlueprintName>/<GraphName>.txt`.
The exporter class (`Source/Integration/BlueprintExporter.h/.cpp`) processes one graph at a time. The constructor runs all passes and the result is available via `GetOutput()`.
## Output Format
Each file has two sections:
**NodeList** maps readable node names to GUIDs:
```
NodeList:
Event_Tick = 44BAE739C72246DD9E9A72803C3B67CA
Set_Tick_Delta_Seconds = 204486800C0C4906A456A378F9F7ADE4
```
**Graph** shows the flow with pins and connections:
```
Graph:
Event_Tick
return Output_Delegate,Delta_Seconds
goto Set_Tick_Delta_Seconds
Set_Tick_Delta_Seconds
Real Tick_Delta_Seconds = Event_Tick.Delta_Seconds
return Output_Get
goto CallFunctionByName
```
- Input data pins: `Type Name = Source` where Source is a `Node.Pin` reference, a literal value, `<self>`, or `<default>`.
- Output data pins: `return Pin1,Pin2`.
- Exec flow: `goto Target` (single output), `goto Target if PinName` (multiple outputs), or `then goto`/`else goto` (branch nodes).
- String defaults are shown in quotes.
- Variable get nodes are inlined (the variable name appears directly at the point of use).
- Comment nodes appear as `// comment text`.
- Knot (reroute) nodes are followed through transparently.
## Node Ordering
Nodes are sorted by a traversal algorithm: find starter nodes (exec output but no exec input), sort them by Y position, then traverse each. The traversal visits a node's inputs first (so data sources appear before their consumers), then emits the node itself, then follows exec outputs. This produces a readable top-down flow. Any unvisited nodes are appended at the end.
## Node Naming
Names are derived from `ENodeTitleType::ListView` titles, sanitized to alphanumeric plus underscores. Duplicates get `_2`, `_3`, etc.