Code2node - Author node trees as text

Hello everyone,

I’m sharing a small tool I’ve been working on for the past few months which lets you write Blender node trees as text (a JSON-ish node syntax).

You can author node trees as code without interacting with the node editor and data files, and serialise existing trees back to code. If you have a core library of nodes, this makes it much easier to manage and version control with Git!

Secondly, I’ve had genuinely interesting results using it with LLM agents. Frontier models can fully grasp the node language in-context, and use it to implement technically heavy node setups - the examples below were generated that way!

Examples

Shell wall masonry generator, (5000 lines → ~1100 nodes)

masonry_example.blend (272.9 KB)

Spectral soap thin film interference shader (300 lines → 106 nodes)

soap_film_example.blend (266.5 KB)

Spiral staircase (500 lines → 61 nodes)

spiral_staircase_example.blend (107.7 KB)

Usage

The repository lined below contains the core compiler/serialiser library, CLI tool, Blender extension, and a VSCode package for syntax highlighting.

A brief language reference and guide is available in the readme.

The Blender extension adds a side panel in the node editor for importing/exporting .nodes files and generating node type schemas.

Install the code2node .vsix package to get syntax highlighting in VSCode.

The CLI has tools for generating node schemas from the available types in your installed Blender version, and compiling/serialising node trees with diagnostics etc.

Links

code2node on GitHub

If you make anything interesting with this, please share here or over on Twitter!