@@ -282,7 +282,7 @@ click the button, you can see some text in the console:
282282.. image :: img/making_plugins-custom_node_console.webp
283283
284284A custom dock
285- ^^^^^^^^^^^^^
285+ ~~~~~~~~~~~~~
286286
287287Sometimes, you need to extend the editor and add tools that are always available.
288288An easy way to do it is to add a new dock with a plugin. Docks are just scenes
@@ -413,18 +413,6 @@ the settings window. You should now have a custom dock:
413413
414414.. image :: img/making_plugins-custom_dock.webp
415415
416- Going beyond
417- ~~~~~~~~~~~~
418-
419- Now that you've learned how to make basic plugins, you can extend the editor in
420- several ways. Lots of functionality can be added to the editor with GDScript;
421- it is a powerful way to create specialized editors without having to delve into
422- C++ modules.
423-
424- You can make your own plugins to help yourself and share them in the
425- `Asset Library <https://godotengine.org/asset-library/ >`_ so that people
426- can benefit from your work.
427-
428416.. _doc_making_plugins_autoload :
429417
430418Registering autoloads/singletons in plugins
@@ -481,3 +469,50 @@ Use the following code to register a singleton from an editor plugin:
481469 }
482470 }
483471 #endif
472+
473+ Using sub-plugins
474+ ~~~~~~~~~~~~~~~~~
475+
476+ Often a plugin adds multiple things, for example a custom node and a panel.
477+ In those cases it might be easier to have a separate plugin script for each of those features.
478+ Sub-plugins can be used for this.
479+
480+ First create all plugins and sub plugins as normal plugins:
481+
482+ .. image :: img/sub_plugin_creation.webp
483+
484+ Then move the sub plugins into the main plugin folder:
485+
486+ .. image :: img/sub_plugin_moved.webp
487+
488+ Godot will hide sub-plugins from the plugin list, so that a user can't enable or disable them.
489+ Instead the main plugin script should enable and disable sub-plugins like this:
490+
491+ .. tabs ::
492+ .. code-tab :: gdscript GDScript
493+
494+ @tool
495+ extends EditorPlugin
496+
497+ # The main plugin is located at res://addons/my_plugin/
498+ const PLUGIN_NAME = "my_plugin"
499+
500+ func _enable_plugin():
501+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/node", true)
502+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/panel", true)
503+
504+ func _disable_plugin():
505+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/node", false)
506+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/panel", false)
507+
508+ Going beyond
509+ ~~~~~~~~~~~~
510+
511+ Now that you've learned how to make basic plugins, you can extend the editor in
512+ several ways. Lots of functionality can be added to the editor with GDScript;
513+ it is a powerful way to create specialized editors without having to delve into
514+ C++ modules.
515+
516+ You can make your own plugins to help yourself and share them in the
517+ `Asset Library <https://godotengine.org/asset-library/ >`_ so that people
518+ can benefit from your work.
0 commit comments