Image: Fix non-deterministic behavior of image sequence loading

The issue was caused by usage of non-initialized image user, which
could have different settings, causing some random image being loaded
or not loaded at all.

This caused non-deterministic behavior of Cycles image loading because
it was querying image information from several places.

This fixes crash reported in T50616, but it's not a complete fix
because preview rendering in material is wrong (same wrong as in
2.78a release).
This commit is contained in:
Sergey Sharybin 2017-02-11 22:15:30 +01:00
parent 1ac6e4c7a2
commit e76364adcd
1 changed files with 6 additions and 2 deletions

View File

@ -3159,7 +3159,7 @@ static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, cons
struct ImBuf *ibuf;
char name[FILE_MAX];
int flag;
ImageUser iuser_t;
ImageUser iuser_t = {0};
/* XXX temp stuff? */
if (ima->lastframe != frame)
@ -3167,8 +3167,12 @@ static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, cons
ima->lastframe = frame;
if (iuser)
if (iuser) {
iuser_t = *iuser;
}
else {
/* TODO(sergey): Do we need to initialize something here? */
}
iuser_t.view = view_id;
BKE_image_user_file_path(&iuser_t, ima, name);