From 0c3b215e7d5456878b155d13440864f49ad1f230 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 2 Nov 2021 11:15:05 +0100 Subject: Images: refactor how failed image load attempts are remembered Previously, `ImageTile->ok` and `ImageUser->ok` were used to indicate whether an image failed to load. There were three possible values which (probably) had the following meanings: * `0`: There was an error while loading the image. Don't try to load again. * `1`: Default value. Try to load the image. * `2`: The image was loaded successfully. This image-wide flag did not make sense unfortunately, because loading may work for some frames of an image sequence but not for others. Remember than an image data block can also contain a movie. The purpose of the `->ok` flag was to serve as an optimization to avoid trying to load a file over and over again when there is an error (e.g. the file does not exist or is invalid). To get the optimization back, the patch is changing `MovieCache` so that it can also cache failed load attempts. As a consequence, `ibuf` is allowed to be `NULL` in a few more places. I added the appropriate null checks. This also solves issues when image sequences are used with the Image Texture node in Geometry nodes (also see D12827). Differential Revision: https://developer.blender.org/D12957 --- source/blender/makesdna/DNA_image_types.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 30ca9540735..2464eb05a6d 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -51,16 +51,13 @@ typedef struct ImageUser { /** Offset within movie, start frame in global time. */ int offset, sfra; /** Cyclic flag. */ - char _pad0, cycl; - char ok; + char cycl; /** Multiview current eye - for internal use of drawing routines. */ char multiview_eye; short pass; - char _pad1[2]; int tile; - int _pad2; /** Listbase indices, for menu browsing or retrieve buffer. */ short multi_index, view, layer; @@ -112,9 +109,7 @@ typedef struct ImageTile { struct ImageTile_Runtime runtime; - char ok; - char _pad[3]; - + char _pad[4]; int tile_number; char label[64]; } ImageTile; -- cgit v1.2.3