Enabling ETC2/ASTC does not import textures in new format
Tested versions
4.3-rc1 is broken, but 4.3-beta3 works
System information
Windows 11, gl_compatibility, NVidia RTX 3070 TI
Issue description
If a new project is created and an Android export is constructed; the Android Export will pop up a warning:
On 4.3-beta3 clicking on the "Fix Imports" button pops up a small progress bar and the *.etc2.ctex files are greated in the .godot/imported folder.
On 4.3-rc1 clicking on the "Fix Imports" button does not trigger a reimport of the assets. Even quitting and reloading the projects doesn't reimport the assets in the new format. The only fix seems to be to delete the .godot folder and let everything be reimported.
An identical problem happens when enabling the ETC2/ASTC compression in the project menu. On both 4.3-beta3 and 4.3-rc1 it requests a Save-and-Restart; but only 4.3-beta3 actually imports the new formats on restart. 4.3-rc1 does no new imports and the .etc2.ctex textures do not exist.
Steps to reproduce
- Create new project - this will have only the S3TC/BPTC textures enabled.
- Add some textures.
- Observe *.s3tc.ctex textures in the .godot/imports folder
- Enable ETC2/ASTC texture format
- Allow the Save-and-Restart to occur
- Observe only *.s3tc.ctex files
- Quit to project list
- Delete .godot folder
- Reload project
- Observe the full reconstruction of the imports creates both the *.s3tc.ctex and *.etc2.ctex textures
Minimal reproduction project (MRP)
N/A
This looks to have been caused by https://github.com/godotengine/godot/pull/94357 - specifically the old code contained:
if (!ResourceFormatImporter::get_singleton()->are_import_settings_valid(p_path)) {
//reimport settings are not valid, reimport
return true;
}
This called the ResourceImporterTexture::are_import_settings_valid which makes sure all compression formats enabled by the project have been imported.
When a file is invalid/corrupted, the .import file also becomes "invalid". It gets valid=false assigned and some fields are missing. Thus there is no way to fix #62271 without ignoring the state of the import file.
This regression was caused because changing target import formats makes all .import files "invalid" and the editor relied on this to make them reimported. The only way I can think of to fix both issues is to separate the format reimports from import validity.