CodeToNode
See your Unreal Engine C++ as Blueprint nodes, live, while you type, and copy the nodes straight into the Blueprint editor. Works the other way too: copy nodes in Unreal and paste them into VS Code as readable C++.
What it does
- Live preview. Put the cursor inside any function in a
.cpp file and open the preview (editor title button, right-click menu, or Ctrl+Shift+Alt+B). The panel redraws as you move between functions and as you edit.
- Copy Blueprint. Click Copy Blueprint in the preview (or
Ctrl+Shift+Alt+C), switch to Unreal, click into a Blueprint graph and press Ctrl+V. The nodes and their wires are recreated.
- Paste Blueprint as C++. In Unreal, select nodes and press
Ctrl+C. In VS Code press Ctrl+Shift+Alt+V (or right-click → Paste Blueprint Nodes as C++). Pasting inside a function body inserts just the statements; anywhere else you get full function definitions plus a comment block listing the header declarations, UPROPERTYs and #includes they need.
- Click to jump. Click a node, or a row in the Issues list, to jump to the line it came from.
- Honest about gaps. Anything that can't be translated cleanly is flagged with a red badge and listed under Issues, never silently dropped.
What gets translated
| C++ |
Blueprint |
BeginPlay, Tick, EndPlay, NotifyActorBeginOverlap/EndOverlap, Destroyed |
Event BeginPlay / Event Tick / ... |
| any other function |
Custom Event with the parameters as outputs |
if / else |
Branch |
if (APawn* P = Cast<APawn>(X)) |
Cast To Pawn (then / Cast Failed) |
for (int32 i = A; i < B; ++i) |
For Loop (For Loop with Break if it contains break) |
for (AActor* A : Actors) |
For Each Loop (with Break) |
while (...) |
While Loop |
continue / break / return |
end of chain / Break pin / end of chain |
UPROPERTY read / write, +=, ++ |
Get / Set variable nodes |
| locals |
wired directly from the node that produced the value |
+ - * / % < > == && || ! |
Kismet math / string operator nodes (int, float, vector, rotator, string, bool, object) |
x != nullptr, if (Obj) |
Is Valid |
UE_LOG, GEngine->AddOnScreenDebugMessage, FString::Printf |
Print String, with %s %d %f turned into Append chains |
| ~100 engine functions |
Actor, Pawn, Character, Scene/Primitive Component, Gameplay Statics, FMath, FVector, string conversions |
your own UFUNCTIONs |
Call nodes (read from the matching header) |
Blueprint → C++
| Blueprint |
C++ |
| Event BeginPlay / Tick / EndPlay / overlaps |
BeginPlay() etc. overrides, with the Super:: call |
| Custom Event / function graph |
UFUNCTION + definition (function return nodes become return) |
| component bound events, input actions |
handler functions, with a note on how to bind them |
| Branch, Is Valid macro, Cast To |
if / else (paths that join again aren't duplicated), if (T* X = Cast<T>(...)) |
| Sequence |
consecutive blocks |
| For Loop / For Each Loop (with Break) / While Loop |
for, range-for / indexed for, while, break; |
| Switch on Int / Enum / String / Name |
switch or if / else if |
| Delay |
FTimerHandle + SetTimer with the rest of the chain in a lambda |
| Do Once, Flip Flop |
a bool member + if |
| Get / Set variable |
member reads/writes, +=, ++ |
pure nodes, math operators (UE5 promotable +, >...) |
inline expressions with correct precedence |
| split struct pins, reroute knots, comment boxes |
FVector(...) / .Z, followed through, // comments above the code they enclose |
| Spawn Actor from Class |
GetWorld()->SpawnActor<T>(...) |
Asset references and Blueprint classes can't be named in C++, so those come out as nullptr with a note to expose a UPROPERTY.
The header next to the .cpp (same folder, Private → Public, or anywhere in the workspace) is scanned for UPROPERTY and UFUNCTION declarations, so variable types and your own functions' pins come out right.
Known limits
- Paste behaviour. The output follows the format the Unreal editor itself copies. Unreal rebuilds each node's pins on paste, so a pin CodeToNode named wrong loses its wire rather than breaking the graph.
- Local variables aren't created. Their uses are wired directly. A local that is reassigned inside a branch or loop is flagged, since that pattern needs a real variable in Blueprints.
- Return values. Non-event functions become Custom Events, which can't return values. Blueprint functions (with a return node) are on the roadmap.
- Not yet supported:
switch, lambdas, templates beyond Cast<>, SpawnActor, timers/delegates, struct member writes (V.X = 1), functions not in the table or your header.
- Type inference is syntactic (no compiler), so calls on expressions of unknown type are flagged.
Developing
npm install
npm run build # bundle to dist/ (also copies the tree-sitter wasm files)
npm test # C++ -> nodes -> C++ round trip on samples/, plus samples/*.txt -> C++
npm run typecheck
Press F5 in VS Code to launch an Extension Development Host with samples/ open.
To teach CodeToNode a new engine function, add an entry to FUNCTIONS in src/functionTable.ts. You'll need the UFUNCTION's owning class, its real name (many are K2_ prefixed), and its parameter names exactly as Unreal declares them.
Layout of the code
src/
extension.ts VS Code wiring: commands, cursor tracking, header lookup
previewPanel.ts webview panel host
core.ts text in -> graph + clipboard text out (no VS Code dependency)
parser.ts web-tree-sitter + C++ grammar helpers
headerScan.ts UPROPERTY / UFUNCTION scanner
translator.ts syntax tree -> Blueprint graph
functionTable.ts C++ -> UFUNCTION mapping, operators, events
types.ts C++ type -> pin type
layout.ts node sizing + auto-layout
exportT3D.ts graph -> Unreal clipboard text
t3dParse.ts Unreal clipboard text -> nodes
blueprintToCpp.ts nodes -> structured C++
media/
preview.js/.css the node renderer
test/run.ts headless test runner
samples/ example actor + a UE5 clipboard dump used by tests and F5
Packaging
npm run package # produces codetonode-<version>.vsix
Install it with Extensions → … → Install from VSIX….
| |