Inherits: Reference < Object

Category: Core

Brief Description

Import plugin for editor

Member Functions

bool can_reimport_multiple_files ( ) virtual
RawArray custom_export ( String path, EditorExportPlatform platform ) virtual
String expand_source_path ( String path )
String get_name ( ) virtual
String get_visible_name ( ) virtual
int import ( String path, ResourceImportMetadata from ) virtual
void import_dialog ( String from ) virtual
void import_from_drop ( StringArray files, String dest_path ) virtual
void reimport_multiple_files ( StringArray files ) virtual
String validate_source_path ( String path )


Import plugins make it easy to handle importing of external assets into a project. They way they work is not that obvious though, so please make sure to read the documentation, tutorials and examples.

Member Function Description

  • bool can_reimport_multiple_files ( ) virtual
  • RawArray custom_export ( String path, EditorExportPlatform platform ) virtual

Generally, files that are imported stay the same when exported. The only exception is in some cases when the file must be re-imported for different platforms (ie. texture compression).

If you want to customize the export process, it’s recommended to use EditorExportPlugin.custom_export instead.

Get the name of the import plugin, which will be used to identify content imported by this plugin. Try to use lowercase and underscores if possible.

  • String get_visible_name ( ) virtual

Visible name for this plugin, which will be shown on the import menu.

Perform an import of an external resources into the project. This function is both called on import (from the dialog) or re-import (manual or automatic when external source files changed).

An import process generally works like this:

  1. Check the metadata for source files and options. Metadata is either generated in the import dialog or taken from an existing resource upon reimport.
  2. Perform the import process into a new resource. Some times the resource being re-imported may be already loaded and in use, so checking for this by using ResourceLoader.has is recommended. Otherwise create a new resource.
  3. Set the metadata from the argument into the existing or new resource being created using Resource.set_import_metadata.
  4. Save the resource into ‘path’ (function argument)
  • void import_dialog ( String from ) virtual

This function is called when either the user chooses to import a resource of this type (Import menu), or when the user chooses to re-import the resource (from filesystem). In the later case, the path for the existing file is supplied in the argument.

If the path is supplied, it is recommended to read the import metadata with ResourceLoader.load_import_metadata and fill in the fields with the values contained there.

The dialog can be shown in any way (just use a ConfirmationDialog and pop it up). Upon confirmation, fill up a ResourceImportMetadata and call the EditorImportPlugin.import function with this information.

  • void reimport_multiple_files ( StringArray files ) virtual