diff options
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeavi.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 7 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 29 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/writeimage.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 2 |
11 files changed, 38 insertions, 39 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index cca3d561ed4..a05e8516260 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -392,7 +392,6 @@ Image *BKE_add_image_file(const char *name, int frame) BLI_strncpy(str, name, sizeof(str)); BLI_convertstringcode(str, G.sce); - BLI_convertstringframe(str, frame); /* exists? */ file= open(str, O_BINARY|O_RDONLY); @@ -404,7 +403,6 @@ Image *BKE_add_image_file(const char *name, int frame) 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_convertstringframe(strtest, frame); if( strcmp(strtest, str)==0 ) { if(ima->anim==NULL || ima->id.us==0) { @@ -1412,15 +1410,9 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext) { if (string==NULL) return; - BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */ - - /* if we dont have any #'s to insert numbers into, use 4 numbers by default */ - if (strchr(string, '#')==NULL) - strcat(string, "####"); /* 4 numbers */ - BLI_convertstringcode(string, G.sce); - BLI_convertstringframe(string, frame); + BLI_convertstringframe(string, frame, 4); if(use_ext) BKE_add_image_extension(string, imtype); @@ -1675,8 +1667,6 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) else BLI_convertstringcode(name, G.sce); - BLI_convertstringframe(name, frame); /* TODO - should this be here? */ - /* read ibuf */ ibuf = IMB_loadiffname(name, IB_rect|IB_multilayer); if(G.f & G_DEBUG) printf("loaded %s\n", name); @@ -1838,7 +1828,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) else BLI_convertstringcode(str, G.sce); - BLI_convertstringframe(str, cfra); + BLI_convertstringframe(str, cfra, 0); /* read ibuf */ ibuf = IMB_loadiffname(str, IB_rect|IB_multilayer|IB_imginfo); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index ad32f578a10..9fde0730011 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -583,8 +583,6 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq) seq->type != SEQ_IMAGE) { BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); BLI_convertstringcode(str, G.sce); - BLI_convertstringframe(str, scene->r.cfra); - } if (seq->type == SEQ_IMAGE) { @@ -1190,7 +1188,6 @@ 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_convertstringframe(name, cfra); return TRUE; } @@ -1220,8 +1217,8 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na } BLI_convertstringcode(name, G.sce); - BLI_convertstringframe(name, frameno); - + BLI_convertstringframe(name, frameno, 0); + strcat(name, ".jpg"); @@ -1988,7 +1985,6 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int StripElem * s_elem = give_stripelem(seq, cfra); BLI_join_dirfile(name, seq->strip->dir, s_elem->name); BLI_convertstringcode(name, G.sce); - BLI_convertstringframe(name, scene->r.cfra); if (!build_proxy_run) { se->ibuf = seq_proxy_fetch(scene, seq, cfra, render_size); } @@ -2023,7 +2019,6 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int if(seq->anim==0) { BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name); BLI_convertstringcode(name, G.sce); - BLI_convertstringframe(name, scene->r.cfra); seq->anim = openanim( name, IB_rect | diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 0d057525f38..a6092790706 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -129,11 +129,7 @@ static void filepath_avi (char *string, RenderData *rd) BLI_make_existing_file(string); if (!BLI_testextensie(string, ".avi")) { - /* if we dont have any #'s to insert numbers into, use 4 numbers by default */ - if (strchr(string, '#')==NULL) - strcat(string, "####"); /* 4 numbers */ - - BLI_convertstringframe_range(string, rd->sfra, rd->efra); + BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4); strcat(string, ".avi"); } } diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 56924cb0dfa..9c38f84aa26 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -781,7 +781,6 @@ void filepath_ffmpeg(char* string, RenderData* rd) { strcpy(string, rd->pic); BLI_convertstringcode(string, G.sce); - BLI_convertstringframe(string, rd->cfra); BLI_make_existing_file(string); @@ -802,11 +801,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) { if (!*fe) { strcat(string, autosplit); - /* if we dont have any #'s to insert numbers into, use 4 numbers by default */ - if (strchr(string, '#')==NULL) - strcat(string, "####"); /* 4 numbers */ - - BLI_convertstringframe_range(string, rd->sfra, rd->efra); + BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4); strcat(string, *exts); } else { *(string + strlen(string) - strlen(*fe)) = 0; diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index f9ef3d8c828..8e97511f4c5 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -97,8 +97,8 @@ int BLI_has_parent(char *path); * @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 BLI_convertstringframe_range(char *path, int sta, int end); +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); void BLI_makestringcode(const char *relfile, char *file); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 895f2d1ee56..c3ce73df6c6 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -557,9 +557,30 @@ static int stringframe_chars(char *path, int *char_start, int *char_end) } } -int BLI_convertstringframe(char *path, int frame) +static void ensure_digits(char *path, int digits) +{ + char *file= BLI_last_slash(path); + + if(file==NULL) + file= path; + + if(strrchr(file, '#') == NULL) { + int len= strlen(file); + + while(digits--) { + file[len++]= '#'; + } + file[len]= '\0'; + } +} + +int BLI_convertstringframe(char *path, int frame, int digits) { int ch_sta, ch_end; + + if(digits) + ensure_digits(path, digits); + if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */ char tmp[FILE_MAX], format[64]; sprintf(format, "%%.%ds%%.%dd%%s", ch_sta, ch_end-ch_sta); /* example result: "%.12s%.5d%s" */ @@ -570,9 +591,13 @@ int BLI_convertstringframe(char *path, int frame) return 0; } -int BLI_convertstringframe_range(char *path, int sta, int end) +int BLI_convertstringframe_range(char *path, int sta, int end, int digits) { int ch_sta, ch_end; + + if(digits) + ensure_digits(path, digits); + if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */ char tmp[FILE_MAX], format[64]; sprintf(format, "%%.%ds%%.%dd_%%.%dd%%s", ch_sta, ch_end-ch_sta, ch_end-ch_sta); /* example result: "%.12s%.5d-%.5d%s" */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 39c2550bd79..14995944048 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9682,7 +9682,6 @@ 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_convertstringframe(str, scene->r.cfra); seq->sound = sound_new_file(main, str); } } diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index 9e8e3b7b058..5f0b75d068a 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -106,7 +106,6 @@ static void save_rendered_image_cb_real(char *name, int confirm) strcpy(str, name); BLI_convertstringcode(str, G.sce); - BLI_convertstringframe(str, scene->r.cfra); /* TODO - is this even used? */ if (confirm) overwrite = saveover(str); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 7dd26c31658..e8025e84a5e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -810,7 +810,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera if (ibuf) { BLI_convertstringcode(name, G.sce); - BLI_convertstringframe(name, scene->r.cfra); + BLI_convertstringframe(name, scene->r.cfra, 0); if(scene->r.scemode & R_EXTENSION) { BKE_add_image_extension(name, sima->imtypenr); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 34e2fc06ad7..0612520caec 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -98,7 +98,7 @@ char *rna_Image_get_abs_filename(Image *image, bContext *C) BLI_strncpy(filename, image->name, FILE_MAXDIR + FILE_MAXFILE); BLI_convertstringcode(filename, CTX_data_main(C)->name); - BLI_convertstringframe(filename, CTX_data_scene(C)->r.cfra); + BLI_convertstringframe(filename, CTX_data_scene(C)->r.cfra, 0); return filename; } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index eaafeec3a8a..6bd5aea70b1 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2084,7 +2084,7 @@ static void load_backbuffer(Render *re) strcpy(name, re->r.backbuf); BLI_convertstringcode(name, G.sce); - BLI_convertstringframe(name, re->r.cfra); + BLI_convertstringframe(name, re->r.cfra, 0); if(re->backbuf) { re->backbuf->id.us--; |