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.
This commit is contained in:
Campbell Barton 2008-05-04 09:41:15 +00:00
parent f95c1141db
commit 110f927c63
33 changed files with 164 additions and 128 deletions

@ -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");

@ -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);

@ -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);
}
}

@ -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;

@ -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");

@ -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);
}

@ -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;

@ -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");

@ -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);

@ -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);

@ -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) {

@ -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

@ -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);

@ -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 */

@ -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");

@ -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))

@ -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) ) {

@ -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);
}

@ -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",

@ -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--;

@ -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) {

@ -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;

@ -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;

@ -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);

@ -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;

@ -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;

@ -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
}
// --------------------------------------------------------------------------------------------

@ -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);
}
}

@ -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");
}

@ -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)

@ -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);
}

@ -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);
}

@ -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);