rename some functions to use easier to understand names.
'BLI_makestringcode' --> 'BLI_path_rel' 'BLI_convertstringcwd' --> 'BLI_path_cwd' 'BLI_convertstringframe' --> 'BLI_path_frame' 'BLI_convertstringframe_range' --> 'BLI_path_frame_range' 'BLI_make_cwdpath' --> 'BLI_path_cwd'
This commit is contained in:
@@ -2315,7 +2315,7 @@ static void customdata_external_filename(char filename[FILE_MAX], ID *id, Custom
|
||||
char *path = (id->lib)? id->lib->filename: G.sce;
|
||||
|
||||
BLI_strncpy(filename, external->filename, FILE_MAX);
|
||||
BLI_convertstringcode(filename, path);
|
||||
BLI_path_abs(filename, path);
|
||||
}
|
||||
|
||||
void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int totelem)
|
||||
|
||||
@@ -431,8 +431,8 @@ DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifie
|
||||
strcat(targetDir,"fluidsurface_final_####");
|
||||
}
|
||||
|
||||
BLI_convertstringcode(targetDir, G.sce);
|
||||
BLI_convertstringframe(targetDir, curFrame, 0); // fixed #frame-no
|
||||
BLI_path_abs(targetDir, G.sce);
|
||||
BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no
|
||||
|
||||
strcpy(targetFile,targetDir);
|
||||
strcat(targetFile, ".bobj.gz");
|
||||
|
||||
@@ -391,7 +391,7 @@ Image *BKE_add_image_file(const char *name, int frame)
|
||||
}
|
||||
|
||||
BLI_strncpy(str, name, sizeof(str));
|
||||
BLI_convertstringcode(str, G.sce);
|
||||
BLI_path_abs(str, G.sce);
|
||||
|
||||
/* exists? */
|
||||
file= open(str, O_BINARY|O_RDONLY);
|
||||
@@ -402,7 +402,7 @@ Image *BKE_add_image_file(const char *name, int frame)
|
||||
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);
|
||||
BLI_path_abs(strtest, G.sce);
|
||||
|
||||
if( strcmp(strtest, str)==0 ) {
|
||||
if(ima->anim==NULL || ima->id.us==0) {
|
||||
@@ -1428,8 +1428,8 @@ void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_
|
||||
{
|
||||
if (string==NULL) return;
|
||||
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
|
||||
BLI_convertstringcode(string, G.sce);
|
||||
BLI_convertstringframe(string, frame, 4);
|
||||
BLI_path_abs(string, G.sce);
|
||||
BLI_path_frame(string, frame, 4);
|
||||
|
||||
if(use_ext)
|
||||
BKE_add_image_extension(string, imtype);
|
||||
@@ -1684,9 +1684,9 @@ 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);
|
||||
BLI_path_abs(name, ima->id.lib->filename);
|
||||
else
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
/* read ibuf */
|
||||
ibuf = IMB_loadiffname(name, IB_rect|IB_multilayer);
|
||||
@@ -1791,9 +1791,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);
|
||||
BLI_path_abs(str, ima->id.lib->filename);
|
||||
else
|
||||
BLI_convertstringcode(str, G.sce);
|
||||
BLI_path_abs(str, G.sce);
|
||||
|
||||
ima->anim = openanim(str, IB_cmap | IB_rect);
|
||||
|
||||
@@ -1845,11 +1845,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);
|
||||
BLI_path_abs(str, ima->id.lib->filename);
|
||||
else
|
||||
BLI_convertstringcode(str, G.sce);
|
||||
BLI_path_abs(str, G.sce);
|
||||
|
||||
BLI_convertstringframe(str, cfra, 0);
|
||||
BLI_path_frame(str, cfra, 0);
|
||||
|
||||
/* read ibuf */
|
||||
ibuf = IMB_loadiffname(str, IB_rect|IB_multilayer|IB_imginfo);
|
||||
|
||||
@@ -1244,8 +1244,8 @@ 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);
|
||||
BLI_makestringcode(G.sce, ima->name);
|
||||
BLI_path_abs(ima->name, ima->id.lib->filename);
|
||||
BLI_path_rel(ima->name, G.sce);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename)
|
||||
// convert relative filenames to absolute filenames
|
||||
|
||||
strcpy(name, filename);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
// open the file
|
||||
// and create a PackedFile structure
|
||||
@@ -274,7 +274,7 @@ int writePackedFile(ReportList *reports, char *filename, PackedFile *pf, int gui
|
||||
if (guimode); //XXX waitcursor(1);
|
||||
|
||||
strcpy(name, filename);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
if (BLI_exists(name)) {
|
||||
for (number = 1; number <= 999; number++) {
|
||||
@@ -339,7 +339,7 @@ int checkPackedFile(char *filename, PackedFile *pf)
|
||||
char name[FILE_MAXDIR + FILE_MAXFILE];
|
||||
|
||||
strcpy(name, filename);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
if (stat(name, &st)) {
|
||||
ret_val = PF_NOFILE;
|
||||
|
||||
@@ -3567,8 +3567,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra)
|
||||
// ok, start loading
|
||||
strcpy(filename, fss->surfdataPath);
|
||||
strcat(filename, suffix);
|
||||
BLI_convertstringcode(filename, G.sce);
|
||||
BLI_convertstringframe(filename, curFrame, 0); // fixed #frame-no
|
||||
BLI_path_abs(filename, G.sce);
|
||||
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
|
||||
strcat(filename, suffix2);
|
||||
|
||||
gzf = gzopen(filename, "rb");
|
||||
|
||||
@@ -1064,7 +1064,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
|
||||
file[i-6] = '\0';
|
||||
|
||||
snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
|
||||
BLI_convertstringcode(filename, blendfilename);
|
||||
BLI_path_abs(filename, blendfilename);
|
||||
return BLI_add_slash(filename); /* new strlen() */
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq)
|
||||
if (seq->type != SEQ_SCENE && seq->type != SEQ_META &&
|
||||
seq->type != SEQ_IMAGE) {
|
||||
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_convertstringcode(str, G.sce);
|
||||
BLI_path_abs(str, G.sce);
|
||||
}
|
||||
|
||||
if (seq->type == SEQ_IMAGE) {
|
||||
@@ -1247,7 +1247,7 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na
|
||||
|
||||
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
|
||||
BLI_join_dirfile(name, dir, seq->strip->proxy->file);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1276,8 +1276,8 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na
|
||||
render_size);
|
||||
}
|
||||
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_convertstringframe(name, frameno, 0);
|
||||
BLI_path_abs(name, G.sce);
|
||||
BLI_path_frame(name, frameno, 0);
|
||||
|
||||
|
||||
strcat(name, ".jpg");
|
||||
@@ -2044,7 +2044,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
|
||||
if(se->ok == STRIPELEM_OK && se->ibuf == 0) {
|
||||
StripElem * s_elem = give_stripelem(seq, cfra);
|
||||
BLI_join_dirfile(name, seq->strip->dir, s_elem->name);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
if (!build_proxy_run) {
|
||||
se->ibuf = seq_proxy_fetch(scene, seq, cfra, render_size);
|
||||
}
|
||||
@@ -2078,7 +2078,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
|
||||
if (se->ibuf == 0) {
|
||||
if(seq->anim==0) {
|
||||
BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
seq->anim = openanim(
|
||||
name, IB_rect |
|
||||
|
||||
@@ -127,7 +127,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename)
|
||||
int len;
|
||||
|
||||
strcpy(str, filename);
|
||||
BLI_convertstringcode(str, bmain->name);
|
||||
BLI_path_abs(str, bmain->name);
|
||||
|
||||
len = strlen(filename);
|
||||
while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
|
||||
@@ -262,7 +262,7 @@ void sound_load(struct Main *bmain, struct bSound* sound)
|
||||
else
|
||||
path = bmain ? bmain->name : G.sce;
|
||||
|
||||
BLI_convertstringcode(fullpath, path);
|
||||
BLI_path_abs(fullpath, path);
|
||||
|
||||
/* but we need a packed file then */
|
||||
if (pf)
|
||||
|
||||
@@ -246,7 +246,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);
|
||||
BLI_path_abs(str, G.sce);
|
||||
BLI_split_dirfile(str, NULL, sfile);
|
||||
|
||||
fp= fopen(str, "r");
|
||||
@@ -344,7 +344,7 @@ Text *add_text(char *file, const char *relpath)
|
||||
|
||||
BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
|
||||
if (relpath) /* can be NULL (bg mode) */
|
||||
BLI_convertstringcode(str, relpath);
|
||||
BLI_path_abs(str, relpath);
|
||||
BLI_split_dirfile(str, NULL, sfile);
|
||||
|
||||
fp= fopen(str, "r");
|
||||
|
||||
@@ -124,12 +124,12 @@ static void filepath_avi (char *string, RenderData *rd)
|
||||
if (string==NULL) return;
|
||||
|
||||
strcpy(string, rd->pic);
|
||||
BLI_convertstringcode(string, G.sce);
|
||||
BLI_path_abs(string, G.sce);
|
||||
|
||||
BLI_make_existing_file(string);
|
||||
|
||||
if (!BLI_testextensie(string, ".avi")) {
|
||||
BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4);
|
||||
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
|
||||
strcat(string, ".avi");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,7 +789,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) {
|
||||
if (!string || !exts) return;
|
||||
|
||||
strcpy(string, rd->pic);
|
||||
BLI_convertstringcode(string, G.sce);
|
||||
BLI_path_abs(string, G.sce);
|
||||
|
||||
BLI_make_existing_file(string);
|
||||
|
||||
@@ -810,7 +810,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) {
|
||||
if (!*fe) {
|
||||
strcat(string, autosplit);
|
||||
|
||||
BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4);
|
||||
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
|
||||
strcat(string, *exts);
|
||||
} else {
|
||||
*(string + strlen(string) - strlen(*fe)) = 0;
|
||||
|
||||
@@ -96,12 +96,12 @@ int BLI_has_parent(char *path);
|
||||
* @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 BLI_convertstringframe(char *path, int frame, int digits);
|
||||
int BLI_convertstringframe_range(char *path, int sta, int end, int digits);
|
||||
int BLI_convertstringcwd(char *path);
|
||||
int BLI_path_abs(char *path, const char *basepath);
|
||||
int BLI_path_frame(char *path, int frame, int digits);
|
||||
int BLI_path_frame_range(char *path, int sta, int end, int digits);
|
||||
int BLI_path_cwd(char *path);
|
||||
|
||||
void BLI_makestringcode(const char *relfile, char *file);
|
||||
void BLI_path_rel(char *file, const char *relfile);
|
||||
|
||||
/**
|
||||
* Change every @a from in @a string into @a to. The
|
||||
|
||||
@@ -137,9 +137,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);
|
||||
BLI_path_abs(path_expanded, libpath);
|
||||
} else { /* local data, use the blend files path */
|
||||
BLI_convertstringcode(path_expanded, bpi->base_path);
|
||||
BLI_path_abs(path_expanded, bpi->base_path);
|
||||
}
|
||||
}
|
||||
char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
|
||||
@@ -533,7 +533,7 @@ void makeFilesRelative(char *basepath, ReportList *reports) {
|
||||
/* Important BLI_cleanup_dir runs before the path is made relative
|
||||
* because it wont work for paths that start with "//../" */
|
||||
BLI_cleanup_file(bpi.base_path, filepath_relative); /* fix any /foo/../foo/ */
|
||||
BLI_makestringcode(bpi.base_path, filepath_relative);
|
||||
BLI_path_rel(filepath_relative, bpi.base_path);
|
||||
/* be safe and check the length */
|
||||
if (BLI_bpathIterator_getPathMaxLen(&bpi) <= strlen(filepath_relative)) {
|
||||
bpath_as_report(&bpi, "couldn't make path relative (too long)", reports);
|
||||
@@ -709,7 +709,7 @@ void findMissingFiles(char *basepath, char *str) {
|
||||
} else {
|
||||
/* copy the found path into the old one */
|
||||
if (G.relbase_valid)
|
||||
BLI_makestringcode(bpi.base_path, filename_new);
|
||||
BLI_path_rel(filename_new, bpi.base_path);
|
||||
|
||||
BLI_bpathIterator_setPath( &bpi, filename_new );
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ void BLI_cleanup_file(const char *relabase, char *dir)
|
||||
short a;
|
||||
char *start, *eind;
|
||||
if (relabase) {
|
||||
BLI_convertstringcode(dir, relabase);
|
||||
BLI_path_abs(dir, relabase);
|
||||
} else {
|
||||
if (dir[0]=='/' && dir[1]=='/') {
|
||||
if (dir[2]== '\0') {
|
||||
@@ -369,7 +369,7 @@ void BLI_cleanup_file(const char *relabase, char *dir)
|
||||
}
|
||||
|
||||
|
||||
void BLI_makestringcode(const char *relfile, char *file)
|
||||
void BLI_path_rel(char *file, const char *relfile)
|
||||
{
|
||||
char * p;
|
||||
char * q;
|
||||
@@ -542,7 +542,7 @@ static void ensure_digits(char *path, int digits)
|
||||
}
|
||||
}
|
||||
|
||||
int BLI_convertstringframe(char *path, int frame, int digits)
|
||||
int BLI_path_frame(char *path, int frame, int digits)
|
||||
{
|
||||
int ch_sta, ch_end;
|
||||
|
||||
@@ -559,7 +559,7 @@ int BLI_convertstringframe(char *path, int frame, int digits)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BLI_convertstringframe_range(char *path, int sta, int end, int digits)
|
||||
int BLI_path_frame_range(char *path, int sta, int end, int digits)
|
||||
{
|
||||
int ch_sta, ch_end;
|
||||
|
||||
@@ -576,7 +576,7 @@ int BLI_convertstringframe_range(char *path, int sta, int end, int digits)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BLI_convertstringcode(char *path, const char *basepath)
|
||||
int BLI_path_abs(char *path, const char *basepath)
|
||||
{
|
||||
int wasrelative = (strncmp(path, "//", 2)==0);
|
||||
char tmp[FILE_MAX];
|
||||
@@ -677,7 +677,7 @@ int BLI_convertstringcode(char *path, const char *basepath)
|
||||
* Should only be done with command line paths.
|
||||
* this is NOT somthing blenders internal paths support like the // prefix
|
||||
*/
|
||||
int BLI_convertstringcwd(char *path)
|
||||
int BLI_path_cwd(char *path)
|
||||
{
|
||||
int wasrelative = 1;
|
||||
int filelen = strlen(path);
|
||||
@@ -1249,7 +1249,7 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char
|
||||
BLI_strncpy(path, src_dir, sizeof(path));
|
||||
|
||||
/* expand "//" in filename and get absolute path */
|
||||
BLI_convertstringcode(path, base_dir);
|
||||
BLI_path_abs(path, base_dir);
|
||||
|
||||
/* get the directory part */
|
||||
BLI_split_dirfile(path, dir, base);
|
||||
|
||||
@@ -5210,7 +5210,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
|
||||
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
|
||||
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
|
||||
strncpy(lib->name, lib->filename, sizeof(lib->name));
|
||||
BLI_makestringcode(basepath, lib->name);
|
||||
BLI_path_rel(lib->name, basepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9614,7 +9614,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
{
|
||||
char str[FILE_MAX];
|
||||
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_convertstringcode(str, G.sce);
|
||||
BLI_path_abs(str, G.sce);
|
||||
seq->sound = sound_new_file(main, str);
|
||||
}
|
||||
}
|
||||
@@ -11957,13 +11957,13 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
|
||||
read_libraries(*fd, &(*fd)->mainlist);
|
||||
|
||||
/* make the lib path relative if required */
|
||||
if(flag & FILE_STRINGCODE) {
|
||||
if(flag & FILE_RELPATH) {
|
||||
|
||||
/* use the full path, this could have been read by other library even */
|
||||
BLI_strncpy(mainl->curlib->name, mainl->curlib->filename, sizeof(mainl->curlib->name));
|
||||
|
||||
/* uses current .blend file as reference */
|
||||
BLI_makestringcode(G.sce, mainl->curlib->name);
|
||||
BLI_path_rel(mainl->curlib->name, G.sce);
|
||||
}
|
||||
|
||||
blo_join_main(&(*fd)->mainlist);
|
||||
|
||||
@@ -1441,7 +1441,7 @@ public:
|
||||
|
||||
// make absolute source path
|
||||
BLI_strncpy(src, image->name, sizeof(src));
|
||||
BLI_convertstringcode(src, G.sce);
|
||||
BLI_path_abs(src, G.sce);
|
||||
|
||||
// make dest directory if it doesn't exist
|
||||
BLI_make_existing_file(abs);
|
||||
|
||||
@@ -565,7 +565,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
int err;
|
||||
|
||||
strcpy(tmpStr, G.selfont->name);
|
||||
BLI_convertstringcode(tmpStr, G.sce);
|
||||
BLI_path_abs(tmpStr, G.sce);
|
||||
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,7 +891,7 @@ static int multires_save_external_exec(bContext *C, wmOperator *op)
|
||||
|
||||
RNA_string_get(op->ptr, "path", path);
|
||||
if(G.save_over)
|
||||
BLI_makestringcode(G.sce, path); /* make relative */
|
||||
BLI_path_rel(path, G.sce);
|
||||
|
||||
CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path);
|
||||
CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0);
|
||||
|
||||
@@ -563,7 +563,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
|
||||
// prepare names...
|
||||
strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
|
||||
strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
|
||||
BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no
|
||||
BLI_path_abs(targetDir, G.sce); // fixed #frame-no
|
||||
|
||||
strcpy(targetFile, targetDir);
|
||||
strcat(targetFile, suffixConfig);
|
||||
@@ -615,7 +615,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
|
||||
if(selection<1) return 0; // 0 from menu, or -1 aborted
|
||||
strcpy(targetDir, newSurfdataPath);
|
||||
strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
|
||||
BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no
|
||||
BLI_path_abs(targetDir, G.sce); // fixed #frame-no
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -80,7 +80,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
|
||||
RNA_string_get(op->ptr, "path", path);
|
||||
|
||||
strcpy(G.ima, path);
|
||||
BLI_convertstringcode(path, G.sce);
|
||||
BLI_path_abs(path, G.sce);
|
||||
|
||||
/* BKE_add_image_extension() checks for if extension was already set */
|
||||
if(scene->r.scemode & R_EXTENSION)
|
||||
|
||||
@@ -592,7 +592,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
|
||||
|
||||
if(RNA_struct_find_property(op->ptr, "relative_path"))
|
||||
if(RNA_boolean_get(op->ptr, "relative_path"))
|
||||
BLI_makestringcode(G.sce, name);
|
||||
BLI_path_rel(name, G.sce);
|
||||
|
||||
RNA_string_set(op->ptr, "path", name);
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
|
||||
BLI_cleanup_dir(G.sce, params->dir);
|
||||
} else {
|
||||
/* if operator has path set, use it, otherwise keep the last */
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
BLI_split_dirfile(name, dir, file);
|
||||
BLI_strncpy(params->file, file, sizeof(params->file));
|
||||
BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
|
||||
|
||||
@@ -105,7 +105,7 @@ static void save_rendered_image_cb_real(char *name, int confirm)
|
||||
BKE_add_image_extension(name, scene->r.imtype);
|
||||
|
||||
strcpy(str, name);
|
||||
BLI_convertstringcode(str, G.sce);
|
||||
BLI_path_abs(str, G.sce);
|
||||
|
||||
if (confirm)
|
||||
overwrite = saveover(str);
|
||||
|
||||
@@ -817,7 +817,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
|
||||
|
||||
if (ibuf) {
|
||||
int relative= RNA_boolean_get(op->ptr, "relative_path");
|
||||
BLI_convertstringcode(path, G.sce);
|
||||
BLI_path_abs(path, G.sce);
|
||||
|
||||
if(scene->r.scemode & R_EXTENSION) {
|
||||
BKE_add_image_extension(path, sima->imtypenr);
|
||||
@@ -837,7 +837,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
|
||||
RE_WriteRenderResult(rr, path, scene->r.quality);
|
||||
|
||||
if(relative)
|
||||
BLI_makestringcode(G.sce, path); /* only after saving */
|
||||
BLI_path_rel(path, G.sce); /* only after saving */
|
||||
|
||||
BLI_strncpy(ima->name, path, sizeof(ima->name));
|
||||
BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
|
||||
@@ -855,7 +855,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
|
||||
char *name;
|
||||
|
||||
if(relative)
|
||||
BLI_makestringcode(G.sce, path); /* only after saving */
|
||||
BLI_path_rel(path, G.sce); /* only after saving */
|
||||
|
||||
BLI_strncpy(ima->name, path, sizeof(ima->name));
|
||||
BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
|
||||
@@ -1094,7 +1094,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op)
|
||||
char name[FILE_MAX];
|
||||
BLI_strncpy(name, ibuf->name, sizeof(name));
|
||||
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name);
|
||||
|
||||
@@ -4816,7 +4816,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
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);
|
||||
BLI_path_abs(expanded, G.sce);
|
||||
if (!BLI_exists(expanded)) {
|
||||
error("This path does not exist, correct this before saving");
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ static void txt_write_file(Text *text, ReportList *reports)
|
||||
char file[FILE_MAXDIR+FILE_MAXFILE];
|
||||
|
||||
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_convertstringcode(file, G.sce);
|
||||
BLI_path_abs(file, G.sce);
|
||||
|
||||
fp= fopen(file, "w");
|
||||
if(fp==NULL) {
|
||||
@@ -2542,7 +2542,7 @@ int text_file_modified(Text *text)
|
||||
return 0;
|
||||
|
||||
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_convertstringcode(file, G.sce);
|
||||
BLI_path_abs(file, G.sce);
|
||||
|
||||
if(!BLI_exists(file))
|
||||
return 2;
|
||||
@@ -2570,7 +2570,7 @@ static void text_ignore_modified(Text *text)
|
||||
if(!text || !text->name) return;
|
||||
|
||||
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_convertstringcode(file, G.sce);
|
||||
BLI_path_abs(file, G.sce);
|
||||
|
||||
if(!BLI_exists(file)) return;
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ enum FileSortTypeE {
|
||||
|
||||
/* sfile->flag and simasel->flag */
|
||||
#define FILE_SHOWSHORT 1
|
||||
#define FILE_STRINGCODE 2
|
||||
#define FILE_RELPATH 2 /* was FILE_STRINGCODE */
|
||||
#define FILE_LINK 4
|
||||
#define FILE_HIDE_DOT 8
|
||||
#define FILE_AUTOSELECT 16
|
||||
@@ -814,31 +814,6 @@ enum {
|
||||
#define C_HI 0xCBBBBB
|
||||
#define C_LO 0x544444
|
||||
|
||||
/* queue settings */
|
||||
#define IMS_KNOW_WIN 1
|
||||
#define IMS_KNOW_BIP 2
|
||||
#define IMS_KNOW_DIR 4
|
||||
#define IMS_DOTHE_INF 8
|
||||
#define IMS_KNOW_INF 16
|
||||
#define IMS_DOTHE_IMA 32
|
||||
#define IMS_KNOW_IMA 64
|
||||
#define IMS_FOUND_BIP 128
|
||||
#define IMS_DOTHE_BIP 256
|
||||
#define IMS_WRITE_NO_BIP 512
|
||||
|
||||
/* imasel->mode */
|
||||
#define IMS_NOIMA 0
|
||||
#define IMS_IMA 1
|
||||
#define IMS_ANIM 2
|
||||
#define IMS_DIR 4
|
||||
#define IMS_FILE 8
|
||||
#define IMS_STRINGCODE 16
|
||||
|
||||
#define IMS_INDIR 1
|
||||
#define IMS_INDIRSLI 2
|
||||
#define IMS_INFILE 3
|
||||
#define IMS_INFILESLI 4
|
||||
|
||||
/* nla->flag */
|
||||
/* flags (1<<0), (1<<1), and (1<<3) are depreceated flags from old blenders */
|
||||
/* draw timing in seconds instead of frames */
|
||||
|
||||
@@ -87,7 +87,7 @@ static void rna_Image_save(Image *image, ReportList *reports)
|
||||
if(ibuf) {
|
||||
char filename[FILE_MAXDIR + FILE_MAXFILE];
|
||||
BLI_strncpy(filename, image->name, sizeof(filename));
|
||||
BLI_convertstringcode(filename, G.sce);
|
||||
BLI_path_abs(filename, G.sce);
|
||||
|
||||
if(image->packedfile) {
|
||||
if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) {
|
||||
|
||||
@@ -166,7 +166,7 @@ void filepath_qt(char *string, RenderData *rd) {
|
||||
if (strchr(string, '#')==NULL)
|
||||
strcat(string, "####"); /* 4 numbers */
|
||||
|
||||
BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4);
|
||||
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
|
||||
strcat(string, ".mov");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ void filepath_qt(char *string, RenderData *rd) {
|
||||
if (string==0) return;
|
||||
|
||||
strcpy(string, rd->pic);
|
||||
BLI_convertstringcode(string, G.sce);
|
||||
BLI_path_abs(string, G.sce);
|
||||
|
||||
BLI_make_existing_file(string);
|
||||
|
||||
|
||||
@@ -2120,8 +2120,8 @@ static void load_backbuffer(Render *re)
|
||||
char name[256];
|
||||
|
||||
strcpy(name, re->r.backbuf);
|
||||
BLI_convertstringcode(name, G.sce);
|
||||
BLI_convertstringframe(name, re->r.cfra, 0);
|
||||
BLI_path_abs(name, G.sce);
|
||||
BLI_path_frame(name, re->r.cfra, 0);
|
||||
|
||||
if(re->backbuf) {
|
||||
re->backbuf->id.us--;
|
||||
|
||||
@@ -1410,7 +1410,7 @@ static short wm_link_append_flag(wmOperator *op)
|
||||
|
||||
if(RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
|
||||
if(RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
|
||||
if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_STRINGCODE;
|
||||
if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
|
||||
if(RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
|
||||
if(RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
|
||||
return flag;
|
||||
|
||||
@@ -776,7 +776,7 @@ static int run_python(int argc, char **argv, void *data)
|
||||
/* Make the path absolute because its needed for relative linked blends to be found */
|
||||
char filename[FILE_MAXDIR + FILE_MAXFILE];
|
||||
BLI_strncpy(filename, argv[1], sizeof(filename));
|
||||
BLI_convertstringcwd(filename);
|
||||
BLI_path_cwd(filename);
|
||||
|
||||
/* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
|
||||
if (argc > 1) {
|
||||
@@ -813,7 +813,7 @@ static int load_file(int argc, char **argv, void *data)
|
||||
/* Make the path absolute because its needed for relative linked blends to be found */
|
||||
char filename[FILE_MAXDIR + FILE_MAXFILE];
|
||||
BLI_strncpy(filename, argv[0], sizeof(filename));
|
||||
BLI_convertstringcwd(filename);
|
||||
BLI_path_cwd(filename);
|
||||
|
||||
if (G.background) {
|
||||
int retval = BKE_read_file(C, filename, NULL, NULL);
|
||||
|
||||
@@ -283,7 +283,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
|
||||
// to the first file but that makes no sense, relative paths in
|
||||
// blend files should be relative to that file, not some other file
|
||||
// that happened to be loaded first
|
||||
BLI_convertstringcode(basedpath, pathname);
|
||||
BLI_path_abs(basedpath, pathname);
|
||||
bfd = load_game_data(basedpath);
|
||||
|
||||
// if it wasn't loaded, try it forced relative
|
||||
@@ -294,7 +294,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
|
||||
strcpy(temppath, "//");
|
||||
strcat(temppath, basedpath);
|
||||
|
||||
BLI_convertstringcode(temppath, pathname);
|
||||
BLI_path_abs(temppath, pathname);
|
||||
bfd = load_game_data(temppath);
|
||||
}
|
||||
|
||||
|
||||
@@ -681,7 +681,7 @@ int main(int argc, char** argv)
|
||||
|
||||
get_filename(argc_py_clamped, argv, filename);
|
||||
if(filename[0])
|
||||
BLI_convertstringcwd(filename);
|
||||
BLI_path_cwd(filename);
|
||||
|
||||
do
|
||||
{
|
||||
@@ -695,7 +695,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// base the actuator filename relative to the last file
|
||||
strcpy(basedpath, exitstring.Ptr());
|
||||
BLI_convertstringcode(basedpath, pathname);
|
||||
BLI_path_abs(basedpath, pathname);
|
||||
|
||||
bfd = load_game_data(basedpath);
|
||||
|
||||
@@ -706,7 +706,7 @@ int main(int argc, char** argv)
|
||||
strcpy(temppath, "//");
|
||||
strcat(temppath, basedpath);
|
||||
|
||||
BLI_convertstringcode(temppath, pathname);
|
||||
BLI_path_abs(temppath, pathname);
|
||||
bfd = load_game_data(temppath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ static PyObject* gPyExpandPath(PyObject*, PyObject* args)
|
||||
return NULL;
|
||||
|
||||
BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
|
||||
BLI_convertstringcode(expanded, gp_GamePythonPath);
|
||||
BLI_path_abs(expanded, gp_GamePythonPath);
|
||||
return PyUnicode_FromString(expanded);
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
|
||||
|
||||
if (searchpath) {
|
||||
BLI_strncpy(cpath, searchpath, FILE_MAXDIR + FILE_MAXFILE);
|
||||
BLI_convertstringcode(cpath, gp_GamePythonPath);
|
||||
BLI_path_abs(cpath, gp_GamePythonPath);
|
||||
} else {
|
||||
/* Get the dir only */
|
||||
BLI_split_dirfile(gp_GamePythonPath, cpath, NULL);
|
||||
@@ -1787,7 +1787,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename)
|
||||
char expanded[FILE_MAXDIR + FILE_MAXFILE];
|
||||
|
||||
BLI_split_dirfile(filename, expanded, NULL); /* get the dir part of filename only */
|
||||
BLI_convertstringcode(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
|
||||
BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
|
||||
BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
|
||||
item= PyUnicode_FromString(expanded);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user