Fix T43479 animated textures lost after going to a frame before animated

frame start.

Issue here is that if we failed to get an image from the cache, we would
try to load from file. This would fail when the queried frame was less
than the animated sequence start frame, and invalidate the OK state of
the image.

Solution is that when loading from cache succeeds, we also reset the OK
state of the image for animated textures.

The fix might be relevant elsewhere too, but kept it isolated just in
case.
This commit is contained in:
Antony Riakiotakis
2015-02-26 15:10:19 +01:00
parent 13c275ce84
commit 46fe39ff31

View File

@@ -2977,6 +2977,16 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_frame,
ima->tpageflag |= IMA_TPAGE_REFRESH;
}
ima->lastframe = frame;
/* counter the fact that image is set as invalid when loading a frame
* that is not in the cache (through image_acquire_ibuf for instance),
* yet we have valid frames in the cache loaded */
if (ibuf) {
ima->ok = IMA_OK_LOADED;
if (iuser)
iuser->ok = ima->ok;
}
}
else if (ima->type == IMA_TYPE_MULTILAYER) {
frame = iuser ? iuser->framenr : ima->lastframe;