[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14669] trunk/blender/source/blender: Changed frame numbering to only alter hashes if they are in the filename ( not the directory name) to fix bug [#10566] File Open Dialog replaces '#' with '0' in directory names.

Campbell Barton ideasman42 at gmail.com
Sun May 4 11:41:16 CEST 2008


Revision: 14669
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14669
Author:   campbellbarton
Date:     2008-05-04 11:41:15 +0200 (Sun, 04 May 2008)

Log Message:
-----------
Changed frame numbering to only alter hashes if they are in the filename (not the directory name) to fix bug [#10566] File Open Dialog replaces '#' with '0' in directory names.

removed frame numbering from BLI_convertstringcode into its own function (BLI_convertstringframe), many uses of BLI_convertstringcode were passing dummy frames values anyway.
in cases where adding the current frame number to a filename is needed run BLI_convertstringframe(...) after BLI_convertstringcode(...)

There are some cases Im not sure BLI_convertstringframe is needed, these have been commented as todo, but at least have the same functionality they used to.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/blenkernel/intern/library.c
    trunk/blender/source/blender/blenkernel/intern/packedFile.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/blenkernel/intern/sound.c
    trunk/blender/source/blender/blenkernel/intern/text.c
    trunk/blender/source/blender/blenkernel/intern/writeavi.c
    trunk/blender/source/blender/blenlib/BLI_blenlib.h
    trunk/blender/source/blender/blenlib/intern/bpath.c
    trunk/blender/source/blender/blenlib/intern/util.c
    trunk/blender/source/blender/include/BIF_screen.h
    trunk/blender/source/blender/python/BPY_interface.c
    trunk/blender/source/blender/python/BPY_menus.c
    trunk/blender/source/blender/python/api2_2x/Blender.c
    trunk/blender/source/blender/python/api2_2x/Library.c
    trunk/blender/source/blender/python/api2_2x/Sys.c
    trunk/blender/source/blender/python/api2_2x/sceneRender.c
    trunk/blender/source/blender/render/intern/source/pipeline.c
    trunk/blender/source/blender/src/buttons_shading.c
    trunk/blender/source/blender/src/editimasel.c
    trunk/blender/source/blender/src/editscreen.c
    trunk/blender/source/blender/src/editsima.c
    trunk/blender/source/blender/src/editsound.c
    trunk/blender/source/blender/src/filesel.c
    trunk/blender/source/blender/src/fluidsim.c
    trunk/blender/source/blender/src/interface_draw.c
    trunk/blender/source/blender/src/outliner.c
    trunk/blender/source/blender/src/screendump.c
    trunk/blender/source/blender/src/seqaudio.c
    trunk/blender/source/blender/src/sequence.c
    trunk/blender/source/blender/src/writeimage.c

Modified: trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -3304,7 +3304,9 @@
 	} else { // 3
 		strcat(targetDir,"fluidsurface_final_####");
 	}
-	BLI_convertstringcode(targetDir, G.sce, curFrame); // fixed #frame-no 
+	BLI_convertstringcode(targetDir, G.sce);
+	BLI_convertstringframe(targetDir, curFrame); // fixed #frame-no 
+	
 	strcpy(targetFile,targetDir);
 	strcat(targetFile, ".bobj.gz");
 

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/image.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -351,7 +351,8 @@
 	}
 	
 	BLI_strncpy(str, name, sizeof(str));
-	BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+	BLI_convertstringcode(str, G.sce);
+	BLI_convertstringframe(str, G.scene->r.cfra); /* TODO - should this realy be here? */
 	
 	/* exists? */
 	file= open(str, O_BINARY|O_RDONLY);
@@ -362,7 +363,8 @@
 	for(ima= G.main->image.first; ima; ima= ima->id.next) {
 		if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
 			BLI_strncpy(strtest, ima->name, sizeof(ima->name));
-			BLI_convertstringcode(strtest, G.sce, G.scene->r.cfra);
+			BLI_convertstringcode(strtest, G.sce);
+			BLI_convertstringframe(strtest, G.scene->r.cfra); /* TODO - should this be here? */
 			
 			if( strcmp(strtest, str)==0 ) {
 				if(ima->anim==NULL || ima->id.us==0) {
@@ -1243,7 +1245,8 @@
 	if (strchr(string, '#')==NULL)
 		strcat(string, "####"); /* 4 numbers */
 	
-	BLI_convertstringcode(string, G.sce, frame);
+	BLI_convertstringcode(string, G.sce);
+	BLI_convertstringframe(string, frame);
 
 	if(G.scene->r.scemode & R_EXTENSION) 
 		BKE_add_image_extension(string, imtype);
@@ -1479,10 +1482,12 @@
 	BLI_strncpy(name, ima->name, sizeof(name));
 	
 	if(ima->id.lib)
-		BLI_convertstringcode(name, ima->id.lib->filename, frame);
+		BLI_convertstringcode(name, ima->id.lib->filename);
 	else
-		BLI_convertstringcode(name, G.sce, frame);
+		BLI_convertstringcode(name, G.sce);
 	
+	BLI_convertstringframe(name, frame); /* TODO - should this be here? */
+	
 	/* read ibuf */
 	ibuf = IMB_loadiffname(name, IB_rect|IB_multilayer);
 	if(G.f & G_DEBUG) printf("loaded %s\n", name);
@@ -1582,9 +1587,9 @@
 		
 		BLI_strncpy(str, ima->name, FILE_MAX);
 		if(ima->id.lib)
-			BLI_convertstringcode(str, ima->id.lib->filename, 0);
+			BLI_convertstringcode(str, ima->id.lib->filename);
 		else
-			BLI_convertstringcode(str, G.sce, 0);
+			BLI_convertstringcode(str, G.sce);
 		
 		ima->anim = openanim(str, IB_cmap | IB_rect);
 		
@@ -1636,10 +1641,12 @@
 		/* get the right string */
 		BLI_strncpy(str, ima->name, sizeof(str));
 		if(ima->id.lib)
-			BLI_convertstringcode(str, ima->id.lib->filename, cfra);
+			BLI_convertstringcode(str, ima->id.lib->filename);
 		else
-			BLI_convertstringcode(str, G.sce, cfra);
+			BLI_convertstringcode(str, G.sce);
 		
+		BLI_convertstringframe(str, cfra);
+		
 		/* read ibuf */
 		ibuf = IMB_loadiffname(str, IB_rect|IB_multilayer|IB_imginfo);
 	}

Modified: trunk/blender/source/blender/blenkernel/intern/library.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/library.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/library.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -974,7 +974,7 @@
 {
 	if(ima->id.lib==NULL) return;
 	if(strncmp(ima->name, "//", 2)==0) {
-		BLI_convertstringcode(ima->name, ima->id.lib->filename, 0);
+		BLI_convertstringcode(ima->name, ima->id.lib->filename);
 		BLI_makestringcode(G.sce, ima->name);
 	}
 }

Modified: trunk/blender/source/blender/blenkernel/intern/packedFile.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/packedFile.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/packedFile.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -185,7 +185,7 @@
 	// convert relative filenames to absolute filenames
 	
 	strcpy(name, filename);
-	BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+	BLI_convertstringcode(name, G.sce);
 	
 	// open the file
 	// and create a PackedFile structure
@@ -286,7 +286,7 @@
 	if (guimode) waitcursor(1);
 	
 	strcpy(name, filename);
-	BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+	BLI_convertstringcode(name, G.sce);
 	
 	if (BLI_exists(name)) {
 		for (number = 1; number <= 999; number++) {
@@ -351,7 +351,7 @@
 	char name[FILE_MAXDIR + FILE_MAXFILE];
 	
 	strcpy(name, filename);
-	BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+	BLI_convertstringcode(name, G.sce);
 	
 	if (stat(name, &st)) {
 		ret_val = PF_NOFILE;

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -4565,7 +4565,8 @@
 		// ok, start loading
 		strcpy(filename, ob->fluidsimSettings->surfdataPath);
 		strcat(filename, suffix);
-		BLI_convertstringcode(filename, G.sce, curFrame); // fixed #frame-no 
+		BLI_convertstringcode(filename, G.sce);
+		BLI_convertstringframe(filename, curFrame); // fixed #frame-no 
 		strcat(filename, suffix2);
 
 		gzf = gzopen(filename, "rb");

Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -186,7 +186,7 @@
 		
 		sprintf(filename, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
 		BLI_add_slash(filename);
-		BLI_convertstringcode(filename, blendfilename, 0);
+		BLI_convertstringcode(filename, blendfilename);
 		return strlen(filename);
 	}
 	

Modified: trunk/blender/source/blender/blenkernel/intern/sound.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sound.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/sound.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -109,13 +109,13 @@
 	
 	// convert sound->name to abolute filename
 	strcpy(soundname, sound->name);
-	BLI_convertstringcode(soundname, G.sce, G.scene->r.cfra);
+	BLI_convertstringcode(soundname, G.sce);
 	
 	search = G.main->sound.first;
 	while (search) {
 		if (search->sample && search->sample->packedfile) {
 			strcpy(searchname, search->sample->name);
-			BLI_convertstringcode(searchname, G.sce, G.scene->r.cfra);
+			BLI_convertstringcode(searchname, G.sce);
 			
 			if (BLI_streq(searchname, soundname)) {
 				pf = search->sample->packedfile;
@@ -125,7 +125,7 @@
 		
 		if (search->newpackedfile) {
 			strcpy(searchname, search->name);
-			BLI_convertstringcode(searchname, G.sce, G.scene->r.cfra);
+			BLI_convertstringcode(searchname, G.sce);
 			if (BLI_streq(searchname, soundname)) {
 				pf = search->newpackedfile;
 				break;

Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -218,7 +218,7 @@
 	if (!text || !text->name) return 0;
 	
 	BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE);
-	BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+	BLI_convertstringcode(str, G.sce);
 	BLI_split_dirfile_basic(str, NULL, sfile);
 	
 	fp= fopen(str, "r");
@@ -316,7 +316,7 @@
 
 	BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
 	if (G.scene) /* can be NULL (bg mode) */
-		BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+		BLI_convertstringcode(str, G.sce);
 	BLI_split_dirfile_basic(str, NULL, sfile);
 	
 	fp= fopen(str, "r");

Modified: trunk/blender/source/blender/blenkernel/intern/writeavi.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/writeavi.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenkernel/intern/writeavi.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -120,7 +120,7 @@
 	if (string==0) return;
 
 	strcpy(string, rd->pic);
-	BLI_convertstringcode(string, G.sce, rd->cfra);
+	BLI_convertstringcode(string, G.sce);
 
 	BLI_make_existing_file(string);
 

Modified: trunk/blender/source/blender/blenlib/BLI_blenlib.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_blenlib.h	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenlib/BLI_blenlib.h	2008-05-04 09:41:15 UTC (rev 14669)
@@ -150,7 +150,8 @@
 	 * @a framenum The framenumber to replace the frame code with.
 	 * @retval Returns true if the path was relative (started with "//").
 	 */
-int BLI_convertstringcode(char *path, const char *basepath, int framenum);
+int BLI_convertstringcode(char *path, const char *basepath);
+int BLI_convertstringframe(char *path, int frame);
 
 void BLI_makestringcode(const char *relfile, char *file);
 

Modified: trunk/blender/source/blender/blenlib/intern/bpath.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/bpath.c	2008-05-03 17:04:28 UTC (rev 14668)
+++ trunk/blender/source/blender/blenlib/intern/bpath.c	2008-05-04 09:41:15 UTC (rev 14669)
@@ -130,9 +130,9 @@
 	libpath = BLI_bpathIterator_getLib(bpi);
 	
 	if (libpath) { /* check the files location relative to its library path */
-		BLI_convertstringcode(path_expanded, libpath, G.scene->r.cfra);
+		BLI_convertstringcode(path_expanded, libpath);
 	} else { /* local data, use the blend files path */
-		BLI_convertstringcode(path_expanded, G.sce, G.scene->r.cfra);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list