godot icon indicating copy to clipboard operation
godot copied to clipboard

[3.x] Fix "Changing .import file externally doesn't trigger asset reimport"

Open turbohz opened this issue 2 years ago • 4 comments

This is an attempt to fix https://github.com/godotengine/godot/issues/60730.

I don't use Godot 4 at the moment, but seems easily portable.

The proposed approach is simple: store the md5 hash of the .import file, along with the original and imported file hashes.

When the time comes to check for the need to re-import, check that too. If we don't find that hash, re-import (which essentially migrates the .md5 file to support the new behavior).

turbohz avatar Nov 18 '23 18:11 turbohz

I found a small issue: if you change the .import file externally, on focusing the editor, the asset will be re-imported, but the Import inspector for the asset won't be updated (if open).

turbohz avatar Nov 18 '23 19:11 turbohz

To be clear is this sufficient to test?

Steps to reproduce

  1. Open icon.png.import
  2. Change e.g. repeat to true
  3. Switch to editor
  4. No reimport
  5. Your texture doesn't repeat
  6. Your texture doesn't repeat in exported project

fire avatar Nov 19 '23 20:11 fire

Thanks for looking at this.

To be clear is this sufficient to test?

That's how I tested it, yes (I changed the process/invert_color property instead, because it's easier to see the change).

Additionally, opening an "old" project should cause a full asset re-import, that should happen only once.

turbohz avatar Nov 20 '23 08:11 turbohz

It's worth noting that there's a different proposed fix open for review.

https://github.com/godotengine/godot/pull/84974

turbohz avatar Nov 20 '23 08:11 turbohz