[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53763] trunk/blender/source/blender: Three fixes;

Ton Roosendaal ton at blender.org
Sun Jan 13 13:26:01 CET 2013


Revision: 53763
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53763
Author:   ton
Date:     2013-01-13 12:25:56 +0000 (Sun, 13 Jan 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/library.c
    trunk/blender/source/blender/blenloader/intern/readblenentry.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c

Modified: trunk/blender/source/blender/blenkernel/intern/library.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/library.c	2013-01-13 11:31:01 UTC (rev 53762)
+++ trunk/blender/source/blender/blenkernel/intern/library.c	2013-01-13 12:25:56 UTC (rev 53763)
@@ -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_curve.h"
+#include "BKE_fcurve.h"
+#include "BKE_font.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_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_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_brush.h"
-#include "BKE_idprop.h"
+#include "BKE_object.h"
 #include "BKE_particle.h"
-#include "BKE_gpencil.h"
-#include "BKE_fcurve.h"
+#include "BKE_packedFile.h"
 #include "BKE_speaker.h"
-#include "BKE_movieclip.h"
-#include "BKE_mask.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 @@
 	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;

Modified: trunk/blender/source/blender/blenloader/intern/readblenentry.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readblenentry.c	2013-01-13 11:31:01 UTC (rev 53762)
+++ trunk/blender/source/blender/blenloader/intern/readblenentry.c	2013-01-13 12:25:56 UTC (rev 53763)
@@ -311,8 +311,7 @@
 		/* 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 @@
 		
 		/* 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) {
 			

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2013-01-13 11:31:01 UTC (rev 53762)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2013-01-13 12:25:56 UTC (rev 53763)
@@ -1439,6 +1439,8 @@
 	}
 }
 
+/* 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 @@
 				prv->rect[i] = newdataadr(fd, prv->rect[i]);
 			}
 		}
-		prv->gputexture[0] = prv->gputexture[1] = NULL;
+//		prv->gputexture[0] = prv->gputexture[1] = NULL;
 	}
 	
 	return prv;

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c	2013-01-13 11:31:01 UTC (rev 53762)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c	2013-01-13 12:25:56 UTC (rev 53763)
@@ -1512,7 +1512,7 @@
 
 			/* 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 @@
 			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 @@
 			}
 		}
 		
+		/* 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 @@
 			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);




More information about the Bf-blender-cvs mailing list