Improve docs about plugin registration

This commit is contained in:
kobewi
2021-12-25 16:55:03 +01:00
parent a75afd61a7
commit 4fc795194b
5 changed files with 10 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
Registers a custom resource importer in the editor. Use the class to parse any file and import it as a new resource type.
</brief_description>
<description>
EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. Register your [EditorPlugin] with [method EditorPlugin.add_import_plugin].
[EditorImportPlugin]s provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers.
EditorImportPlugins work by associating with specific file extensions and a resource type. See [method get_recognized_extensions] and [method get_resource_type]. They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the [code].import[/code] directory (see [member ProjectSettings.application/config/use_hidden_project_data_directory]).
Below is an example EditorImportPlugin that imports a [Mesh] from a file with the extension ".special" or ".spec":
[codeblock]
@@ -46,6 +46,7 @@
var filename = save_path + "." + get_save_extension()
return ResourceSaver.save(filename, mesh)
[/codeblock]
To use [EditorImportPlugin], register it using the [method EditorPlugin.add_import_plugin] method first.
</description>
<tutorials>
<link>$DOCS_URL/tutorials/plugins/editor/import_plugins.html</link>