[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13113] trunk/blender: Split guardedalloc print into 2 funcs, 1 that prints on errors, another then prints the memory blocks as a python dict, minor changes to help text

Campbell Barton ideasman42 at gmail.com
Thu Jan 3 15:53:44 CET 2008


Revision: 13113
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13113
Author:   campbellbarton
Date:     2008-01-03 15:53:44 +0100 (Thu, 03 Jan 2008)

Log Message:
-----------
Split guardedalloc print into 2 funcs, 1 that prints on errors, another then prints the memory blocks as a python dict, minor changes to help text

Modified Paths:
--------------
    trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
    trunk/blender/intern/guardedalloc/intern/mallocn.c
    trunk/blender/source/blender/src/editscreen.c
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
===================================================================
--- trunk/blender/intern/guardedalloc/MEM_guardedalloc.h	2008-01-03 12:45:56 UTC (rev 13112)
+++ trunk/blender/intern/guardedalloc/MEM_guardedalloc.h	2008-01-03 14:53:44 UTC (rev 13113)
@@ -100,9 +100,13 @@
 	void *MEM_mapallocN(unsigned int len, const char * str);
 
 	/** Print a list of the names and sizes of all allocated memory
+	 * blocks. as a python dict for easy investigation */ 
+	void MEM_printmemlist_pydict(void);
+
+	/** Print a list of the names and sizes of all allocated memory
 	 * blocks. */ 
 	void MEM_printmemlist(void);
-
+	
 	/** Set the callback function for error output. */
 	void MEM_set_error_callback(void (*func)(char *));
 

Modified: trunk/blender/intern/guardedalloc/intern/mallocn.c
===================================================================
--- trunk/blender/intern/guardedalloc/intern/mallocn.c	2008-01-03 12:45:56 UTC (rev 13112)
+++ trunk/blender/intern/guardedalloc/intern/mallocn.c	2008-01-03 14:53:44 UTC (rev 13113)
@@ -334,7 +334,7 @@
 
 
 /* Prints in python syntax for easy */
-void MEM_printmemlist()
+static void MEM_printmemlist_internal( int pydict )
 {
 	MemHead *membl;
 
@@ -343,16 +343,23 @@
 	membl = membase->first;
 	if (membl) membl = MEMNEXT(membl);
 	
-	print_error("# membase_debug.py\n");
-	print_error("membase = [\\\n");
+	if (pydict) {
+		print_error("# membase_debug.py\n");
+		print_error("membase = [\\\n");
+	}
 	while(membl) {
-		fprintf(stderr, "{'len':%i, 'name':'''%s''', 'pointer':'%p'},\\\n", membl->len, membl->name, membl+1);
+		if (pydict) {
+			fprintf(stderr, "{'len':%i, 'name':'''%s''', 'pointer':'%p'},\\\n", membl->len, membl->name, membl+1);
+		} else {
+			print_error("%s len: %d %p\n",membl->name,membl->len, membl+1);
+		}
 		if(membl->next)
 			membl= MEMNEXT(membl->next);
 		else break;
 	}
-	fprintf(stderr, "]\n\n");
-	fprintf(stderr,
+	if (pydict) {
+		fprintf(stderr, "]\n\n");
+		fprintf(stderr,
 "mb_userinfo = {}\n"
 "totmem = 0\n"
 "for mb_item in membase:\n"
@@ -367,11 +374,19 @@
 "\tmb_userinfo_sort.sort(key = sort_func)\n"
 "\tfor item in mb_userinfo_sort:\n"
 "\t\tprint 'name:%%s, users:%%i, len:%%i' %% (item[0], item[1][0], item[1][1])\n"
-	);
+		);
+	}
 	
 	mem_unlock_thread();
 }
 
+void MEM_printmemlist( void ) {
+	MEM_printmemlist_internal(0);
+}
+void MEM_printmemlist_pydict( void ) {
+	MEM_printmemlist_internal(1);
+}
+
 short MEM_freeN(void *vmemh)		/* anders compileertie niet meer */
 {
 	short error = 0;

Modified: trunk/blender/source/blender/src/editscreen.c
===================================================================
--- trunk/blender/source/blender/src/editscreen.c	2008-01-03 12:45:56 UTC (rev 13112)
+++ trunk/blender/source/blender/src/editscreen.c	2008-01-03 14:53:44 UTC (rev 13113)
@@ -1399,7 +1399,7 @@
 		else if (event==QKEY) {
 			/* Temp place to print mem debugging info ctrl+alt+shift + qkey */
 			if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
-				MEM_printmemlist();
+				MEM_printmemlist_pydict();
 			}
 			
 			else if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2008-01-03 12:45:56 UTC (rev 13112)
+++ trunk/blender/source/creator/creator.c	2008-01-03 14:53:44 UTC (rev 13113)
@@ -176,8 +176,10 @@
 	printf ("  ...may not render to /tmp because '-f 1' renders before the output path is set\n");
 	printf ("    blender -b -o /tmp test.blend -f 1\n");
 	printf ("  ...may not render to /tmp because loading the blend file overwrites the output path that was set\n");
+	printf ("    \"blender -b test.blend -o /tmp -f 1\" works as expected.\n");
 	printf ("\nRender options:\n");
 	printf ("  -b <file>\tRender <file> in background\n");
+	printf ("    -a render frames from start to end (inclusive), only works when used after -b\n");
 	printf ("    -S <name>\tSet scene <name>\n");
 	printf ("    -f <frame>\tRender frame <frame> and save it\n");				
 	printf ("    -s <frame>\tSet start to frame <frame> (use with -a)\n");
@@ -186,16 +188,25 @@
 	printf ("      Use // at the start of the path to\n");
 	printf ("        render relative to the blend file.\n");
 	printf ("      The frame number will be added at the end of the filename.\n");
-	printf ("      eg: blender -b foobar.blend -o //render_ -F PNG -x 1\n");
-	printf ("    -F <format>\tSet the render format, Valid options are..\n");
+	printf ("      eg: blender -b foobar.blend -o //render_ -F PNG -x 1 -a\n");
+	printf ("\nFormat options:\n");
+	printf ("    -F <format>\tSet the render format, Valid options are...\n");
 	printf ("    \tTGA IRIS HAMX JPEG MOVIE IRIZ RAWTGA\n");
 	printf ("    \tAVIRAW AVIJPEG PNG BMP FRAMESERVER\n");
 	printf ("    (formats that can be compiled into blender, not available on all systems)\n");
 	printf ("    \tHDR TIFF EXR MPEG AVICODEC QUICKTIME CINEON DPX DDS\n");
 	printf ("    -x <bool>\tSet option to add the file extension to the end of the file.\n");
 	printf ("    -t <threads>\tUse amount of <threads> for rendering\n");
-	printf ("\nAnimation options:\n");
-	printf ("  -a <file(s)>\tPlayback <file(s)>\n");
+	/*Add these later - Campbell*/
+	/*
+	printf ("    -colorchannel <type>\tColors to save, valid types are: BW RGB RGBA \n");
+	printf ("    -compression <type>\t Use with EXR format, valid types are..\n");
+	printf ("    \tZIP Pxr24 PIZ RLE\n");
+	printf ("    -zbuf <bool>\tUse with EXR format, set the zbuf save option\n");
+	printf ("    -halffloat <bool>\tUse with EXR format, set the half float option\n");
+	printf ("    -preview <bool>\tUse with EXR format, save a jpeg for viewing as well as the EXR\n");*/
+	printf ("\nAnimation playback options:\n");
+	printf ("  -a <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n");
 	printf ("    -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n");
 	printf ("    -m\t\tRead from disk (Don't buffer)\n");
 	printf ("    -f <fps> <fps-base>\t\tSpecify FPS to start with\n");
@@ -337,7 +348,7 @@
 		/* Handle -* switches */
 		else if(argv[a][0] == '-') {
 			switch(argv[a][1]) {
-			case 'a':
+			case 'a': /* -b was not given, play an animation */
 				playanim(argc-1, argv+1);
 				exit(0);
 				break;
@@ -662,7 +673,7 @@
 						else if (!strcmp(argv[a],"FRAMESERVER")) G.scene->r.imtype = R_FRAMESERVER;
 						else if (!strcmp(argv[a],"CINEON")) G.scene->r.imtype = R_CINEON;
 						else if (!strcmp(argv[a],"DPX")) G.scene->r.imtype = R_DPX;
-						else printf("\nError: Format from '-F ' not known or not compiled in this release.\n");
+						else printf("\nError: Format from '-F' not known or not compiled in this release.\n");
 					}
 				} else {
 					printf("\nError: no blend loaded. cannot use '-x'.\n");





More information about the Bf-blender-cvs mailing list