diff options
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c736e54c4e9..a22e882937c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1536,9 +1536,6 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain) for (ima = oldmain->image.first; ima; ima = ima->id.next) { ImagePackedFile *imapf; - if (ima->packedfile) - insert_packedmap(fd, ima->packedfile); - for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) if (imapf->packedfile) insert_packedmap(fd, imapf->packedfile); @@ -1577,8 +1574,6 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) for (ima = oldmain->image.first; ima; ima = ima->id.next) { ImagePackedFile *imapf; - ima->packedfile = newpackedadr(fd, ima->packedfile); - for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) imapf->packedfile = newpackedadr(fd, imapf->packedfile); } @@ -3437,6 +3432,7 @@ static void direct_link_image(FileData *fd, Image *ima) link_list(fd, &(ima->views)); link_list(fd, &(ima->packedfiles)); + ima->packedfile = NULL; for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { imapf->packedfile = direct_link_packedfile(fd, imapf->packedfile); } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 43f9fcce76d..fc464714edc 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2161,6 +2161,13 @@ static void write_images(WriteData *wd, ListBase *idbase) ima= idbase->first; while (ima) { if (ima->id.us>0 || wd->current) { + /* Some trickery to keep forward compatibility of packed images. */ + BLI_assert(ima->packedfile == NULL); + if (ima->packedfiles.first != NULL) { + imapf = ima->packedfiles.first; + ima->packedfile = imapf->packedfile; + } + /* write LibData */ writestruct(wd, ID_IM, "Image", 1, ima); if (ima->id.properties) IDP_WriteProperty(ima->id.properties, wd); @@ -2179,6 +2186,8 @@ static void write_images(WriteData *wd, ListBase *idbase) for (iv = ima->views.first; iv; iv = iv->next) writestruct(wd, DATA, "ImageView", 1, iv); writestruct(wd, DATA, "Stereo3dFormat", 1, ima->stereo3d_format); + + ima->packedfile = NULL; } ima= ima->id.next; } |