import_process.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. .. _doc_import_process:
  2. Import process
  3. ==============
  4. Importing assets in Godot 3.0+
  5. ------------------------------
  6. Previously, importing assets in Godot 2.x required manual maintenance
  7. of a separate directory with source assets. Without doing this, it was
  8. impossible to specify how to convert and change import flags for
  9. textures, audio files, scenes, etc.
  10. In Godot 3.0+, we use a more modern approach to importing: Simply drop
  11. your assets (image files, scenes, audio files, fonts, etc) directly in the
  12. project folder (copy them manually with your OS file explorer).
  13. Godot will automatically import these files internally
  14. and keep the imported resources hidden in a ``res://.import`` folder.
  15. This means that when trying to access imported assets through code you
  16. need to use the :ref:`Resource Loader<class_ResourceLoader>` as it will
  17. automatically take into account where the internal files are saved. If you
  18. try and access an imported asset using the :ref:`File <class_File>` class
  19. it will work in the editor, but break in the exported project.
  20. However, the :ref:`Resource Loader<class_ResourceLoader>` cannot access
  21. non imported files, only the :ref:`File <class_File>` class can.
  22. Changing import parameters
  23. --------------------------
  24. To change the import parameters of an asset in Godot (again, keep in mind
  25. import parameters are only present in non-native Godot resource types)
  26. select the relevant resource in the filesystem dock:
  27. .. image:: img/asset_workflow1.png
  28. Then, after adjusting the parameters, press "Reimport". These parameters
  29. will only be used for this asset and on future reimports.
  30. Changing the import parameters of several assets at the same time is also
  31. possible. Simply select all of them together in the resources dock and the
  32. exposed parameters will apply to all of them when reimporting.
  33. Reimporting multiple assets
  34. ---------------------------
  35. While working on a project you may find that several assets need to have
  36. the same parameters changed, such as enabling mipmaps, but you only want
  37. those specific parameters changed. To do this, select every asset you want
  38. to reimport in the file system. In the import tab there will now be a
  39. checkbox to the left of every import parameter.
  40. .. image:: img/reimport_multiple.png
  41. Select the checkbox of the parameters you want to change on your imported
  42. assets, then change the parameters normally. Finally, click the reimport
  43. button and every selected asset will be reimported with only those
  44. parameters changed.
  45. Automatic reimport
  46. ------------------
  47. When the MD5 checksum of the source asset changes, Godot will perform an
  48. automatic reimport of it, applying the preset configured for that specific
  49. asset.
  50. Files generated
  51. -----------------
  52. Importing will add an extra ``<asset>.import`` file, containing the import
  53. configuration. Make sure to commit these to your version control system!
  54. .. image:: img/asset_workflow4.png
  55. Additionally, extra assets will be preset in the hidden ``res://.import`` folder:
  56. .. image:: img/asset_workflow5.png
  57. If any of the files present in this folder is erased (or the whole folder), the
  58. asset or assets will be reimported automatically. As such, committing this folder
  59. to the version control system is optional. It can shorten
  60. reimporting time when checking out on another computer, but it takes considerably
  61. more space and transfer time. Pick your poison!
  62. Changing import resource type
  63. -----------------------------
  64. Some source assets can be imported as different types of resources.
  65. For this, select the relevant type of resource desired and
  66. press "Reimport":
  67. .. image:: img/asset_workflow2.png
  68. Changing default import parameters
  69. -----------------------------------
  70. Different types of games might require different defaults.
  71. Changing the defaults per project can be achieved by using the
  72. "Preset.." Menu. Besides some resource types offering presets,
  73. the default setting can be saved and cleared too:
  74. .. image:: img/asset_workflow3.png
  75. Simplicity is key!
  76. ------------------
  77. This is a very simple workflow which should take very little time to get used to. It also enforces a more
  78. correct way to deal with resources.
  79. There are many types of assets available for import, so please continue reading to understand how to work
  80. with all of them!