0 votes

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!

in Engine by (111 points)

1 Answer

+1 vote
Best answer

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.

by (1,120 points)
selected by

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).

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.