diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-04-11 19:47:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-04-11 19:47:21 +0400 |
commit | f057a38e985fe4db1c57f48864624985a31c9235 (patch) | |
tree | c9383d4b2727434e3971096ac8ea4101a84ac89b /source/blender/blenkernel/intern/image.c | |
parent | a02937d86ccb30f0cc08ef451634595fb45726c6 (diff) |
Changed BLI_convertstringcode to replace any number of hashes with the frame number.
somefile_##.png -> somefile_01.png
somefile_########-image.png -> somefile_00000001-image.png
Before, A hash at the end of the string would be replaced by a number with 4 characters. This is still default if no #'s are in the string, so nothing has changed.
To use this function from the python api use scene.render.getFrameFilename()
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 195f4aa4bbf..3f885017f95 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1236,24 +1236,16 @@ int BKE_write_ibuf(ImBuf *ibuf, char *name, int imtype, int subimtype, int quali void BKE_makepicstring(char *string, char *base, int frame, int imtype) { - short i, len, digits= 4; /* digits in G.scene? */ - char num[10]; - 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, frame); - len= strlen(string); - - i= digits - sprintf(num, "%d", frame); - for(; i>0; i--){ - string[len]= '0'; - len++; - } - string[len]= 0; - strcat(string, num); - if(G.scene->r.scemode & R_EXTENSION) BKE_add_image_extension(string, imtype); |