Node2Code: Turn any node setup into a custom addon

UPDATE: v1.2 Massive architecture overhaul and improvements!

What is it?
Node2Code, a plugin for Blender that lets you build customized addons from any node setup with 1 click!

Tired of opening the same nodes and textures all the time?
Node2Code lets you package any number of nodes and images into your own personal shader collection in the form of an addon!


No more searching, appending and sorting, build it once and deploy in any Blender file.


Store any number of nodes and images inside your addon, immediately available with 1 click!


Build your own personal collection of shaders, ready to be deployed instantly.

Want to share with other people?
Node2Code now packages all addons automatically into a ready-to-share zip file! No more fuss saving text files together, Node2Code takes care of everything for you!

Included is documentation for using the addon and customisation tips and tricks.

BlenderMarket: https://blendermarket.com/products/node2code
Gumroad: https://gum.co/node2code [10% off with code save10]

Currently the Roadmap (to do list) looks like this:

  • Support 2.80 (Done)
  • Reroute support (Done)
  • Frame support (Done)
  • Image texture support (Done)
  • Guides for custom icons + panel location (Done)
  • Compositing node support (Done)
  • Addon property editing from Node2Code pane (Done)l
  • World node support
  • Texture node support
8 Likes

With this addon I make addons or scripts?
In case of addon, I imagine something like a script-loader where you can set the location of the scripts, save that preference and then load shaders in the UI.
Or how does that work? (how are my customers going to load my shaders?)

This addon does 2 things:

  • creates a custom addon from a node group
  • combines multiple generated addons into a collection inside a new addon

You don’t need to set any script loading.
As mentioned in the picture above:

  1. Select Nodes
  2. Generate Addon
  3. Save the text file from the text editor and load it back into blender.

How loading the addon works (workflow for customers):

  1. open user preferences
  2. navigate to addons tab
  3. click install from file
  4. selected the saved “.py” addon file
  5. enable the addon + save user settings

This workflow is common for every addon, so customers that have purchased addons before will have no issues applying it.
After this the addon will permanently remain in the node editor toolbar whenever you open blender :slight_smile:

Hope this answers your question!

Thanks, sounds good!
Could it be interesting for us to see a screenshot of that UI in the node editor toolbar. So, what my customers will see. (Not what I see when I buy your addon).

1 Like

Ohh, that is exactly what I wanted to know. Super!

1 Like

Any idea when the port to 2.80 will be ready? Are you already working on it, or is it on the roadmap?

2.80 support will likely be the first extra feature to be released. Given product viability I will start working on updates in the next couple weeks.

1 Like

Have just pushed out a 2.80 release :slight_smile:

Update is free for everyone who previously purchased the addon!
More updates on the way.

Enjoy!

This looks super interesting… I reacon String Fairy could make a lot of good use if this!

First question… will it work with groups that contain image textures?

Images are very tricky, especially since this plugin generates addons that can be distributed outside of the current computer which means saving the file path and then just reloading will not work 90% of the time.

Nevertheless I have a rough idea to solve this issue and will publish an update in the future to address this. I have added it to the roadmap.
For the moment however, image textures will need to be re-opened upon deployment.

That’s fair enough. I see that textures will often present problems for this kind of addon… for a start - where should the addon save them?

This still looks like a fantastic addon.

1 Like

@Thatimster
I wonder, I can manage to code some simple python by copying it from the info panel and making a script of it. But I can’t code an addon like making panels, classes, and make it so that when I press a button it execute that code.

So I wonder if I can use this addon to make an addon initially meant for the node-editor, and then I adjust it a bit so that it can execute code in another panel I want.

For example I make a an addon for the N-panel (I know it’s overcrowded already) place a button there and then it execute code I made that is setting a few lamps. So then I can offer a set of light-setups.

What do you think?

Exactly, storing the image data is the biggest problem if only the script is distributed, especially when sizing up to 4k textures etc. For the moment I will continue adding updates and try addressing the issue directly.

This is totally possible with node2code :slight_smile: I may consider making this easier in the future.
Steps to modify:

  1. In the panel class starting with NAME_PT_panel, change the bl_space_type and/or bl_region_type properties to determine where the addon is drawn.
  2. If you have a collection script, each method starts with “def execute_name”, so below each of these sections you can replace all the code with anything you like!
    If you have a 1 shader script, you will need to modify below the “def execute” method of the class that starts with ADD_OT_name. This function must return {“FINISHED”} when completed so leave this last line in.

General advice: Convert whitespace to tabs with format operator in the text editor and maintain indentation level.

Feel free to get in touch if you run into any issues!

1 Like

Ok, bought. Thanks.

1 Like

@Thatimster
I works which is super, but noticed the following:
The mapping node is causing this error: ( I didn’t group some node here because I thought first that that might be the issue but that’s not).

Traceback (most recent call last):
File “C:\Users\Flatron\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\node2code-280.py”, line 495, in execute
details[“props”] = self.copy_props(propstr, to_code)
File “C:\Users\Flatron\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\node2code-280.py”, line 372, in copy_props
prop_dict[m]= self.stringify_val(getattr(n, m))
File “C:\Users\Flatron\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\node2code-280.py”, line 550, in stringify_val
if val.type ==“VALUE”:
AttributeError: ‘Euler’ object has no attribute ‘type’

So for now I leave the Mapping Node out and then it works, but is there a solution for or is it a known limitation for now?

Some values, like in RGB-input node and values in Colorramps were not stored in the generated addon… Is that correct? Most (or all) other values were stored in the generated addon. I can easily add code myself though.

1 Like

Looks like I forgot to test euler properties fully, I’ll also double check to make sure RGB input is included.
Working on a fix now, hopefully can include reroute nodes and labels in the same patch.

Thanks for letting me know :slight_smile:

1 Like

New version 1.1 now available from the product page :slight_smile:

Bugs fixed:
Euler type error
Not storing input node default values

Confirmed:
reroute support

Still to do:
Frame support (works, but nodes inside frame are offset due to parenting, will address in later patch).

1 Like

Wow that’s fast. This is my chance to learn some Python. I think this is a good start.

1 Like