Three fixes;

- Previous commit had a line of code of WIP project in it... tss

- Packed Library data was not freed

- Removed recent (post 2.65a) code to exclude packed data from Undo system.
  It's internal data thats part of file spec, errors happen for example on
  restoring quit.blend or temp saves.
This commit is contained in:
2013-01-13 12:25:56 +00:00
parent 6e990de9b0
commit ef5a41a89d
4 changed files with 46 additions and 42 deletions

View File

@@ -1512,7 +1512,7 @@ static void write_vfonts(WriteData *wd, ListBase *idbase)
/* direct data */
if (vf->packedfile && !wd->current) {
if (vf->packedfile) {
pf = vf->packedfile;
writestruct(wd, DATA, "PackedFile", 1, pf);
writedata(wd, DATA, pf->size, pf->data);
@@ -1962,7 +1962,7 @@ static void write_images(WriteData *wd, ListBase *idbase)
writestruct(wd, ID_IM, "Image", 1, ima);
if (ima->id.properties) IDP_WriteProperty(ima->id.properties, wd);
if (ima->packedfile && !wd->current) {
if (ima->packedfile) {
pf = ima->packedfile;
writestruct(wd, DATA, "PackedFile", 1, pf);
writedata(wd, DATA, pf->size, pf->data);
@@ -2554,14 +2554,18 @@ static void write_libraries(WriteData *wd, Main *main)
}
}
/* to be able to restore quit.blend and temp saves, the packed blend has to be in undo buffers... */
/* XXX needs rethink, just like save UI in undo files now - would be nice to append things only for the]
quit.blend and temp saves */
if (foundone) {
writestruct(wd, ID_LI, "Library", 1, main->curlib);
if (main->curlib->packedfile && !wd->current) {
if (main->curlib->packedfile) {
PackedFile *pf = main->curlib->packedfile;
writestruct(wd, DATA, "PackedFile", 1, pf);
writedata(wd, DATA, pf->size, pf->data);
printf("write packed .blend: %s\n", main->curlib->name);
if (wd->current == NULL)
printf("write packed .blend: %s\n", main->curlib->name);
}
while (a--) {
@@ -2692,7 +2696,7 @@ static void write_sounds(WriteData *wd, ListBase *idbase)
writestruct(wd, ID_SO, "bSound", 1, sound);
if (sound->id.properties) IDP_WriteProperty(sound->id.properties, wd);
if (sound->packedfile && !wd->current) {
if (sound->packedfile) {
pf = sound->packedfile;
writestruct(wd, DATA, "PackedFile", 1, pf);
writedata(wd, DATA, pf->size, pf->data);