diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-08 23:08:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-08 23:08:04 +0300 |
commit | b356eb6a8bfad738028e67844c7755f5684f7ce3 (patch) | |
tree | 8f25c3ecec179fb6733f8586ef3f9165c4a8f12f /source/blender/blenlib/intern | |
parent | 187b3bc1eba6822a0fb3b3fc5b5345d2d11ec34c (diff) |
image re-project now uses offscreen render function and has input for render size.
unrelated changes that ended up being more trouble to commit separate...
- removed BLI_split_dirfile(), was nasty, occasionaly modifying the source string, it could create directories and used the $CWD in some cases. was only used in 2 places in filesel.c, if this gives problems can address without bringing back this function.
renamed BLI_split_dirfile_basic --> BLI_split_dirfile
- view3d_operator_needs_opengl was being called for offscreen render when it wasnt needed.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 128 |
2 files changed, 6 insertions, 128 deletions
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 8d3d807ba1b..71d16adeab5 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -290,7 +290,7 @@ static void seq_setpath(struct BPathIterator *bpi, char *path) { if (SEQ_HAS_PATH(seq)) { if (seq->type == SEQ_IMAGE || seq->type == SEQ_MOVIE) { - BLI_split_dirfile_basic(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); } else { /* simple case */ BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir)); @@ -673,7 +673,7 @@ void findMissingFiles(char *basepath, char *str) { //XXX waitcursor( 1 ); - BLI_split_dirfile_basic(str, dirname, NULL); + BLI_split_dirfile(str, dirname, NULL); BLI_bpathIterator_init(&bpi, basepath); @@ -694,7 +694,7 @@ void findMissingFiles(char *basepath, char *str) { /* can the dir be opened? */ filesize = -1; recur_depth = 0; - BLI_split_dirfile_basic(filepath, NULL, filename); /* the file to find */ + BLI_split_dirfile(filepath, NULL, filename); /* the file to find */ findFileRecursive(filename_new, dirname, filename, &filesize, &recur_depth); if (filesize == -1) { /* could not open dir */ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index fe43960b770..2346b172e87 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1163,7 +1163,7 @@ int BLI_testextensie(const char *str, const char *ext) * - dosnt use CWD, or deal with relative paths. * - Only fill's in *dir and *file when they are non NULL * */ -void BLI_split_dirfile_basic(const char *string, char *dir, char *file) +void BLI_split_dirfile(const char *string, char *dir, char *file) { int lslash=0, i = 0; for (i=0; string[i]!='\0'; i++) { @@ -1183,128 +1183,6 @@ void BLI_split_dirfile_basic(const char *string, char *dir, char *file) } } - -/* Warning, - * - May modify 'string' variable - * - May create the directory if it dosnt exist - * if this is not needed use BLI_split_dirfile_basic(...) - */ -void BLI_split_dirfile(char *string, char *dir, char *file) -{ - int a; -#ifdef WIN32 - int sl; - short is_relative = 0; - char path[FILE_MAX]; -#endif - - dir[0]= 0; - file[0]= 0; - -#ifdef WIN32 - BLI_strncpy(path, string, FILE_MAX); - BLI_char_switch(path, '/', '\\'); /* make sure we have a valid path format */ - sl = strlen(path); - if (sl) { - int len; - if (path[0] == '/' || path[0] == '\\') { - BLI_strncpy(dir, path, FILE_MAXDIR); - if (sl > 1 && path[0] == '\\' && path[1] == '\\') is_relative = 1; - } else if (sl > 2 && path[1] == ':' && path[2] == '\\') { - BLI_strncpy(dir, path, FILE_MAXDIR); - } else { - BLI_getwdN(dir); - strcat(dir,"\\"); - strcat(dir,path); - BLI_strncpy(path,dir,FILE_MAXDIR+FILE_MAXFILE); - } - - // BLI_exist doesn't recognize a slashed dirname as a dir - // check if a trailing slash exists, and remove it. Do not do this - // when we are already at root. -jesterKing - a = strlen(dir); - if(a>=4 && dir[a-1]=='\\') dir[a-1] = 0; - - if (is_relative) { - printf("WARNING: BLI_split_dirfile needs absolute dir\n"); - } - else { - BLI_make_exist(dir); - } - - if (S_ISDIR(BLI_exist(dir))) { - - /* copy from end of string into file, to ensure filename itself isn't truncated - if string is too long. (aphex) */ - - len = FILE_MAXFILE - strlen(path); - - if (len < 0) - BLI_strncpy(file,path + abs(len),FILE_MAXFILE); - else - BLI_strncpy(file,path,FILE_MAXFILE); - - if (strrchr(path,'\\')) { - BLI_strncpy(file,strrchr(path,'\\')+1,FILE_MAXFILE); - } - - if ( (a = strlen(dir)) ) { - if (dir[a-1] != '\\') strcat(dir,"\\"); - } - } - else { - a = strlen(dir) - 1; - while(a>0 && dir[a] != '\\') a--; - dir[a + 1] = 0; - BLI_strncpy(file, path + strlen(dir),FILE_MAXFILE); - } - - } - else { - /* defaulting to first valid drive hoping it's not empty CD and DVD drives */ - get_default_root(dir); - file[0]=0; - } -#else - if (strlen(string)) { - if (string[0] == '/') { - strcpy(dir, string); - } else if (string[1] == ':' && string[2] == '\\') { - string+=2; - strcpy(dir, string); - } else { - BLI_getwdN(dir); - strcat(dir,"/"); - strcat(dir,string); - strcpy((char *)string,dir); - } - - BLI_make_exist(dir); - - if (S_ISDIR(BLI_exist(dir))) { - strcpy(file,string + strlen(dir)); - - if (strrchr(file,'/')) strcpy(file,strrchr(file,'/')+1); - - if ( (a = strlen(dir)) ) { - if (dir[a-1] != '/') strcat(dir,"/"); - } - } - else { - a = strlen(dir) - 1; - while(dir[a] != '/') a--; - dir[a + 1] = 0; - strcpy(file, string + strlen(dir)); - } - } - else { - BLI_getwdN(dir); - strcat(dir, "/"); - file[0] = 0; - } -#endif -} - /* simple appending of filename to dir, does not check for valid path! */ void BLI_join_dirfile(char *string, const char *dir, const char *file) { @@ -1363,7 +1241,7 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char if (rel) rel[0]= 0; - BLI_split_dirfile_basic(base_dir, blend_dir, NULL); + BLI_split_dirfile(base_dir, blend_dir, NULL); if (src_dir[0]=='\0') return 0; @@ -1374,7 +1252,7 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char BLI_convertstringcode(path, base_dir); /* get the directory part */ - BLI_split_dirfile_basic(path, dir, base); + BLI_split_dirfile(path, dir, base); len= strlen(blend_dir); |