|
@@ -282,7 +282,7 @@ click the button, you can see some text in the console:
|
|
|
.. image:: img/making_plugins-custom_node_console.webp
|
|
|
|
|
|
A custom dock
|
|
|
-^^^^^^^^^^^^^
|
|
|
+~~~~~~~~~~~~~
|
|
|
|
|
|
Sometimes, you need to extend the editor and add tools that are always available.
|
|
|
An 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:
|
|
|
|
|
|
.. image:: img/making_plugins-custom_dock.webp
|
|
|
|
|
|
-Going beyond
|
|
|
-~~~~~~~~~~~~
|
|
|
-
|
|
|
-Now that you've learned how to make basic plugins, you can extend the editor in
|
|
|
-several ways. Lots of functionality can be added to the editor with GDScript;
|
|
|
-it is a powerful way to create specialized editors without having to delve into
|
|
|
-C++ modules.
|
|
|
-
|
|
|
-You can make your own plugins to help yourself and share them in the
|
|
|
-`Asset Library <https://godotengine.org/asset-library/>`_ so that people
|
|
|
-can benefit from your work.
|
|
|
-
|
|
|
.. _doc_making_plugins_autoload:
|
|
|
|
|
|
Registering autoloads/singletons in plugins
|
|
@@ -481,3 +469,50 @@ Use the following code to register a singleton from an editor plugin:
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
+
|
|
|
+Using sub-plugins
|
|
|
+~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+Often a plugin adds multiple things, for example a custom node and a panel.
|
|
|
+In those cases it might be easier to have a separate plugin script for each of those features.
|
|
|
+Sub-plugins can be used for this.
|
|
|
+
|
|
|
+First create all plugins and sub plugins as normal plugins:
|
|
|
+
|
|
|
+.. image:: img/sub_plugin_creation.webp
|
|
|
+
|
|
|
+Then move the sub plugins into the main plugin folder:
|
|
|
+
|
|
|
+.. image:: img/sub_plugin_moved.webp
|
|
|
+
|
|
|
+Godot will hide sub-plugins from the plugin list, so that a user can't enable or disable them.
|
|
|
+Instead the main plugin script should enable and disable sub-plugins like this:
|
|
|
+
|
|
|
+.. tabs::
|
|
|
+ .. code-tab:: gdscript GDScript
|
|
|
+
|
|
|
+ @tool
|
|
|
+ extends EditorPlugin
|
|
|
+
|
|
|
+ # The main plugin is located at res://addons/my_plugin/
|
|
|
+ const PLUGIN_NAME = "my_plugin"
|
|
|
+
|
|
|
+ func _enable_plugin():
|
|
|
+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/node", true)
|
|
|
+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/panel", true)
|
|
|
+
|
|
|
+ func _disable_plugin():
|
|
|
+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/node", false)
|
|
|
+ EditorInterface.set_plugin_enabled(PLUGIN_NAME + "/panel", false)
|
|
|
+
|
|
|
+Going beyond
|
|
|
+~~~~~~~~~~~~
|
|
|
+
|
|
|
+Now that you've learned how to make basic plugins, you can extend the editor in
|
|
|
+several ways. Lots of functionality can be added to the editor with GDScript;
|
|
|
+it is a powerful way to create specialized editors without having to delve into
|
|
|
+C++ modules.
|
|
|
+
|
|
|
+You can make your own plugins to help yourself and share them in the
|
|
|
+`Asset Library <https://godotengine.org/asset-library/>`_ so that people
|
|
|
+can benefit from your work.
|