From f5fe8ddacc1b390bf99b1dc965a5f8214e6e7470 Mon Sep 17 00:00:00 2001 From: RoniPerson <67514656+RoniPerson@users.noreply.github.com> Date: Thu, 15 Apr 2021 19:23:27 +0200 Subject: [PATCH] Added documentation to some `add_*_plugin` methods Added documentation to some `add_*_plugin` methods and the corresponding `remove_*_plugin` methods. Added an example of how to register a plugin to `add_inspector_plugin` and linked to it in the other methods. (cherry picked from commit e849157e074fdc302be9e7f7a891bea53ed5cee3) Proofread add_*_plugin/remove_*_plugin descriptions in EditorPlugin (cherry picked from commit 21f09616102a6b45f6533c58da33a4f973468ae6) --- doc/classes/EditorPlugin.xml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 720df8e93e0..eccef1dbac9 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -82,7 +82,8 @@ - Registers a new export plugin. Export plugins are used when the project is being exported. See [EditorExportPlugin] for more information. + Registers a new [EditorExportPlugin]. Export plugins are used to perform tasks when the project is being exported. + See [method add_inspector_plugin] for an example of how to register a plugin. @@ -91,6 +92,9 @@ + Registers a new [EditorImportPlugin]. Import plugins are used to import custom and unsupported assets as a custom [Resource] type. + [b]Note:[/b] If you want to import custom 3D asset formats use [method add_scene_import_plugin] instead. + See [method add_inspector_plugin] for an example of how to register a plugin. @@ -99,6 +103,18 @@ + Registers a new [EditorInspectorPlugin]. Inspector plugins are used to extend [EditorInspector] and provide custom configuration tools for your object's properties. + [b]Note:[/b] Always use [method remove_inspector_plugin] to remove the registered [EditorInspectorPlugin] when your [EditorPlugin] is disabled to prevent leaks and an unexpected behavior. + [codeblock] + const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd") + var inspector_plugin = MyInspectorPlugin.new() + + func _enter_tree(): + add_inspector_plugin(inspector_plugin) + + func _exit_tree(): + remove_inspector_plugin(inspector_plugin) + [/codeblock] @@ -107,6 +123,7 @@ + Registers a new [EditorSceneImporter]. Scene importers are used to import custom 3D asset formats as scenes. @@ -115,6 +132,8 @@ + Registers a new [EditorSpatialGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Spatial]. + See [method add_inspector_plugin] for an example of how to register a plugin. @@ -470,6 +489,7 @@ + Removes an export plugin registered by [method add_export_plugin]. @@ -478,6 +498,7 @@ + Removes an import plugin registered by [method add_import_plugin]. @@ -486,6 +507,7 @@ + Removes an inspector plugin registered by [method add_import_plugin] @@ -494,6 +516,7 @@ + Removes a scene importer registered by [method add_scene_import_plugin]. @@ -502,6 +525,7 @@ + Removes a gizmo plugin registered by [method add_spatial_gizmo_plugin].