Skip to content

Add BlueprintEditor (Unreal-style visual scripting) with a UEVR Lua backend - #2

Draft
lobotomy-x wants to merge 5 commits into
masterfrom
claude/blueprint-visual-scripting-editor-avs2ps
Draft

lobotomy-x wants to merge 5 commits into
masterfrom
claude/blueprint-visual-scripting-editor-avs2ps

Conversation

@lobotomy-x

@lobotomy-x lobotomy-x commented Jul 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds BlueprintEditor.h / BlueprintEditor.cpp — a self-contained Dear ImGui widget in the same two-file style as TextEditor that implements an Unreal Engine style Blueprint visual scripting editor for UObject-like class hierarchies — plus BlueprintLua.h / BlueprintLua.cpp, a UEVR Lua scripting backend that turns those graphs into ready-to-run scripts for the UEVR injector.

What's included

Reflection model (UObject mirror)

  • TypeRegistry with classes, functions, events, properties and enums, built via a fluent API (.In(), .Out(), .Ret(), .Pure(), .Static(), .Keywords(), .Tooltip(), .Metadata())
  • Inheritance chain (IsChildOf) drives object/class pin compatibility
  • SetupDefaultRegistry() ships a sample UObject/AActor/APawn/ACharacter/component hierarchy plus kismet-style math, string, system and gameplay libraries

Graph model & rules

  • Node kinds: events, custom events, function calls, property get/set, variable get/set, flow control (Branch, Sequence, For/While Loop, Do Once, Do N, Flip Flop, Gate), reroute knots and comments
  • Unreal connection semantics: data inputs have one source, exec outputs one target (connecting to a full pin replaces the wire), Byte→Int→Float promotions, data-cycle rejection, one-instance-only events
  • Pins use Unreal's type colors, exec arrows, hollow/filled circles and array grid icons

Interactive editing

  • Pan (right/middle drag), zoom around cursor (30%–250%), Unreal-style grid + BLUEPRINT watermark
  • Searchable, context-sensitive add-node palette on right-click; dragging a wire onto empty canvas opens the palette filtered to compatible actions and auto-connects the spawned node
  • Box select, multi-node drag, alt-click to break links, double-click a wire to insert a reroute, comment boxes that resize and carry contained nodes, inline default-value editors (checkbox/drag/text/vector/enum/class combo)
  • Copy/paste/duplicate through the ImGui clipboard, snapshot-based undo/redo, Del/Home/Ctrl+A/C/X/V/D/Z/Y shortcuts
  • Line-based text serialization (SaveToString/LoadFromString) with escaping, used for persistence, clipboard and undo

UEVR Lua backend (BlueprintLua)

  • SetupUEVRRegistry populates the registry with the UEVR Lua API surface: engine tick / slate / XInput / UI / reset callbacks as events, uevr.api and uevr.params.vr calls, UObject property/function access through UEVR's metatable bindings, XINPUT_STATE helpers and Lua-native math/string/logic utilities
  • GenerateScript emits Lua: events → uevr.sdk.callbacks.on_* registrations, exec wires → statements, data wires → expressions (pure nodes inline, impure results captured in locals), variables → script-scope locals, flow control → native if/for/while plus state locals for Do Once / Do N / Flip Flop / Gate
  • Bindings are data-driven Lua expression templates in registry metadata ({0}–{n} inputs, {target}, |-separated segments for multi-output pure functions) so game-specific APIs are one fluent line each

Example & docs

  • example/blueprint.cpp demo (View → Blueprint Editor) building a sample ACharacter blueprint
  • example/uevr.cpp demo (View → UEVR Lua Editor) with a haptics-on-button-press sample graph and a live syntax-highlighted preview of the generated script in a read-only TextEditor pane
  • docs/blueprintEditor.md, docs/blueprintLua.md + README section
  • One-line CI fix: the windows-2025 runner image no longer ships VS 2022, so the Windows workflow now lets CMake auto-detect the installed Visual Studio

Testing

  • Everything compiles clean with -Wall -Wextra -Wpedantic -Werror under GCC 13 and Clang 18 against Dear ImGui v1.92.7; the full example/ CMake build (the same configuration CI runs) succeeds on Linux
  • Headless behavior test exercised the graph API: event uniqueness, duplicate/mismatch/cycle link rejection, numeric promotion, object subtype covariance, byte-identical serialization round-trip, undo/redo, delete cleanup and string escaping
  • Headless render test ran 30 ImGui frames simulating clicks, drags, wheel zoom, context menu, select-all and delete with no assertions
  • Lua codegen test builds a UEVR graph programmatically, asserts the emitted script's structure, validates it with luac5.4 -p and executes it against a stubbed uevr API, confirming callbacks, branching, haptics, property writes and loops behave as modeled

🤖 Generated with Claude Code

https://claude.ai/code/session_011VwW7xyG1zN46RqMvHs8fL

claude added 3 commits July 7, 2026 13:11
A self-contained two-file Dear ImGui widget (BlueprintEditor.h/.cpp) that
mimics Unreal Engine's Blueprint editor for UObject-style class hierarchies:

- UObject-like reflection registry (classes, functions, events, properties,
  enums) with a fluent builder API and a sample AActor/APawn/ACharacter
  hierarchy plus kismet-style libraries
- Event, function call, property/variable get/set, flow control (Branch,
  Sequence, loops, Gate, ...), reroute and comment nodes
- Exec and data pins with Unreal's type colors and connection rules
  (single-source data inputs, single-target exec outputs, inheritance-aware
  object pins, numeric promotions, data cycle rejection)
- Interactive canvas: pan/zoom, box select, wire dragging with
  spawn-and-connect palette drop, searchable context-sensitive add-node menu,
  alt-click link breaking, double-click reroute insertion, inline default
  value editors, comment boxes that carry contained nodes
- Copy/paste/duplicate via the ImGui clipboard, snapshot-based undo/redo and
  a line-based text serialization format
- Demo window in the example program (View -> Blueprint Editor) building a
  sample ACharacter blueprint

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VwW7xyG1zN46RqMvHs8fL
The windows-2025 runner image no longer ships Visual Studio 17 2022, so the
pinned generator fails at configure time ("could not find any instance of
Visual Studio"). Let CMake pick the newest installed Visual Studio instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VwW7xyG1zN46RqMvHs8fL
Turns blueprint graphs into ready-to-run Lua scripts for UEVR (the Unreal
Engine VR injector):

- SetupUEVRRegistry populates the reflection registry with the UEVR Lua API
  surface: engine tick / slate / XInput / UI / reset callbacks as events,
  uevr.api and uevr.params.vr calls, UObject property and function access
  through UEVR's metatable bindings, XINPUT_STATE helpers and Lua-native
  math/string/logic utilities
- GenerateScript walks the graph and emits Lua: events become
  uevr.sdk.callbacks registrations, exec wires become statements, data wires
  become expressions (pure nodes inline, impure results captured in locals),
  variables become script-scope locals and flow control maps to native Lua
  (if/for/while plus state locals for Do Once / Do N / Flip Flop / Gate)
- Function bindings are data-driven Lua expression templates stored in the
  new registry metadata field ({0}..{n} inputs, {target}, '|'-separated
  segments for multi-output pure functions), so game-specific APIs can be
  added with one fluent line per function
- BlueprintEditor gains const graph accessors (GetNodes/GetLinks/GetNode/
  GetPin) and metadata fields on Class/Function for code generator backends
- Example app gains a UEVR Lua Editor demo window (View menu) with a sample
  haptics-on-button-press graph and a live syntax highlighted preview of the
  generated script in a read-only TextEditor pane

Generated scripts were validated with luac 5.4 -p and executed against a
stubbed uevr API to confirm callbacks, branching, haptics, property writes
and loops behave as modeled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VwW7xyG1zN46RqMvHs8fL
@lobotomy-x lobotomy-x changed the title Add BlueprintEditor: an Unreal-style Blueprint visual scripting editor Add BlueprintEditor (Unreal-style visual scripting) with a UEVR Lua backend Jul 7, 2026
claude added 2 commits July 7, 2026 14:19
MSVC treats strncat as unsafe (C4996) and the example builds with /WX.
Use std::string concatenation instead, and leave inf/nan values alone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VwW7xyG1zN46RqMvHs8fL
Spread out the math nodes so nothing overlaps and enlarge the comment
box to cover the whole health drain group.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VwW7xyG1zN46RqMvHs8fL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants