[Bf-blender-cvs] [0896457c59d] master: Partially fix T90593: Image ID wrongly seen as changed on undos.
Bastien Montagne
noreply at git.blender.org
Thu Aug 19 18:00:06 CEST 2021
Commit: 0896457c59d722e809188517c042b57d0ea399d3
Author: Bastien Montagne
Date: Thu Aug 19 17:04:19 2021 +0200
Branches: master
https://developer.blender.org/rB0896457c59d722e809188517c042b57d0ea399d3
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.
===================================================================
M source/blender/blenkernel/intern/image.c
===================================================================
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);
}
More information about the Bf-blender-cvs
mailing list