build_animation_state_machine
Build or update an Animation Blueprint state machine from one atomic JSON spec: create states, transitions, and rules in a single idempotent call; re-running the same spec is a no-op.
Instructions
Atomic JSON-spec builder for an Animation Blueprint state machine. Builds (or reuses) the state machine, then iterates states, transitions, and per-transition rules in one idempotent call. Replaces 8+ primitive cmds (add_anim_state_machine + add_anim_state + add_anim_transition + set_anim_transition_rule_*) with a single spec. Re-running with the same spec is a no-op (each primitive is internally idempotent: state-by-name, transition-by-source+target). For repeated invocations that change rule shape, the rule is re-applied on the existing transition.
Returns: { success: bool, anim_blueprint_path: string, machine_name: string, machine_already_existed: bool, states_created: int, states_skipped: int, transitions_created: int, transitions_updated: int, transitions_skipped: int, errors: [string], compiled: bool, compiled_after: bool }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | JSON describing the graph shape. states: [{name: str, animation?: str (/Game/Anim/Foo — optional; load-bearing for the runtime state asset but NOT created here), loop?: bool, pos?: [x, y]}]. transitions: [{from: str, to: str, blend?: number (= crossfade_duration seconds), bidirectional?: bool, priority_order?: int, rule?: object}]. Each rule variant maps 1:1 to an existing primitive cmd: {type: "automatic", enabled?: bool = false, trigger_time?: number = 0.0} | {type: "bool", variable: str (must exist on the AnimBP), invert?: bool = false} | {type: "comparison", variable: str (must be float/double on the AnimBP), operator: "=="|"!="|">"|"<"|">="|"<=", comparison_value: number}. An absent rule leaves the transition inert (no rule wired). | |
| force | No | Optional. This command is REFUSED while a Play-in-Editor session is running: it either compiles a Blueprint (the reinstancer can retain a world, and CheckForWorldGCLeaks is Fatal -- it KILLS the editor) or writes to disk (Editor.AllowSavingAssetsDuringPIE=0 makes the engine refuse the write, so it would report success without writing a byte). Stop PIE and retry instead; force=true runs it anyway, at your own risk. | |
| machine_name | No | Alias of `state_machine_name` (same value, same meaning). Accepted because sibling tools spell this parameter differently; prefer `state_machine_name`. | |
| compile_after | No | Optional, default false; if true runs compile_anim_blueprint at the end | |
| blueprint_name | No | Alias of `anim_blueprint_path` (same value, same meaning). Accepted because sibling tools spell this parameter differently; prefer `anim_blueprint_path`. | |
| state_machine_name | No | Target state machine name (created if missing via add_anim_state_machine) | |
| anim_blueprint_path | No | Path to the UAnimBlueprint asset |