NodeTree Source

Blender 3D add-on for converting material nodes into python source code and storing it in the library.

The “NodeTree Source” add-on will be useful for Blender scripts and add-ons developers, as well as for materials and shaders creators.

Add-on functionality

When you click on the “Material to Text” button the current material node tree source code is created and shown in the “Text Editor” window.

You can copy this code, or save it to a file, and then paste or open it in any other Blender project. Executing this code, by clicking the “Run Script” button, the same material will be created in the project.

If you are developing an add-on or script for Blender, this code can be included in your project. Adding this code execution to your add-on interface, you will be able to provide users with the necessary materials directly from your add-on.

The “NodeTree Source” add-on also has its own library into which you can save the materials source code. To save the material sources to the local library, click the “Material to Library” button. Saved materials can be used from the library immediately.

If you want to distribute your materials to other users, the “NodeTree Source” material library can be compiled into a separate add-on. Specify the path and click the “Distribute Library as Add-on” button. The complete archive with an add-on that includes the entire library of materials will be created. Users just need to download the add-on you provided and install it, after which they can immediately use the materials you provide.

Add-on web page

For more information please visit


Demonstration video

Current add-on version:


Blender versions:



Updated to version 1.0.1.

  • Fixed bug with groups in compositor
  • Fixed bug with tabulation in Mapping nodes sources
  • Add “hide” node property to processing
  • Fixed “ColorRamp” node
1 Like

Any plans for supporting Animation Nodes or even Geometry Nodes code outputs?

I didn’t think about AN, but Geometry Nodes of course in future plans, when they will include in stable Blender releases.

Any reason why AN was not in the roadmap? Is that a technical limitation with AN? I personally think that AN will be around for a while given AN can manipulate/control some aspects of the Geometry Nodes.

AN is not a built-in official add-on. And will it remain necessary after the release of Geometry Nodes in the future?
Anyway, if there would be a big interest to AN I will think about it. At present, you are the first who asked about AN.

What about compositing nodes?

Either way its just what need to make Material Greenscreen an actual addon without having to learn to code!

Though compositing nodes would be handy - for this addon I also created a copy of the material greenscreen nodes in compositing nodes cos I like my greenscreen meathod better - particularly for bad greenscreen setups.

I gues that is debatable, since to me Geomtetry Nodes is more of a semi replacement for half of the functions in Sverchok. AN still provides the scene level control and the automation aspects. I am not sure when the Everything Nodes will actually be implemented.

You can use NodeTree Source for compositing nodes.

I think we will see this soon. In 2.92 or 2.93 when the developers will fully implement all geometry nodes features and maybe everything nodes too.

Updated to v. 1.2.0.

  • Added support for Geometry Nodes
  • Added “Light” node trees support

Hi. I just bought a copy of your add-on. It feels like it’ll be a lifesaver! :slightly_smiling_face:

I think I’ve found a couple of bugs concerning materials’ names.

  • If the name has a colon (for example, “Template: Skin Material”), the add-on won’t convert the colon to an underscore and will include it in the code’s variable name, producing an error when executing it:

    template:_skin_material ='template:_skin_material')

    (it’s the “:” in template:_skin_material =)

    My guess is that, when creating the material’s variable name for the Python code, some further filtering should be needed. I believe that happens in the “” add-on file, in its 139th line:

    for ch in (' ', '.', '/', '-'):

    I tried adding a “:” to the checking:
    for ch in (' ', '.', '/', '-', ':'):
    and that seemed to suffice (although that leads to double underscores if next to another filtered character, that could merit some further clean-up). Checking for more troublesome characters like “@”, “#” and others could be prudent, maybe.

  • Also, it seems that the add-on doesn’t preserve the original material’s name: upon executing the code, the recreated material will show up without the uppercase letters and spaces and other characters.

    The generated code shows:'template:_skin_material')
    instead of the expected'Template: Skin Material')

(I’m an absolute Python newbie, so, my apologies if I’m saying anything horribly wrong here :sweat_smile:)

Thank you for the feedback!

I fixed this issue by replacing all of the non-letter-numeric symbols in materials names with underscores.

Please download and reinstall the updated version. Don’t forget to restart Blender after the update.

Fantastic! Thank you!

Updated to v. 1.2.5.

1 Like