Auto-Layout
Every AI mutation to a Blueprint, Animation Blueprint, or Control Rig graph triggers an automatic layout pass over the affected nodes. The result is always neat rows and columns — no spaghetti graphs, no manual cleanup.
What it does
Section titled “What it does”The layout pass rearranges nodes so:
- Exec nodes flow left to right along the execution wires
- Pure data nodes (getters, math, breaks) sit to the left of the exec node they feed
- Pure nodes are pin-aligned vertically with the input pin they connect to
- Long wires get reroute knots automatically when they’d otherwise span > 2 columns or > 300px vertically
- Redundant pure getters (e.g. two
GetActorLocationnodes feeding different exec nodes) are deduplicated when safe
The result looks like something a human laid out by hand, not a topo-sort spew.
When it runs
Section titled “When it runs”Auto-layout runs automatically after every AI mutation:
- After any operation that adds, moves, deletes, or reconnects a node in a graph
- After batched operations (the whole batch finishes, then one layout pass)
- After rerouting changes (insert reroute, remove reroute)
You don’t have to ask for it. It just happens.
For human edits (manually placing nodes), the layout pass does not run — you stay in control of nodes you positioned yourself.
Manual invocation
Section titled “Manual invocation”You can run the layout pass on demand from the AI chat:
Layout the EventGraph on
BP_Pickup.
Or directly via CLI:
python cli.py apply '{"op":"layout_graph","asset":"/Game/Pickups/BP_Pickup","graph":"EventGraph"}'Useful ops
Section titled “Useful ops”| Op | What it does |
|---|---|
layout_graph | Full layout pass on a single graph |
optimize_graph | Dedupe redundant pure getters only — no movement |
set_node_position | Move one node to specific coordinates |
add_reroute | Insert a reroute knot at a given position |
insert_reroute_on_link | Split an existing wire with a reroute |
add_comment_box | Wrap a set of nodes in a colored comment box |
debug_layout | Print the layout decisions for a graph (no mutation) |
debug_optimize | Print the dedupe candidates for a graph (no mutation) |
Each accepts the same asset + graph parameters as the rest of the operation set — see JSON Schema.
Six-phase algorithm
Section titled “Six-phase algorithm”The pass runs six phases in order. You can see them in debug_layout output:
- Optimize — find pure getters that could be merged, dedupe where it’s safe (no side effects, identical pins, no Sequence dependency).
- Build the exec model — classify every node as
exec,pure,event,reroute, orcomment; identify the exec entry points (BeginPlay,Tick, dispatchers, …). - Build exec trees — walk each exec entry along execution wires, producing a tree per entry.
- Compute subtree heights — sum the vertical space each subtree needs once pure rows are placed.
- Position — lay out exec nodes left-to-right by tree depth; lay out pure nodes to the left of their consumers, pin-aligned.
- Insert reroutes — for any wire that would cross > 2 columns horizontally or > 300px vertically, insert a reroute knot at the midpoint.
The phases are deterministic — the same graph in the same state always produces the same layout.
Tunable thresholds
Section titled “Tunable thresholds”The defaults work for most graphs. To change reroute behavior, pass overrides:
python cli.py apply '{ "op":"layout_graph", "asset":"/Game/Pickups/BP_Pickup", "graph":"EventGraph", "reroute_min_columns": 3, "reroute_min_pixels": 400}'| Parameter | Default | What it controls |
|---|---|---|
reroute_min_columns | 2 | Min exec-column span before inserting a reroute |
reroute_min_pixels | 300 | Min vertical distance before inserting a reroute |
optimize | true | Run the dedupe pass before positioning |
add_reroutes | true | Skip phase 6 if false |
Comment boxes
Section titled “Comment boxes”Layout preserves manually-authored comment boxes — it computes the bounding box of the original node set, then resizes the comment to fit the new positions. Comments added by AI ops (add_comment_box) are tracked the same way.
Drawing comment-aware layout: comments aren’t reflowed across other comments, so a “Sequence A” group stays separate from a “Sequence B” group even if their nodes interleave numerically.
Why this matters
Section titled “Why this matters”Generated graphs without auto-layout look like this:
[Event] - [Branch] [Branch] [Print] \ \ / [PureGetter] X / \ [Math] [GetVar]After auto-layout:
[Event] --> [Branch] --> [Print] | ^ v | [Math] [GetVar] ^ | [PureGetter]You can read it left-to-right, the pure data flows feed in from the left, the exec spine is one straight horizontal line. Every Blueprint the AI emits looks like this without you doing anything.