0 votes

Question: Is there any way to avoid working directory clutter with "*.import" files?

Context

When a PNG file is moved into the project, *.import file is generated.

There is also a ".import" folder inside the project root, but since it's hidden and it's separate from my files, I'm OK with it. What bothers me though is having auto-generated files near the files that I've added manually.

There is not much info on these files available. So far I only found this:
https://docs.godotengine.org/en/stable/getting_started/workflow/assets/import_process.html

I also found this issue, but I'm not sure if it's about *.import files outside of the .import folder or about a ".import" folder itself:
https://github.com/godotengine/godot/issues/24177
Update: https://github.com/godotengine/godot/issues/24177#issuecomment-446327640
It seems like some *.import files are stored inside ".import" folder now?

I also wonder why it's necessary to store these files outside of the hidden engine-related folders?

asked May 25 in Engine by Iskander (Alex) Shar (12 points)

1 Answer

0 votes

Because those files actually store information that are useful to your project. For example if you want a particular PNG to be imported with mipmaps, smooth filter, or pixel-art filter, sRGB etc, or even not import it as Texture but as Image or TextureArray instead, this is where the info goes. These files must then be in your project, and you should version them if you use VCS.
They get "auto-generated" to contain the default settings, but you may want to change them as well, per file. That data has to go somewhere, and should not be forgotten about.

The idea behind https://github.com/godotengine/godot/issues/24177 is NOT to get rid of these files, only to not put them next to project files if you did not change any default values. However it creates new issues and you will still have some .import files next to customized resources so it's not yet decided if that's a good idea or not.

The .import folder, on the other hand, is auto generated but only contains calculated data. It acts like a resource cache so the editor doesn't have to re-import everything each time you open it. It's fine to delete it and not version it, because the editor can regenerate it with no more info than what can be found in the project.

answered May 25 by Zylann (26,157 points)
edited May 25 by Zylann

This doesn't answer my question though.

I understand that these files are needed by the engine.

There is no technical reason to store them right next to my files. I'm new to the Godot, but suppose all of them are stored in some directory D (the exact name doesn't matter much). That directory D can either store a mapping file + have a flat structure or it can mimic the root folder structure and place import files there:

project/assets/foo.png
=>
project/D/assets/foo.import

So, it's still possible to find/edit that file either by hand or through the Godot Editor (which is probably the correct way to do it).

There is no technical reason to store them right next to my files

To not forget them, and avoid bookeeping complexity (both for the editor, or for you if you move those files from elsewhere). But I see your point, they could somehow be placed somewhere else, if the editor keeps a mapping of how to find them I guess? You could make a proposal to have that sort of option maybe.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.