Creating own Node Editor without headache (now an official Blender extension)
Hi! I found it very complicate to insert self-written nodes into Blender. First problem is, it seems not to be possible to insert them into standard Node editors like the Geometry Node Editor. That's very sad, as we could not use all the existing nodes together with own ones. So I would need to create at least a bunch of own node classes to have a basic functionality in an own Node Editor - which also cannot import any existing nodes from other Blender Node Editors. Inspired by a video from Victor explaining how to create scripts to manipulate Geometry Nodes I decided to create an own little library to manage easy creation of nodes, node categories and nodes. Result is "ccn_utils" attached here. In "HowToCall" is an example of - you guess it... :) The central thing is that you can simply use a dictionary to add all together: node_manager = ccnu.CCNNodeEditorManager() editor1 = node_manager.add_editor("Editor with Categories", icon="NODETREE", force_overwrite=True) tree_id = editor1.bl_idname print(tree_id) # Create dictionary category_dict = { "Test Cat 3": [DynamicInputNode, MyNumberNode], "Test Cat 4": [MyOutputNode, ColorGeneratorNode, MyOperatorNode], } With the first line the node manager is created with a reference to it. That is a class from the library. With "add_editor" you create a node editor. You only need the label as in the example - the corresponding very unique internal id you never need, it's created automatically (but you can read it out, see tree_id). And then the magic is in the dictionary: You have keys which are the label of the categories you want to create. And as value a list of the class names which must have been registered before (see code). And then, everything you need to do is: editor1.create_categories_from_dict(category_dict, force_overwrite=True) This creates the categories or reuses them if they exist, it creates the node entries and with "force_overwrite" they will be unregistered before, which is good while developing, so you can quickly change the Node code and rerun this and the change is directly visible in the node editor, even with already inserted nodes.