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:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user