|
3 | 3 | Import process
|
4 | 4 | ==============
|
5 | 5 |
|
6 |
| -Importing assets in Godot 3.0+ |
7 |
| ------------------------------- |
| 6 | +Importing assets in Godot |
| 7 | +------------------------- |
8 | 8 |
|
9 |
| -Previously, importing assets in Godot 2.x required manual maintenance |
10 |
| -of a separate directory with source assets. Without doing this, it was |
11 |
| -impossible to specify how to convert and change import flags for |
12 |
| -textures, audio files, scenes, etc. |
| 9 | +To import assets in Godot, place your assets (image files, scenes, audio |
| 10 | +files, fonts, etc) directly in the project folder. There are 2 ways to achieve this: |
13 | 11 |
|
14 |
| -In Godot 3.0+, we use a more modern approach to importing: Simply drop |
15 |
| -your assets (image files, scenes, audio files, fonts, etc) directly in the |
16 |
| -project folder (copy them manually with your OS file explorer). |
17 |
| -Godot will automatically import these files internally |
18 |
| -and keep the imported resources hidden in a ``res://.import`` folder. |
| 12 | +- **For any file type:** Copy files manually with your operating system's file manager. |
| 13 | +- **For file types that can be imported by Godot:** |
| 14 | + Drag-and-drop files from the operating system's file manager to the editor's FileSystem dock. |
| 15 | + This only works with *resource* file types (i.e. file types that Godot can import). |
19 | 16 |
|
20 |
| -This means that when trying to access imported assets through code you |
| 17 | +Godot will automatically import these files internally and keep the imported |
| 18 | +resources hidden in a ``res://.godot/imported/`` folder. |
| 19 | + |
| 20 | +This means that when trying to access imported assets through code, you |
21 | 21 | need to use the :ref:`Resource Loader<class_ResourceLoader>` as it will
|
22 | 22 | automatically take into account where the internal files are saved. If you
|
23 |
| -try and access an imported asset using the :ref:`FileAccess <class_FileAccess>` class |
24 |
| -it will work in the editor, but break in the exported project. |
| 23 | +try and access an imported asset using the :ref:`FileAccess <class_FileAccess>` class, |
| 24 | +it will work in the editor, but **it will break in the exported project**. |
25 | 25 |
|
26 | 26 | However, the :ref:`Resource Loader<class_ResourceLoader>` cannot access
|
27 |
| -non imported files, only the :ref:`FileAccess <class_FileAccess>` class can. |
| 27 | +non-imported files. Only the :ref:`FileAccess <class_FileAccess>` class can. |
28 | 28 |
|
29 | 29 | Changing import parameters
|
30 | 30 | --------------------------
|
31 | 31 |
|
32 |
| -To change the import parameters of an asset in Godot (again, keep in mind |
33 |
| -import parameters are only present in non-native Godot resource types) |
34 |
| -select the relevant resource in the filesystem dock: |
| 32 | +.. note:: |
| 33 | + |
| 34 | + Import parameters are only present in *non-native* Godot resource types. |
| 35 | + This means Godot's own scene and resource file formats (``.tscn``, ``.scn``, |
| 36 | + ``.tres``, ``.res``) don't have import options you can select in the Import |
| 37 | + dock. |
| 38 | + |
| 39 | +To change the import parameters of an asset in Godot, select the relevant |
| 40 | +resource in the FileSystem dock: |
35 | 41 |
|
36 |
| -.. image:: img/asset_workflow1.png |
| 42 | +.. image:: img/import_process_example.webp |
37 | 43 |
|
38 |
| -Then, after adjusting the parameters, press "Reimport". These parameters |
39 |
| -will only be used for this asset and on future reimports. |
| 44 | +After adjusting the parameters, click **Reimport**. Be careful: if you select |
| 45 | +another file in the FileSystem dock before clicking **Reimport**, changes will |
| 46 | +be discarded. After clicking **Reimport**, the chosen parameters will only be |
| 47 | +used for this asset and on future reimports. |
40 | 48 |
|
41 | 49 | Changing the import parameters of several assets at the same time is also
|
42 | 50 | possible. Simply select all of them together in the resources dock and the
|
@@ -66,48 +74,77 @@ automatic reimport of it, applying the preset configured for that specific
|
66 | 74 | asset.
|
67 | 75 |
|
68 | 76 | Files generated
|
69 |
| ------------------ |
| 77 | +--------------- |
| 78 | + |
| 79 | +Importing will add an extra ``<asset>.import`` file next to the source file, |
| 80 | +containing the import configuration. |
| 81 | + |
| 82 | +**Make sure to commit these files to your version control system**, as these |
| 83 | +files contain important metadata. |
| 84 | + |
| 85 | +:: |
70 | 86 |
|
71 |
| -Importing will add an extra ``<asset>.import`` file, containing the import |
72 |
| -configuration. Make sure to commit these to your version control system! |
| 87 | + $ ls |
| 88 | + example.png |
| 89 | + example.png.import |
| 90 | + project.godot |
73 | 91 |
|
74 |
| -.. image:: img/asset_workflow4.png |
| 92 | +Additionally, extra assets will be preset in the hidden |
| 93 | +``res://.godot/imported/`` folder: |
75 | 94 |
|
76 |
| -Additionally, extra assets will be preset in the hidden ``res://.import`` folder: |
| 95 | +:: |
77 | 96 |
|
78 |
| -.. image:: img/asset_workflow5.png |
| 97 | + $ ls .godot/imported |
| 98 | + example.png-218a8f2b3041327d8a5756f3a245f83b.ctex |
| 99 | + example.png-218a8f2b3041327d8a5756f3a245f83b.md5 |
79 | 100 |
|
80 | 101 | If any of the files present in this folder is erased (or the whole folder), the
|
81 |
| -asset or assets will be reimported automatically. As such, committing this folder |
82 |
| -to the version control system is optional. It can shorten |
83 |
| -reimporting time when checking out on another computer, but it takes considerably |
84 |
| -more space and transfer time. Pick your poison! |
| 102 | +asset or assets will be reimported automatically. As such, committing the |
| 103 | +``.godot/`` folder to the version control system is not recommended. While |
| 104 | +committing this folder can shorten reimporting time when checking out on another |
| 105 | +computer, it requires considerably more space and bandwidth. |
| 106 | + |
| 107 | +The default version control metadata that can be generated on project creation |
| 108 | +will automatically ignore the ``.godot/`` folder. |
85 | 109 |
|
86 | 110 | Changing import resource type
|
87 | 111 | -----------------------------
|
88 | 112 |
|
89 |
| -Some source assets can be imported as different types of resources. |
90 |
| -For this, select the relevant type of resource desired and |
91 |
| -press "Reimport": |
| 113 | +Some source assets can be imported as different types of resources. For this, |
| 114 | +select the relevant type of resource desired then click **Reimport**: |
| 115 | + |
| 116 | +.. image:: img/import_process_changing_import_type.webp |
92 | 117 |
|
93 |
| -.. image:: img/asset_workflow2.png |
| 118 | +.. note:: |
94 | 119 |
|
| 120 | + For technical reasons, the editor must be restarted after changing an import |
| 121 | + type in the Import dock. |
95 | 122 |
|
96 | 123 | Changing default import parameters
|
97 |
| ------------------------------------ |
| 124 | +---------------------------------- |
98 | 125 |
|
99 |
| -Different types of games might require different defaults. |
100 |
| -Changing the defaults per project can be achieved by using the |
101 |
| -"Preset.." Menu. Besides some resource types offering presets, |
102 |
| -the default setting can be saved and cleared too: |
| 126 | +Different types of projects might require different defaults. Changing the import |
| 127 | +options to a predefined set of options can be achieved by using the |
| 128 | +**Preset...** Menu. Besides some resource types offering presets, the default |
| 129 | +settings can be saved and cleared too: |
103 | 130 |
|
104 |
| -.. image:: img/asset_workflow3.png |
| 131 | +.. image:: img/import_process_change_preset.webp |
105 | 132 |
|
106 |
| -Simplicity is key! |
107 |
| ------------------- |
| 133 | +The default import parameters for a given resource type can be changed |
| 134 | +project-wide using the **Import Defaults** tab of the Project Settings dialog: |
| 135 | + |
| 136 | +.. image:: img/import_process_import_defaults.webp |
| 137 | + |
| 138 | +Further reading |
| 139 | +--------------- |
| 140 | + |
| 141 | +This workflow takes a little time to get used to, but it enforces a more correct |
| 142 | +way to deal with resources. |
108 | 143 |
|
109 |
| -This workflow is aimed to be simple and take very little time to get used to. It also enforces a more |
110 |
| -correct way to deal with resources. |
| 144 | +There are many types of assets available for import. Continue reading to |
| 145 | +understand how to work with all of them: |
111 | 146 |
|
112 |
| -There are many types of assets available for import, so please continue reading to understand how to work |
113 |
| -with all of them! |
| 147 | +- :ref:`doc_importing_images` |
| 148 | +- :ref:`doc_importing_audio_samples` |
| 149 | +- :ref:`doc_importing_3d_scenes` |
| 150 | +- :ref:`doc_importing_translations` |
0 commit comments