Changed frame numbering to only alter hashes if they are in the filename (not the...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 4 May 2008 09:41:15 +0000 (09:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 4 May 2008 09:41:15 +0000 (09:41 +0000)
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.

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

index f31c5a0d6728dcc8f7e2e466257b1308a0a33c09..654cf0991ccde0697cc6d16a1e48a2dbb15ea049 100644 (file)
@@ -3304,7 +3304,9 @@ void loadFluidsimMesh(Object *srcob, int useRenderParams)
        } 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");
 
index 8a982b15df7c6a80682dc08946b786a07802a1d2..ff0b2e6db0a4c6df216fb28d1c22907694feb7d0 100644 (file)
@@ -351,7 +351,8 @@ Image *BKE_add_image_file(const char *name)
        }
        
        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 @@ Image *BKE_add_image_file(const char *name)
        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 @@ void BKE_makepicstring(char *string, char *base, int frame, int imtype)
        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,9 +1482,11 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
        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);
@@ -1582,9 +1587,9 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
                
                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,9 +1641,11 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
                /* 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);
index 8740a3d1ed4adf86b1a4e1da40fc75cc720a8ba6..cc3f3f211a49b6630047803f5e620a74f2fc0dca 100644 (file)
@@ -974,7 +974,7 @@ static void image_fix_relative_path(Image *ima)
 {
        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);
        }
 }
index 109f8bd91136f4a47d93fd61b6e361177dff912f..f6a65bd72a5d20f103ecb16fae641549b57da6d2 100644 (file)
@@ -185,7 +185,7 @@ PackedFile * newPackedFile(char * filename)
        // 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 @@ int writePackedFile(char * filename, PackedFile *pf, int guimode)
        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 @@ int checkPackedFile(char * filename, PackedFile * pf)
        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;
index 069dac60412e7f5de2bff031bb1c1453f7dc3051..9dd21cdda4ea6b9d2f28e3766ad6faebb8d84f29 100644 (file)
@@ -4565,7 +4565,8 @@ static void particles_fluid_step(Object *ob, ParticleSystem *psys, int cfra)
                // 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");
index 3d73ba1e93f7ec59e8507926aaa62b9355df109f..7b727528b3da4dfe2741cf5e2314d0f40042083d 100644 (file)
@@ -186,7 +186,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
                
                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);
        }
        
index 3b14cb8adace105bc477310c3966b73298a6c054..2c5b49246fba523e0998c956b2ac8673f95e186f 100644 (file)
@@ -109,13 +109,13 @@ PackedFile* sound_find_packedfile(bSound *sound)
        
        // 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 @@ PackedFile* sound_find_packedfile(bSound *sound)
                
                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;
index d15160054ac2e138adc1e4face45c4aecf21c978..872f81ead632a3b7139ceac9602753baf53e1f47 100644 (file)
@@ -218,7 +218,7 @@ int reopen_text(Text *text)
        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 @@ Text *add_text(char *file)
 
        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");
index 3d85fe32193c7560d4330bea1f6c01c73f676c4c..44004eeee803d924fe605de4e20d66c8772eb623 100644 (file)
@@ -120,7 +120,7 @@ void makeavistring (RenderData *rd, char *string)
        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);
 
index 33567d92c992d6c127de981479e9478776bd57c0..e24ccad12fb28f6cc376fd06c7b8882493ccf4c5 100644 (file)
@@ -150,7 +150,8 @@ void BLI_cleanup_dir(const char *relabase, char *dir); /* same as above but adds
         * @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);
 
index 66eb63c8dfdecef971f64e870fe9a7fdb364f3a8..79d3e4877128397682c270ab00569a6d2b898a5a 100644 (file)
@@ -130,9 +130,9 @@ void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_ex
        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);
+               BLI_convertstringcode(path_expanded, G.sce);
        }
 }
 char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
index cdac1ba706142e12f54ca2264327c86c5ace5aa9..c85849b5ed4be35af35c35c406011801e8ef005f 100644 (file)
@@ -877,7 +877,7 @@ void BLI_cleanup_file(const char *relabase, char *dir)
        short a;
        char *start, *eind;
        if (relabase) {
-               BLI_convertstringcode(dir, relabase, 0);
+               BLI_convertstringcode(dir, relabase);
        }
 #ifdef WIN32
        if(dir[0]=='.') {       /* happens for example in FILE_MAIN */
@@ -1037,10 +1037,78 @@ void BLI_makestringcode(const char *relfile, char *file)
        }
 }
 
-int BLI_convertstringcode(char *path, const char *basepath, int framenum)
+
+int BLI_convertstringframe(char *path, int frame)
+{
+       int ch_sta, ch_end, i;
+       /* Insert current frame: file### -> file001 */
+       ch_sta = ch_end = 0;
+       for (i = 0; path[i] != '\0'; i++) {
+               if (path[i] == '\\' || path[i] == '/') {
+                       ch_end = 0; /* this is a directory name, dont use any hashes we found */
+               } else if (path[i] == '#') {
+                       ch_sta = i;
+                       ch_end = ch_sta+1;
+                       while (path[ch_end] == '#') {
+                               ch_end++;
+                       }
+                       i = ch_end-1; /* keep searching */
+                       
+                       /* dont break, there may be a slash after this that invalidates the previous #'s */
+               }
+       }
+       if (ch_end) { /* warning, ch_end is the last # +1 */
+               /* Add the frame number? */
+               short numlen, hashlen;
+               char tmp[FILE_MAX];
+               
+               char format[16]; /* 6 is realistically the maxframe (300000), so 8 should be enough, but 16 to be safe. */
+               if (((ch_end-1)-ch_sta) >= 16) {
+                       ch_end = ch_sta+15; /* disallow values longer then 'format' can hold */
+               }
+               
+               strcpy(tmp, path);
+               
+               numlen = 1 + (int)log10((double)frame); /* this is the number of chars in the number */
+               hashlen = ch_end - ch_sta;
+               
+               sprintf(format, "%d", frame);
+               
+               if (numlen==hashlen) { /* simple case */
+                       memcpy(tmp+ch_sta, format, numlen);
+               } else if (numlen < hashlen) {
+                       memcpy(tmp+ch_sta + (hashlen-numlen), format, numlen); /*dont copy the string terminator */
+                       memset(tmp+ch_sta, '0', hashlen-numlen);
+               } else {
+                       /* number is longer then number of #'s */
+                       if (tmp[ch_end] == '\0') { /* hashes are last, no need to move any string*/
+                               /* bad juju - not testing string length here :/ */
+                               memcpy(tmp+ch_sta, format, numlen+1); /* add 1 to get the string terminator \0 */
+                       } else {
+                               /* we need to move the end characters, reuse i */
+                               int j;
+                               
+                               i = strlen(tmp); /* +1 to copy the string terminator */
+                               j = i + (numlen-hashlen); /* from/to */
+                               
+                               while (i >= ch_end) {
+                                       tmp[j] = tmp[i]; 
+                                       i--;
+                                       j--;
+                               }
+                               memcpy(tmp + ch_sta, format, numlen);
+                       }
+               }       
+               strcpy(path, tmp);
+               return 1;
+       }
+       return 0;
+}
+
+
+int BLI_convertstringcode(char *path, const char *basepath)
 {
        int wasrelative;
-       int ch_sta, ch_end;
        char tmp[FILE_MAX];
        char base[FILE_MAX];
        char vol[3] = {'\0', '\0', '\0'};
@@ -1098,54 +1166,8 @@ int BLI_convertstringcode(char *path, const char *basepath, int framenum)
                MEM_freeN(filepart);
        }
        
-       
-       /* Insert current frame: file### -> file001 */
-       ch_end = 0;
-       for (ch_sta = 0; tmp[ch_sta] != '\0'; ch_sta++) {
-               if (tmp[ch_sta] == '#') {
-                       ch_end = ch_sta+1;
-                       while (tmp[ch_end] == '#') {
-                               ch_end++;
-                       }                       
-                       break;
-               }
-       }
-       if (ch_end) { /* warning, ch_end is the last # +1 */
-               /* Add the frame number? */
-               short numlen, hashlen;
-               char format[16]; /* 6 is realistically the maxframe (300000), so 8 should be enough, but 16 to be safe. */
-               
-               numlen = 1 + (int)log10((double)framenum); /* this is the number of chars in the number */
-               hashlen = ch_end - ch_sta;
-               
-               sprintf(format, "%d", framenum);
-               
-               if (numlen==hashlen) { /* simple case */
-                       memcpy(tmp+ch_sta, format, numlen);
-               } else if (numlen < hashlen) {
-                       memcpy(tmp+ch_sta + (hashlen-numlen), format, numlen); /*dont copy the string terminator */
-                       memset(tmp+ch_sta, '0', hashlen-numlen);
-               } else {
-                       /* number is longer then number of #'s */
-                       if (tmp[ch_end] == '\0') { /* hashes are last, no need to move any string*/
-                               /* bad juju - not testing string length here :/ */
-                               memcpy(tmp+ch_sta, format, numlen+1); /* add 1 to get the string terminator \0 */
-                       } else {
-                               /* we need to move the end characters */
-                               int i = strlen(tmp); /* +1 to copy the string terminator */
-                               int j = i + (numlen-hashlen); /* from/to */
-                               while (i >= ch_end) {
-                                       tmp[j] = tmp[i]; 
-                                       i--;
-                                       j--;
-                               }
-                               memcpy(tmp + ch_sta, format, numlen);
-                       }
-               }       
-       }
-       /* done with file### stuff */
-       
        strcpy(path, tmp);
+       
 #ifdef WIN32
        /* skip first two chars, which in case of
           absolute path will be drive:/blabla and
index aa3fe6a9279ab901f434540a27c225ed8580bdde..6f9c0ae194fc4a1ca7c5a37854d9236ea829dacc 100644 (file)
@@ -82,7 +82,6 @@ void winqdelete(struct ScrArea *sa);
 void winqclear(struct ScrArea *sa);
 void addqueue(short win, unsigned short event, short val);
 void addafterqueue(short win, unsigned short event, short val);
-void add_readfile_event(char *filename);
 short ext_qtest(void);
 unsigned short extern_qread(short *val);
 unsigned short extern_qread_ext(short *val, char *ascii);
index 86bcd51e91434f0d2fcbbf66d8e1cbb70a899b83..ffdb593767a84016df681129532c1e5c993e272f 100644 (file)
@@ -444,7 +444,7 @@ void BPY_rebuild_syspath( void )
                }
 
                BLI_strncpy(dirpath, U.pythondir, FILE_MAX);
-               BLI_convertstringcode(dirpath, G.sce, 0);
+               BLI_convertstringcode(dirpath, G.sce);
                syspath_append(dirpath);        /* append to module search path */
 
                BLI_make_file_string("/", modpath, dirpath, "bpymodules");
@@ -1019,7 +1019,7 @@ int BPY_menu_do_python( short menutype, int event )
 
                /* dirs in Blender can be "//", which has a special meaning */
                BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
-               BLI_convertstringcode(upythondir, G.sce, 0); /* if so, this expands it */
+               BLI_convertstringcode(upythondir, G.sce); /* if so, this expands it */
                BLI_make_file_string( "/", filestr, upythondir, pym->filename );
        }
        else { /* script is in default scripts dir */
index ce1b964b689496a2d85f040d2ca3d79b3c3a8091..82da9edbee6f5f293a6787e6882d5b57b0d04f36 100644 (file)
@@ -492,7 +492,7 @@ static int bpymenu_CreateFromFile( void )
        fscanf( fp, "# User defined scripts dir: %[^\n]\n", w1 );
 
                BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
-               BLI_convertstringcode(upythondir, G.sce, 0);
+               BLI_convertstringcode(upythondir, G.sce);
 
                if( strcmp( w1, upythondir ) != 0 )
                        return -1;
@@ -604,7 +604,7 @@ static void bpymenu_WriteDataFile( void )
                char upythondir[FILE_MAX];
 
                BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
-               BLI_convertstringcode(upythondir, G.sce, 0);
+               BLI_convertstringcode(upythondir, G.sce);
                fprintf( fp, "# User defined scripts dir: %s\n", upythondir );
        }
 
@@ -1003,7 +1003,7 @@ int BPyMenu_Init( int usedir )
        }
        else {
                BLI_strncpy(upythondir, upydir, FILE_MAX);
-               BLI_convertstringcode(upythondir, G.sce, 0);
+               BLI_convertstringcode(upythondir, G.sce);
        }
 
        sdir = bpy_gethome(1);
@@ -1096,7 +1096,7 @@ the user defined Python scripts dir.\n", dirname );
                }
                if( stat_dir2 == 0 ) {
                        BLI_strncpy(dirname, U.pythondir, FILE_MAX);
-                       BLI_convertstringcode(dirname, G.sce, 0);
+                       BLI_convertstringcode(dirname, G.sce);
                        i = bpymenu_ParseDir( dirname, NULL, 1 );
                        if (i == -1 && DEBUG)
                                fprintf(stderr, "User defined scripts dir does not seem valid.\n\n");
index fe5ae25ccb130d18057865845a0d102b0dca30b6..daba0c36fdf4fe3ceaceb6241d091864854e7a25 100644 (file)
@@ -371,7 +371,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char upydir[FILE_MAX];
 
                        BLI_strncpy(upydir, U.pythondir, FILE_MAX);
-                       BLI_convertstringcode(upydir, G.sce, 0);
+                       BLI_convertstringcode(upydir, G.sce);
 
                        if (BLI_exists(upydir)) {
                                char udatadir[FILE_MAXDIR];
@@ -397,7 +397,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char upydir[FILE_MAX];
 
                        BLI_strncpy(upydir, U.pythondir, FILE_MAX);
-                       BLI_convertstringcode(upydir, G.sce, 0);
+                       BLI_convertstringcode(upydir, G.sce);
 
                        if( BLI_exists( upydir ) )
                                ret = PyString_FromString( upydir );
@@ -410,7 +410,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char yfexportdir[FILE_MAX];
 
                        BLI_strncpy(yfexportdir, U.yfexportdir, FILE_MAX);
-                       BLI_convertstringcode(yfexportdir, G.sce, 0);
+                       BLI_convertstringcode(yfexportdir, G.sce);
 
                        if( BLI_exists( yfexportdir ) )
                                ret = PyString_FromString( yfexportdir );
@@ -423,7 +423,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char fontdir[FILE_MAX];
 
                        BLI_strncpy(fontdir, U.fontdir, FILE_MAX);
-                       BLI_convertstringcode(fontdir, G.sce, 0);
+                       BLI_convertstringcode(fontdir, G.sce);
 
                        if( BLI_exists( fontdir ) )
                                ret = PyString_FromString( fontdir );
@@ -436,7 +436,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char textudir[FILE_MAX];
 
                        BLI_strncpy(textudir, U.textudir, FILE_MAX);
-                       BLI_convertstringcode(textudir, G.sce, 0);
+                       BLI_convertstringcode(textudir, G.sce);
 
                        if( BLI_exists( textudir ) )
                                ret = PyString_FromString( textudir );
@@ -449,7 +449,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char plugtexdir[FILE_MAX];
 
                        BLI_strncpy(plugtexdir, U.plugtexdir, FILE_MAX);
-                       BLI_convertstringcode(plugtexdir, G.sce, 0);
+                       BLI_convertstringcode(plugtexdir, G.sce);
 
                        if( BLI_exists( plugtexdir ) )
                                ret = PyString_FromString( plugtexdir );
@@ -462,7 +462,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char plugseqdir[FILE_MAX];
 
                        BLI_strncpy(plugseqdir, U.plugseqdir, FILE_MAX);
-                       BLI_convertstringcode(plugseqdir, G.sce, 0);
+                       BLI_convertstringcode(plugseqdir, G.sce);
 
                        if( BLI_exists( plugseqdir ) )
                                ret = PyString_FromString( plugseqdir );
@@ -475,7 +475,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char renderdir[FILE_MAX];
 
                        BLI_strncpy(renderdir, U.renderdir, FILE_MAX);
-                       BLI_convertstringcode(renderdir, G.sce, 0);
+                       BLI_convertstringcode(renderdir, G.sce);
 
                        if( BLI_exists( renderdir ) )
                                ret = PyString_FromString( renderdir );
@@ -488,7 +488,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char sounddir[FILE_MAX];
 
                        BLI_strncpy(sounddir, U.sounddir, FILE_MAX);
-                       BLI_convertstringcode(sounddir, G.sce, 0);
+                       BLI_convertstringcode(sounddir, G.sce);
 
                        if( BLI_exists( sounddir ) )
                                ret = PyString_FromString( sounddir );
@@ -501,7 +501,7 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
                        char tempdir[FILE_MAX];
 
                        BLI_strncpy(tempdir, U.tempdir, FILE_MAX);
-                       BLI_convertstringcode(tempdir, G.sce, 0);
+                       BLI_convertstringcode(tempdir, G.sce);
 
                        if( BLI_exists( tempdir ) )
                                ret = PyString_FromString( tempdir );
@@ -776,7 +776,7 @@ static PyObject *Blender_ShowHelp(PyObject *self, PyObject *script)
                        char upydir[FILE_MAX];
 
                        BLI_strncpy(upydir, U.pythondir, FILE_MAX);
-                       BLI_convertstringcode(upydir, G.sce, 0);
+                       BLI_convertstringcode(upydir, G.sce);
                        BLI_make_file_string("/", hspath, upydir, "help_browser.py");
 
                        if (!BLI_exists(hspath))
index b6fb1500a6e96a5ba694957bdba624be2a8eff0f..799735c2062fc31aebe2b57bd4d4f8f0140df1d0 100644 (file)
@@ -166,7 +166,7 @@ static PyObject *M_Library_Open( PyObject * self, PyObject * value )
        
        /* copy the name to make it absolute so BLO_blendhandle_from_file doesn't complain */
        BLI_strncpy(fname1, fname, sizeof(fname1)); 
-       BLI_convertstringcode(fname1, G.sce, 0); /* make absolute */
+       BLI_convertstringcode(fname1, G.sce); /* make absolute */
        
        /* G.sce = last file loaded, save for UI and restore after opening file */
        BLI_strncpy(filename, G.sce, sizeof(filename));
@@ -483,7 +483,7 @@ static BlendHandle *open_library( char *filename, char *longFilename )
 
        /* get complete file name if necessary */
        BLI_strncpy( longFilename, filename, FILE_MAX ); 
-       BLI_convertstringcode( longFilename, G.sce, 0 );
+       BLI_convertstringcode( longFilename, G.sce );
 
        /* throw exceptions for wrong file type, cyclic reference */
        if( !BLO_has_bfile_extension(longFilename) ) {
index 337f8b6bb14650c015228d5435cce4520a21a13d..9de4e344e8cc8daa0e964ed37bb35d881d99d2af 100644 (file)
@@ -391,7 +391,8 @@ static PyObject *M_sys_expandpath( PyObject * self, PyObject * value )
                        "expected string argument" );
        
        BLI_strncpy(expanded, path, FILE_MAXDIR + FILE_MAXFILE);
-       BLI_convertstringcode(expanded, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(expanded, G.sce);
+       BLI_convertstringframe(expanded, G.scene->r.cfra);
 
        return PyString_FromString(expanded);
 }
index 7cae5f6144fea55d0d3d99795ba2582ce8e31303..d99861955114225815c42430467d5cc5392c64f6 100644 (file)
@@ -612,8 +612,8 @@ PyObject *RenderData_Play( BPy_RenderData * self )
        {
 
                strcpy( file, self->renderContext->pic );
-               BLI_convertstringcode( file, G.sce,
-                                      self->renderContext->cfra );
+               BLI_convertstringcode( file, G.sce );
+               
                BLI_make_existing_file( file );
                if( BLI_strcasecmp( file + strlen( file ) - 4, ".avi" ) ) {
                        sprintf( txt, "%04d_%04d.avi",
index 09c850b6252fc3cce7e74e92f27c5bcae5fce5c1..93282e641d352c776ec20145d02bd0cda0d65689 100644 (file)
@@ -1835,7 +1835,8 @@ static void load_backbuffer(Render *re)
                char name[256];
                
                strcpy(name, re->r.backbuf);
-               BLI_convertstringcode(name, G.sce, re->r.cfra);
+               BLI_convertstringcode(name, G.sce);
+               BLI_convertstringframe(name, re->r.cfra);
                
                if(re->backbuf) {
                        re->backbuf->id.us--;
index 5e420ade20432aa993f3a8e253ed3868fb54075c..9704b0186cd012caa1908c401d2710c622da70fd 100644 (file)
@@ -238,7 +238,7 @@ static void save_env(char *name)
        char str[FILE_MAX];
        
        strcpy(str, name);
-       BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(str, G.sce);
        tex= G.buts->lockpoin;
        
        if(tex && GS(tex->id.name)==ID_TE) {
index 2ee583788e5a15dd79154f4c50c2c5aaa3eb2cde..67e10d771e0210d6aaf1834706795cd3376ce66d 100644 (file)
@@ -166,8 +166,7 @@ static void activate_imageselect_(int type, char *title, char *file, short *menu
 
        name[2]= 0;
        BLI_strncpy(name, file, sizeof(name));
-       BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
-       
+       BLI_convertstringcode(name, G.sce);
        
        simasel= curarea->spacedata.first;
 
index 9ad2bd34ea47d67f04e9e94f9370d7ba9d06d1ec..1cd8733a7ea05248797aee7f833e0618382e4e0d 100644 (file)
@@ -890,12 +890,6 @@ int afterqtest(short win, unsigned short evt)
 
 
 static char ext_load_str[256]= {0, 0};
-void add_readfile_event(char *filename)
-{      
-       mainqenter(LOAD_FILE, 1);
-       strcpy(ext_load_str, filename);
-       BLI_convertstringcode(ext_load_str, G.sce, G.scene->r.cfra);
-}
 
 static short ext_reshape= 0, ext_redraw=0, ext_inputchange=0, ext_mousemove=0, ext_undopush=0;
 
index c0efbf8b40b2b7ae1003055d2ac5fcee71d290ca..f5cf29528f37f6994636cbf5d4f5f52ffdbd9989 100644 (file)
@@ -2288,7 +2288,9 @@ static void save_image_doit(char *name)
        if (ibuf) {
                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);
+               
                
                if(G.scene->r.scemode & R_EXTENSION)  {
                        BKE_add_image_extension(str, G.sima->imtypenr);
@@ -2499,7 +2501,7 @@ void save_image_sequence_sima(void)
                                char name[FILE_MAX];
                                BLI_strncpy(name, ibuf->name, sizeof(name));
                                
-                               BLI_convertstringcode(name, G.sce, 0);
+                               BLI_convertstringcode(name, G.sce);
 
                                if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
                                        error("Could not write image", name);
index 3ea9a0fb0562a63fcde035cdd0c5dfb5602f47ef..1cb7ec276cb4529dc1bb1ef747f666d58bca7e3a 100644 (file)
@@ -713,7 +713,7 @@ bSound *sound_new_sound(char *name)
        if (!G.scene->audio.mixrate) G.scene->audio.mixrate = 44100;
        /* convert the name to absolute path */
        strcpy(str, name);
-       BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(str, G.sce);
 
        /* check if the sample on disk can be opened */
        file = open(str, O_BINARY|O_RDONLY);
@@ -825,7 +825,7 @@ bSample *sound_new_sample(bSound *sound)
                /* TODO: increase sound->name, sample->name and strip->name to FILE_MAX, to avoid
                   cutting off sample name here - elubie */
                BLI_strncpy(samplename, sound->name, FILE_MAX);         
-               BLI_convertstringcode(samplename, G.sce, G.scene->r.cfra);
+               BLI_convertstringcode(samplename, G.sce);
                BLI_strncpy(sample->name, samplename, FILE_MAXDIR);
 
                /* connect the pf to the sample */
@@ -849,13 +849,13 @@ bSample *sound_find_sample(bSound *sound)
        
        // convert sound->name to abolute filename
        strcpy(name, sound->name);
-       BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(name, G.sce);
        
        /* search through the list of loaded samples */
        sample = samples->first;
        while (sample) {
                strcpy(samplename, sample->name);
-               BLI_convertstringcode(samplename, G.sce, G.scene->r.cfra);
+               BLI_convertstringcode(samplename, G.sce);
                
                if (strcmp(name, samplename) == 0)      {
                        break;
index c297edda9054d3a361541293eaab3db54f17cc3e..19372dcbee621fa25217b3d00ab939811b041d2d 100644 (file)
@@ -1172,7 +1172,7 @@ static void activate_fileselect_(int type, char *title, char *file, short *menup
 
        name[2]= 0;
        BLI_strncpy(name, file, sizeof(name));
-       BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(name, G.sce);
        
        sfile= curarea->spacedata.first;
 
index b51f5bba4d6d053bc9dc7e6f2ab215234cead23d..a7361a9ffca35b76c07b5902de74063a30413f21 100644 (file)
@@ -622,7 +622,7 @@ void fluidsimBake(struct Object *ob)
        // prepare names...
        strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
        strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
-       BLI_convertstringcode(targetDir, G.sce, 0); // fixed #frame-no 
+       BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no 
 
        strcpy(targetFile, targetDir);
        strcat(targetFile, suffixConfig);
@@ -674,7 +674,7 @@ void fluidsimBake(struct Object *ob)
                if(selection<1) return; // 0 from menu, or -1 aborted
                strcpy(targetDir, newSurfdataPath);
                strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
-               BLI_convertstringcode(targetDir, G.sce, 0); // fixed #frame-no 
+               BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no 
        }
        
        // --------------------------------------------------------------------------------------------
index fdb5fea658ce32bc66d6f5b60b5bdaf0bd98e5b3..83a3c12bae79688014ebc09a47685d1cfad2db73 100644 (file)
@@ -1839,7 +1839,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
                        int err;
 
                        strcpy(tmpStr, G.selfont->name);
-                       BLI_convertstringcode(tmpStr, G.sce, 0);
+                       BLI_convertstringcode(tmpStr, G.sce);
                        err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
                }
        }
index a887a6f1751f92c1402d2ee9fb6599b3a279b174..683b06aafc41d3ab90bf951279bea4445678cb31 100644 (file)
@@ -3539,7 +3539,7 @@ static void namebutton_cb(void *tep, void *oldnamep)
                        if (te->idcode == ID_LI) {
                                char expanded[FILE_MAXDIR + FILE_MAXFILE];
                                BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
-                               BLI_convertstringcode(expanded, G.sce, G.scene->r.cfra);
+                               BLI_convertstringcode(expanded, G.sce);
                                if (!BLI_exists(expanded)) {
                                        error("This path does not exist, correct this before saving");
                                }
index b5240a942418e8a39a156fe8ea7f18d2fd5cc2e4..e793c224fcb6c61486f03168defadd7a0e795676 100644 (file)
@@ -69,7 +69,8 @@ void write_screendump(char *name)
        if(dumprect) {
 
                strcpy(G.ima, name);
-               BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+               BLI_convertstringcode(name, G.sce);
+               BLI_convertstringframe(name, G.scene->r.cfra); /* TODO - is this ever used? */
                
                /* BKE_add_image_extension() checks for if extension was already set */
                if(G.scene->r.scemode & R_EXTENSION) 
index 3e7840192742192b9bc95d5a5e75792f46a87fe8..7c27f32c242b1b94be8acef8abcc90dde3ae7ba0 100644 (file)
@@ -106,7 +106,7 @@ void makewavstring (char *string)
        if (string==0) return;
 
        strcpy(string, G.scene->r.pic);
-       BLI_convertstringcode(string, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(string, G.sce);
 
        BLI_make_existing_file(string);
 
@@ -394,8 +394,7 @@ static void audio_fill_seq(Sequence * seq, void * mixdown,
                                        strncat(name, 
                                                seq->strip->stripdata->name, 
                                                FILE_MAXFILE-1);
-                                       BLI_convertstringcode(name, G.sce, 
-                                                             G.scene->r.cfra);
+                                       BLI_convertstringcode(name, G.sce);
                                
                                        seq->hdaudio= sound_open_hdaudio(name);
                                }
index 22bedab6beebc9fe3b8d5083aa66c1b8c6294383..9f3be52af1bd7a7323b1eee2ed7b1d151591b72d 100644 (file)
@@ -429,7 +429,9 @@ void reload_sequence_new_file(Sequence * seq)
                strncpy(str, seq->strip->dir, FILE_MAXDIR-1);
                strncat(str, seq->strip->stripdata->name, FILE_MAXFILE-1);
 
-               BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+               BLI_convertstringcode(str, G.sce);
+               BLI_convertstringframe(str, G.scene->r.cfra); /* TODO - is this needed? */
+               
        }
 
        if (seq->type == SEQ_IMAGE) {
@@ -1068,7 +1070,9 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, char * name)
                         G.scene->r.size);
        }
 
-       BLI_convertstringcode(name, G.sce, frameno);
+       BLI_convertstringcode(name, G.sce);
+       BLI_convertstringframe(name, frameno);
+       
 
        strcat(name, ".jpg");
 
@@ -1706,7 +1710,8 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
                        
                        strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
                        strncat(name, s_elem->name, FILE_MAXFILE);
-                       BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+                       BLI_convertstringcode(name, G.sce);
+                       BLI_convertstringframe(name, G.scene->r.cfra);
                        if (!build_proxy_run) {
                                se->ibuf = seq_proxy_fetch(seq, cfra);
                        }
@@ -1735,7 +1740,8 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
                                if(seq->anim==0) {
                                        strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
                                        strncat(name, seq->strip->stripdata->name, FILE_MAXFILE-1);
-                                       BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
+                                       BLI_convertstringcode(name, G.sce);
+                                       BLI_convertstringframe(name, G.scene->r.cfra);
                                
                                        seq->anim = openanim(name, IB_rect);
                                }
index d7e40dabd4367bb5abaf94941e9cbc2e21c22f5d..1ef32fc33e87f67774e9466243a586c94318714a 100644 (file)
@@ -99,7 +99,8 @@ static void save_rendered_image_cb_real(char *name, int confirm)
                        BKE_add_image_extension(name, G.scene->r.imtype);
 
        strcpy(str, name);
-       BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+       BLI_convertstringcode(str, G.sce);
+       BLI_convertstringframe(str, G.scene->r.cfra); /* TODO - is this even used? */
 
        if (confirm)
                overwrite = saveover(str);