Fix T44894: Round two.

We cannot `direct_link_packedfile()` twice on a same address, because this tries to
map again pf->data address, which leads to nothing (NULL).

So now, since `ima->packedfile` and `ima->packedfiles` are mutually exclusive
in 'live' blender data anyway, we either read one or the other.

Tested from/to official 2.74 and current master, everything looks fine now.
This commit is contained in:
Bastien Montagne 2015-06-01 13:09:45 +02:00
parent c8711b6f6f
commit 1fc6563917
Notes: blender-bot 2023-02-14 09:03:52 +01:00
Referenced by issue #44894, Packed textures (images) aren't recognized anymore on master build.
1 changed files with 9 additions and 4 deletions

View File

@ -1996,7 +1996,7 @@ static void direct_link_script(FileData *UNUSED(fd), Script *script)
static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf)
{
PackedFile *pf = newpackedadr(fd, oldpf);
if (pf) {
pf->data = newpackedadr(fd, pf->data);
}
@ -3439,12 +3439,17 @@ static void direct_link_image(FileData *fd, Image *ima)
link_list(fd, &(ima->views));
link_list(fd, &(ima->packedfiles));
for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) {
imapf->packedfile = direct_link_packedfile(fd, imapf->packedfile);
if (ima->packedfiles.first) {
for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) {
imapf->packedfile = direct_link_packedfile(fd, imapf->packedfile);
}
ima->packedfile = NULL;
}
else {
ima->packedfile = direct_link_packedfile(fd, ima->packedfile);
}
ima->anims.first = ima->anims.last = NULL;
ima->packedfile = direct_link_packedfile(fd, ima->packedfile);
ima->preview = direct_link_preview_image(fd, ima->preview);
ima->stereo3d_format = newdataadr(fd, ima->stereo3d_format);
ima->ok = 1;