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:
@@ -47,6 +47,7 @@
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
@@ -54,6 +55,8 @@
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
#include "DNA_nla_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
@@ -64,51 +67,49 @@
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_dynstr.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BKE_bpath.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_camera.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lamp.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_mball.h"
|
||||
#include "BKE_text.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_fcurve.h"
|
||||
#include "BKE_font.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_group.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_icons.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_world.h"
|
||||
#include "BKE_font.h"
|
||||
#include "BKE_group.h"
|
||||
#include "BKE_lamp.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_fcurve.h"
|
||||
#include "BKE_speaker.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mball.h"
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_mask.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_speaker.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_text.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
@@ -771,9 +772,10 @@ void *BKE_libblock_copy(ID *id)
|
||||
return idn;
|
||||
}
|
||||
|
||||
static void BKE_library_free(Library *UNUSED(lib))
|
||||
static void BKE_library_free(Library *lib)
|
||||
{
|
||||
/* no freeing needed for libraries yet */
|
||||
if (lib->packedfile)
|
||||
freePackedFile(lib->packedfile);
|
||||
}
|
||||
|
||||
static void (*free_windowmanager_cb)(bContext *, wmWindowManager *) = NULL;
|
||||
|
@@ -311,8 +311,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
|
||||
/* makes lookup of existing video clips in old main */
|
||||
blo_make_movieclip_pointer_map(fd, oldmain);
|
||||
|
||||
/* makes lookup of existing video clips in old main */
|
||||
blo_make_packed_pointer_map(fd, oldmain);
|
||||
/* removed packed data from this trick - it's internal data that needs saves */
|
||||
|
||||
bfd = blo_read_file_internal(fd, filename);
|
||||
|
||||
@@ -321,10 +320,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
|
||||
|
||||
/* ensures relinked movie clips are not freed */
|
||||
blo_end_movieclip_pointer_map(fd, oldmain);
|
||||
|
||||
/* ensures relinked packed data is not freed */
|
||||
blo_end_packed_pointer_map(fd, oldmain);
|
||||
|
||||
|
||||
/* move libraries from old main to new main */
|
||||
if (bfd && mainlist.first != mainlist.last) {
|
||||
|
||||
|
@@ -1439,6 +1439,8 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX disabled this feature - packed files also belong in temp saves and quit.blend, to make restore work */
|
||||
|
||||
static void insert_packedmap(FileData *fd, PackedFile *pf)
|
||||
{
|
||||
oldnewmap_insert(fd->packedmap, pf, pf, 0);
|
||||
@@ -1863,7 +1865,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p
|
||||
prv->rect[i] = newdataadr(fd, prv->rect[i]);
|
||||
}
|
||||
}
|
||||
prv->gputexture[0] = prv->gputexture[1] = NULL;
|
||||
// prv->gputexture[0] = prv->gputexture[1] = NULL;
|
||||
}
|
||||
|
||||
return prv;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user