Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-08-19 18:04:19 +0300
committerBastien Montagne <bastien@blender.org>2021-08-19 19:00:00 +0300
commit0896457c59d722e809188517c042b57d0ea399d3 (patch)
tree43104e1f536598459e257dbbaa2cb3e9b2a41cd6
parent214e4aac976962b7da5ebcbbab119acc60b1a654 (diff)
Partially fix T90593: Image ID wrongly seen as changed on undos.
Several pure runtime data in this ID type were not properly cleared by write/read processes. Note that the initial undo step (the one leading back to initial read file state) is still forcing re-load of image, for some reasons. Common investigation together with Jeroen Bakker (@jbakker), thanks. See also D12242.
-rw-r--r--source/blender/blenkernel/intern/image.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index de9f2a5a656..f37073ff135 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -230,6 +230,19 @@ static void image_blend_write(BlendWriter *writer, ID *id, const void *id_addres
Image *ima = (Image *)id;
const bool is_undo = BLO_write_is_undo(writer);
+ /* Clear all data that isn't read to reduce false detection of changed image during memfile undo.
+ */
+ ima->lastused = 0;
+ ima->cache = NULL;
+ ima->gpuflag = 0;
+ BLI_listbase_clear(&ima->anims);
+ BLI_listbase_clear(&ima->gpu_refresh_areas);
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 2; j++) {
+ ima->gputexture[i][j] = NULL;
+ }
+ }
+
ImagePackedFile *imapf;
BLI_assert(ima->packedfile == NULL);
@@ -299,6 +312,7 @@ static void image_blend_read_data(BlendDataReader *reader, ID *id)
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
tile->ok = IMA_OK;
}
+ ima->lastused = 0;
ima->gpuflag = 0;
BLI_listbase_clear(&ima->gpu_refresh_areas);
}