Nodetree Source is a Blender add-on that converts a material node tree into Python source code. You can copy the generated text, save it to a file, or run it in a Blender project to recreate the material. Blender script and add-on developers can also include the code in their projects to provide materials through their own interfaces.

Turn a material node tree into Python

Open the add-on from the NodeTree Source tab in the 3D Viewport's N-panel. Click Material to Text to generate source code for the current material and display it in Blender's Text Editor. From there, copy the code or save it as a file. The Run Script button executes the code in the project and recreates the material.

This gives material and shader creators a way to keep a material's construction as editable Python. Developers can use that source in a script or add-on, then add code execution to their interface so users can create the supplied material in their own project.

Save and distribute a material library

Use Material to Library to save material source code in Nodetree Source's local library. Saved materials are available from the library for reuse. To share a collection, choose Distribute Library as Add-on and specify a path. The add-on creates an archive containing the library; recipients can download and install that add-on to use the included materials.

The local library is stored in the add-on's directory. Back it up to another location before temporarily removing or reinstalling Nodetree Source. After reinstalling, restore it by copying the backup into the add-on's nodetree_source_library directory.

Blender versions and code portability

The product listing names Blender 2.93, 3.0 through 3.6, 4.0, and 4.1. Its documentation describes support for Blender 2.93, 3.x, and 4.x. The listed versions do not guarantee that code created in one Blender release will work correctly in another. Check generated code in the Blender version where you plan to use it.

The version history identifies release 1.3.1 as fixing undefined minimum and maximum values in node-group input and output sockets. Release 1.3.0 added Blender 4.0 compatibility and processing for Repeat Zone and Simulation Zone geometry nodes. The product listing gives the license as GPL and names Nikita Akimov as the developer.

Who may find it useful

Nodetree Source is aimed at Blender script and add-on developers, along with people who create materials and shaders. It fits workflows where a material needs to be kept as Python source, reused from a local library, or packaged with an add-on for other Blender users.