Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-05-26 12:43:50 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-05-26 12:46:05 +0300
commite5fbeba0b3a6e9eea4a8747e97033bbd0d7f017b (patch)
treeea11d2a4f2e1c99a992927e95b196f0048a9cac8 /source/blender
parent569a2035c7e450fd32c046768e045964a159a02b (diff)
Images: Solve broken forward compatibility with packed images
Use first packed image as legacy image->packedfile, so saving .blend file with latest builds makes it so packed images are not lost when opening with previous releases. This will only work reliably if mutliview is not used, otherwise it'll be only first view in the .blend file, which is rather expected since previous releases are not aware of views.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/readfile.c6
-rw-r--r--source/blender/blenloader/intern/writefile.c9
-rw-r--r--source/blender/makesdna/DNA_image_types.h2
3 files changed, 11 insertions, 6 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;
}
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index da5eee07e52..0e2a41a0aeb 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -115,7 +115,7 @@ typedef struct Image {
unsigned int bindcode; /* only for current image... */
unsigned int *repbind; /* for repeat of parts of images */
- struct PackedFile *packedfile; /* deprecated */
+ struct PackedFile *packedfile DNA_DEPRECATED; /* deprecated */
struct ListBase packedfiles;
struct PreviewImage *preview;