diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-05-04 13:41:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-05-04 13:41:15 +0400 |
commit | 110f927c636778fedddccb041553fc6040f4ffd8 (patch) | |
tree | 350e9e82b6406ab8e633286faade5e0af5be9272 /source/blender/blenkernel | |
parent | f95c1141db077ea9323dd4f1d8852e365aadb2b1 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeavi.c | 2 |
9 files changed, 32 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index f31c5a0d672..654cf0991cc 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -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"); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8a982b15df7..ff0b2e6db0a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -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); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8740a3d1ed4..cc3f3f211a4 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -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); } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 109f8bd9113..f6a65bd72a5 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -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; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 069dac60412..9dd21cdda4e 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -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"); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 3d73ba1e93f..7b727528b3d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -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); } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 3b14cb8adac..2c5b49246fb 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -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; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index d15160054ac..872f81ead63 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -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"); diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 3d85fe32193..44004eeee80 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -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); |