Adding a custom node type "folder" to the "Create New Node" dialogue?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By shianiawhite

The instructions for adding a custom node type to the “Create New Node” dialogue as explained in the “Making Plugins” tutorial is very straight forward. However, I’m having difficulty finding how to add a new “folder” of custom nodes to the dialogue. That is, in the list of nodes, under Node, there is a grouping of nodes called CanvasItem which is not selectable as a node, but is just a “folder” containing other nodes (and more “folders”). Unfortunately, none of the methods listed in the EditorPlugin’s documentation seems to stand out as being the correct option either. How can I create such a node “folder”? Thank you!

:bust_in_silhouette: Reply From: Warlaan

That “folder” is a node type that is parent to other node types. The reason it can’t be instantiated is that it is abstract. As far as I know GDscript does not support abstract classes, so you’ll have to either create a non-abstract base class or add the abstract base class from the C++ backend (which would require a custom module or a PR that officially adds it to the engine).

In any case you should be sure that a base class is what you need. If you think of it as a “folder” you may be on the wrong track.

I see! I had thought the organization structure was separate from inheritance since in my custom node I specify the node type it’s extending (extends ExistingNode), but then I have to separately place it in the node list using the plugin’s class that extends EditorPlugin. This is done using add_custom_type("MyNode", "ExistingNode", preload("my_node.gd"), preload("my_node.png")). So even though you need to explicitly set the parent in the node list in when using add_custom_type, it can only be set to the node it’s inheriting from? I would think this would mean that the second parameter should be removed from add_custom_type then (unless I’m missing something).

shianiawhite | 2018-04-04 20:55