# Put Node Groups into Premade Categories

So I was making node groups the other day, and had a thought... "Hey, could I put these into one of blender's premade categories?" I searched far and wide, climbed mountains, ventured across multiple landscapes, but found no answer. So what I want to do, is put these node groups into the default blender categories, or possibly make my own category. I do not want to go into "Group" every time. How can I do this?

• AFAIK Can only be done using python and I guess that isn't worth it ... Apr 13, 2021 at 21:18
• Well I would like to know how to do it, even if it's a little complicated. Apr 13, 2021 at 21:19
• @Zany_Zachary1 you'll need to override some functions of nodeitems_utils and nodeitems_builtins modules. It's not a simple thing but it's possible. Apr 14, 2021 at 7:05
• only batFinger can help here... ;) Apr 14, 2021 at 7:17
• batFinger the GitHubber? Also, I'm a total noob at coding, so I'll probably not modify any modules or anything. Apr 14, 2021 at 12:41

The simplest way to do it is using a python script.

First thing to do is to changing your node group name to have a '.' at the start, i.e: myXptoNodeGroup >> .myXptoNodeGroup. This way, the nodegroup will no longer appear in the "Group" menu.

The second thing to do is editing the following script by adding your nodegroup(s) to the items list of the ShaderNodeCategory instead of '.myXptoNodeGroup', and run the script:

import bpy
from nodeitems_utils import register_node_categories, unregister_node_categories, NodeItem

node_categories = [
]),
]

def register():
register_node_categories('MYGROUPNODES', node_categories)

def unregister():
unregister_node_categories('MYGROUPNODES')

if __name__ == "__main__":
register()


Of course, this is not exclusive to ShaderNodeGroups, it's just a matter to change the corresponding NodeCategory, and the NodeGroup type for the NodeItem.

• This is great!!! Is there any way that I can reorder it, to put it above the "Textures" Category? Apr 14, 2021 at 18:11
• Humm.. yes there is, but it's a bit hidden... The order of shadernodes is stored in a list inside the _node_categories in the nodeitems_utils module... in there you can use L.insert(3, L.pop()) right after registering.. (3 is the index of the TextureCategory, and L=nodeitems_utils._node_categories['SHADER'][0]) Apr 14, 2021 at 18:37
• So I tried to add that, right after the registration, and it broke the addon. I deleted it, and it still didn't install. I guess it isn't really a big deal though, I'll just remake the addon. Apr 15, 2021 at 13:00
• I know why, but it's difficult to explain it in just a small comment.. If you can digest the structure of the _nodes_categories dictionary, and how the draw_node_categories_menu calls each category, you'll find that your nodes aren't stored in the same place where builtin nodes are. It's quite tricky to change this without breaking everything (though it's surely possible to do it). Apr 15, 2021 at 13:25
• I've written some functions that manipulate the _node_categories directly, that you can also take a look; though I don't advise you to use them without understanding what each line of code does.. You could check [github.com/Secrop/ShaderNodesExtra2.80/blob/master/__init__.py] , specially the addCat and delCat functions in the end of that file Apr 15, 2021 at 13:38