Fix #117411: In memory UDIMs fail to pack correctly

Broken from 72ab6faf5d

Because the `IMA_GEN_TILE` flag was not cleared during the memory pack,
the tile was regenerated on reloading. Mimic what is done during save
and clear the flag if all tiles pack successfully.

Pull Request: https://projects.blender.org/blender/blender/pulls/117472
This commit is contained in:
Jesse Yurkovich
2024-01-24 21:28:48 +01:00
committed by Jesse Yurkovich
parent 7bb78be256
commit 0c0885d323

View File

@@ -1420,9 +1420,19 @@ bool BKE_image_memorypack(Image *ima)
ima->views_format = R_IMF_VIEWS_INDIVIDUAL;
}
if (ok && ima->source == IMA_SRC_GENERATED) {
ima->source = IMA_SRC_FILE;
ima->type = IMA_TYPE_IMAGE;
/* Images which were "generated" before packing should now be
* treated as if they were saved as real files. */
if (ok) {
if (ima->source == IMA_SRC_GENERATED) {
ima->source = IMA_SRC_FILE;
ima->type = IMA_TYPE_IMAGE;
}
/* Clear the per-tile generated flag if all tiles were ok.
* Mirrors similar processing inside #BKE_image_save. */
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
tile->gen_flag &= ~IMA_GEN_TILE;
}
}
return ok;