Blender add-on: 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 material’s 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.

Demonstration video

Important

The local materials library is stored in the add-on directory. If you need to temporarily remove or reinstall the add-on, be sure to back up the library in a separate place on the disk first. After reinstalling the addon, the library can be restored simply by copying it to the “nodetree_source_library” directory of the add-on.

The “Material”, “World” and “Compositing” nodes are supported.

Current add-on version

1.2.1.

Blender versions

2.93, 3.0

Location and call

“3D Viewport” window – N-panel – the “NodeTree Source” tab

Installation
  • Download the *.zip archive with the add-on distributive.
  • The “Preferences” window — Add-ons — Install… — specify the downloaded archive.
Version history

1.2.1.

  • Fixed issue with a node group input-output nodes processing

1.2.0.

  • Added support for Geometry Nodes

1.1.0.

  • Added “Light” node trees support

1.0.1.

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

1.0.0.

  • This release.
0 0 votes
Article Rating
Subscribe
Notify of
guest
5 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Rombout Versluijs
Rombout Versluijs
5 months ago
Rombout Versluijs
Rombout Versluijs
5 months ago
Reply to  Nikita

Yeah i know its C++ its internal code. I was already wondering a while ago that in the blender api in the outliner nothing is shown in terms of nodes. Everything else is shown here.
I was hoping to find a types class or method so i could add my code to that panel

Rombout Versluijs
Rombout Versluijs
5 months ago

Thats pretty cool work! Do you have knowledge of were the py file is for Node Group panel? Im trying to get the panel code for the Node > Instance panel. This is the panel when you tab into a node group. It shows the inputs and outputs of a node group.

Im making an addon which allow to create and edit the inputs easier than the current method. Currently when you have a node-group and want to edit the input type, its tedious work. Atleast for me, i dont know any other method of adding a node then connect it so it will inherit that typ.

Here’s a preview, the bottom panel is my add to this. Would be nice if i could get it inside that other panel. But on trying to edit it returns this error:
“Active button is not from a script” I guess this is internal code right?

https://ibb.co/Kq4Bk0M
https://ibb.co/JnTvNpB

NikitaD
Admin
5 months ago

I did this in another addon – “BIS”. You can download it (it is free and open-source) and use it. Or you can check my code about inputs/outputs adding here https://github.com/Korchy/BIS/blob/master/tools_nodes_ops.py and make something of your own.