class_editorimportplugin.rst 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_EditorImportPlugin:
  4. EditorImportPlugin
  5. ==================
  6. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Import plugin for editor
  11. Member Functions
  12. ----------------
  13. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`bool<class_bool>` | :ref:`can_reimport_multiple_files<class_EditorImportPlugin_can_reimport_multiple_files>` **(** **)** virtual |
  15. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`RawArray<class_rawarray>` | :ref:`custom_export<class_EditorImportPlugin_custom_export>` **(** :ref:`String<class_string>` path, EditorExportPlatform platform **)** virtual |
  17. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`String<class_string>` | :ref:`expand_source_path<class_EditorImportPlugin_expand_source_path>` **(** :ref:`String<class_string>` path **)** |
  19. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_string>` | :ref:`get_name<class_EditorImportPlugin_get_name>` **(** **)** virtual |
  21. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`String<class_string>` | :ref:`get_visible_name<class_EditorImportPlugin_get_visible_name>` **(** **)** virtual |
  23. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`import<class_EditorImportPlugin_import>` **(** :ref:`String<class_string>` path, :ref:`ResourceImportMetadata<class_resourceimportmetadata>` from **)** virtual |
  25. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`import_dialog<class_EditorImportPlugin_import_dialog>` **(** :ref:`String<class_string>` from **)** virtual |
  27. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`import_from_drop<class_EditorImportPlugin_import_from_drop>` **(** :ref:`StringArray<class_stringarray>` files, :ref:`String<class_string>` dest_path **)** virtual |
  29. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`reimport_multiple_files<class_EditorImportPlugin_reimport_multiple_files>` **(** :ref:`StringArray<class_stringarray>` files **)** virtual |
  31. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`String<class_string>` | :ref:`validate_source_path<class_EditorImportPlugin_validate_source_path>` **(** :ref:`String<class_string>` path **)** |
  33. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. Description
  35. -----------
  36. 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.
  37. Member Function Description
  38. ---------------------------
  39. .. _class_EditorImportPlugin_can_reimport_multiple_files:
  40. - :ref:`bool<class_bool>` **can_reimport_multiple_files** **(** **)** virtual
  41. .. _class_EditorImportPlugin_custom_export:
  42. - :ref:`RawArray<class_rawarray>` **custom_export** **(** :ref:`String<class_string>` path, EditorExportPlatform platform **)** virtual
  43. 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).
  44. If you want to customize the export process, it's recommended to use :ref:`EditorExportPlugin.custom_export<class_EditorExportPlugin_custom_export>` instead.
  45. .. _class_EditorImportPlugin_expand_source_path:
  46. - :ref:`String<class_string>` **expand_source_path** **(** :ref:`String<class_string>` path **)**
  47. .. _class_EditorImportPlugin_get_name:
  48. - :ref:`String<class_string>` **get_name** **(** **)** virtual
  49. 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.
  50. .. _class_EditorImportPlugin_get_visible_name:
  51. - :ref:`String<class_string>` **get_visible_name** **(** **)** virtual
  52. Visible name for this plugin, which will be shown on the import menu.
  53. .. _class_EditorImportPlugin_import:
  54. - :ref:`int<class_int>` **import** **(** :ref:`String<class_string>` path, :ref:`ResourceImportMetadata<class_resourceimportmetadata>` from **)** virtual
  55. 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).
  56. An import process generally works like this:
  57. 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.
  58. 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 :ref:`ResourceLoader.has<class_ResourceLoader_has>` is recommended. Otherwise create a new resource.
  59. 3) Set the metadata from the argument into the existing or new resource being created using :ref:`Resource.set_import_metadata<class_Resource_set_import_metadata>`.
  60. 4) Save the resource into 'path' (function argument)
  61. .. _class_EditorImportPlugin_import_dialog:
  62. - void **import_dialog** **(** :ref:`String<class_string>` from **)** virtual
  63. 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.
  64. If the path is supplied, it is recommended to read the import metadata with :ref:`ResourceLoader.load_import_metadata<class_ResourceLoader_load_import_metadata>` and fill in the fields with the values contained there.
  65. 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 :ref:`EditorImportPlugin.import<class_EditorImportPlugin_import>` function with this information.
  66. .. _class_EditorImportPlugin_import_from_drop:
  67. - void **import_from_drop** **(** :ref:`StringArray<class_stringarray>` files, :ref:`String<class_string>` dest_path **)** virtual
  68. .. _class_EditorImportPlugin_reimport_multiple_files:
  69. - void **reimport_multiple_files** **(** :ref:`StringArray<class_stringarray>` files **)** virtual
  70. .. _class_EditorImportPlugin_validate_source_path:
  71. - :ref:`String<class_string>` **validate_source_path** **(** :ref:`String<class_string>` path **)**