EditorImportPlugin

    Registers a custom resource importer in the editor. Use the class to parse any file and import it as a new resource type.

    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 and 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 .import directory (see ).

    Below is an example EditorImportPlugin that imports a Mesh from a file with the extension “.special” or “.spec”:

    To use EditorImportPlugin, register it using the method first.

    • Array get_import_options ( preset ) virtual

    Gets the options and default values for the preset at this index. Returns an Array of Dictionaries with the following keys: name, default_value, property_hint (optional), hint_string (optional), usage (optional).


    • int get_import_order ( ) virtual

    Gets the order of this importer to be run when importing resources. Importers with lower import orders will be called first, and higher values will be called later. Use this to ensure the importer runs after the dependencies are already imported. The default import order is unless overridden by a specific importer. See for some predefined values.


    Gets the unique name of the importer.


    This method can be overridden to hide specific import options if conditions are met. This is mainly useful for hiding options that depend on others if one of them is disabled. For example:

    1. func get_option_visibility(option, options):
    2. # Only show the lossy quality setting if the compression mode is set to "Lossy".
    3. if option == "compress/lossy_quality" and options.has("compress/mode"):
    4. return int(options["compress/mode"]) == COMPRESS_LOSSY
    5. return true

    Return true to make all options always visible.


    Gets the number of initial presets defined by the plugin. Use to get the default options for the preset and get_preset_name to get the name of the preset.


    • get_preset_name ( int preset ) virtual

    Gets the name of the options preset at this index.


    • get_priority ( ) virtual

    Gets the priority of this plugin for the recognized extension. Higher priority plugins will be preferred. The default priority is .


    • Array get_recognized_extensions ( ) virtual

    Gets the list of file extensions to associate with this loader (case-insensitive). e.g. ["obj"].


    • get_resource_type ( ) virtual

    Gets the Godot resource type associated with this loader. e.g. "Mesh" or "Animation".


    • String get_save_extension ( ) virtual

    Gets the extension used to save this resource in the .import directory (see ).


    • String get_visible_name ( ) virtual

    Gets the name to display in the import window. You should choose this name as a continuation to “Import as”, e.g. “Import as Special Mesh”.


    • import ( String source_file, save_path, Dictionary options, platform_variants, Array gen_files ) virtual

    This method must be overridden to do the actual importing work. See this class’ description for an example of overriding this method.