Fix T37591: 'Extensions' option ignored for movies.

This commit is contained in:
Campbell Barton 2013-11-25 16:59:10 +11:00
parent 8cb02561a9
commit d45ea33ff1
5 changed files with 50 additions and 21 deletions

@ -132,10 +132,17 @@ static void filepath_avi(char *string, RenderData *rd)
BLI_make_existing_file(string); BLI_make_existing_file(string);
if (rd->scemode & R_EXTENSION) {
if (!BLI_testextensie(string, ".avi")) { if (!BLI_testextensie(string, ".avi")) {
BLI_path_frame_range(string, rd->sfra, rd->efra, 4); BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
strcat(string, ".avi"); strcat(string, ".avi");
} }
}
else {
if (BLI_path_frame_check_chars(string)) {
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
}
}
} }
static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports) static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)

@ -1023,6 +1023,7 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd)
sprintf(autosplit, "_%03d", ffmpeg_autosplit_count); sprintf(autosplit, "_%03d", ffmpeg_autosplit_count);
} }
if (rd->scemode & R_EXTENSION) {
while (*fe) { while (*fe) {
if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0) { if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0) {
break; break;
@ -1041,6 +1042,14 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd)
strcat(string, autosplit); strcat(string, autosplit);
strcat(string, *fe); strcat(string, *fe);
} }
}
else {
if (BLI_path_frame_check_chars(string)) {
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
}
strcat(string, autosplit);
}
} }
int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports) int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)

@ -158,6 +158,7 @@ bool BLI_has_parent(char *path);
bool BLI_path_abs(char *path, const char *basepath); bool BLI_path_abs(char *path, const char *basepath);
bool BLI_path_frame(char *path, int frame, int digits); bool BLI_path_frame(char *path, int frame, int digits);
bool BLI_path_frame_range(char *path, int sta, int end, int digits); bool BLI_path_frame_range(char *path, int sta, int end, int digits);
bool BLI_path_frame_check_chars(const char *path);
bool BLI_path_cwd(char *path); bool BLI_path_cwd(char *path);
void BLI_path_rel(char *file, const char *relfile); void BLI_path_rel(char *file, const char *relfile);

@ -719,6 +719,15 @@ bool BLI_path_frame_range(char *path, int sta, int end, int digits)
return false; return false;
} }
/**
* Check if we have '#' chars, usable for #BLI_path_frame, #BLI_path_frame_range
*/
bool BLI_path_frame_check_chars(const char *path)
{
int ch_sta, ch_end; /* dummy args */
return stringframe_chars(path, &ch_sta, &ch_end);
}
/** /**
* If path begins with "//", strips that and replaces it with basepath directory. Also converts * If path begins with "//", strips that and replaces it with basepath directory. Also converts
* a drive-letter prefix to something more sensible if this is a non-drive-letter-based system. * a drive-letter prefix to something more sensible if this is a non-drive-letter-based system.

@ -243,14 +243,17 @@ void filepath_qt(char *string, RenderData *rd)
BLI_make_existing_file(string); BLI_make_existing_file(string);
if (rd->scemode & R_EXTENSION) {
if (!BLI_testextensie(string, ".mov")) { if (!BLI_testextensie(string, ".mov")) {
/* if we don't have any #'s to insert numbers into, use 4 numbers by default */
if (strchr(string, '#')==NULL)
strcat(string, "####"); /* 4 numbers */
BLI_path_frame_range(string, rd->sfra, rd->efra, 4); BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
strcat(string, ".mov"); strcat(string, ".mov");
} }
}
else {
if (BLI_path_frame_check_chars(string)) {
BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
}
}
} }