Various situations can lead to un-saved UDIM tiles potentially losing
their contents. The most notable situation is a save and re-load of a
.blend file that has "generated" UDIM tiles that haven't been written to
disk yet. Normal "generated" images are reconstructed on demand in these
circumstances but UDIM tiles do not retain the information required for
reconstruction and empty tiles are presented to the user.
This patch stores the generated type information for each tile to solve
this particular issue.
However, in order to distinguish between a tile that should be
reconstructed vs. a tile that should remain empty because loading
failed, a new flag is used. It's usage is as follows:
- Every tile's `gen_flag` field is set to 0 on creation and when loaded from disk (historically only 1bit of this field was used for the indication of float buffers)
- Each time a tile is filled with generated content we set a new IMA_GEN_TILE flag
- Each time a tile is saved to disk we remove the IMA_GEN_TILE flag
- When requesting an ibuf: If the ibuf is null, we check to see if IMA_GEN_TILE is set. If it is set, go ahead and re-create the tile. Otherwise, do nothing.