static void get_sequence_fname(MovieClip *clip, int framenr, char *name) { unsigned short numlen; char head[FILE_MAX], tail[FILE_MAX]; int offset; BLI_strncpy(name, clip->name, sizeof(clip->name)); BLI_stringdec(name, head, tail, &numlen); /* movieclips always points to first image from sequence, * autoguess offset for now. could be something smarter in the future */ offset = sequence_guess_offset(clip->name, strlen(head), numlen); if (numlen) BLI_stringenc(name, head, tail, numlen, offset + framenr - 1); else BLI_strncpy(name, clip->name, sizeof(clip->name)); BLI_path_abs(name, ID_BLEND_PATH(G.main, &clip->id)); }
void BLI_newname(char *name, int add) { char head[UNIQUE_NAME_MAX], tail[UNIQUE_NAME_MAX]; int pic; unsigned short digits; pic = BLI_stringdec(name, head, tail, &digits); /* are we going from 100 -> 99 or from 10 -> 9 */ if (add < 0 && digits < 4 && digits > 0) { int i, exp; exp = 1; for (i = digits; i > 1; i--) exp *= 10; if (pic >= exp && (pic + add) < exp) digits--; } pic += add; if (digits == 4 && pic < 0) pic = 0; BLI_stringenc(name, head, tail, digits, pic); }
static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) { BLI_stringenc(string, head, tail, numlen, pic); }