godot icon indicating copy to clipboard operation
godot copied to clipboard

Enabling ETC2/ASTC does not import textures in new format

Open Malcolmnixon opened this issue 1 year ago • 1 comments

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:

image

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

  1. Create new project - this will have only the S3TC/BPTC textures enabled.
  2. Add some textures.
  3. Observe *.s3tc.ctex textures in the .godot/imports folder
  4. Enable ETC2/ASTC texture format
  5. Allow the Save-and-Restart to occur
  6. Observe only *.s3tc.ctex files
  7. Quit to project list
  8. Delete .godot folder
  9. Reload project
  10. Observe the full reconstruction of the imports creates both the *.s3tc.ctex and *.etc2.ctex textures

Minimal reproduction project (MRP)

N/A

Malcolmnixon avatar Jul 28 '24 19:07 Malcolmnixon

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.

Malcolmnixon avatar Jul 28 '24 21:07 Malcolmnixon

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.

KoBeWi avatar Jul 29 '24 11:07 KoBeWi