forked from bartvdbraak/blender
Use preview option to detect frame range for filename when using ctrl
F11.
This commit is contained in:
parent
e7afba4b29
commit
34c92848a7
@ -107,11 +107,21 @@ class PlayRenderedAnim(Operator):
|
||||
del file_a, file_b, frame_tmp
|
||||
file = bpy.path.abspath(file) # expand '//'
|
||||
else:
|
||||
path_valid = True
|
||||
# works for movies and images
|
||||
file = rd.frame_path(frame=scene.frame_start)
|
||||
file = rd.frame_path(frame=scene.frame_start, preview=scene.use_preview_range)
|
||||
file = bpy.path.abspath(file) # expand '//'
|
||||
if not os.path.exists(file):
|
||||
self.report({'WARNING'}, "File %r not found" % file)
|
||||
path_valid = False
|
||||
|
||||
#one last try for full range if we used preview range
|
||||
if scene.use_preview_range and not path_valid:
|
||||
file = rd.frame_path(frame=scene.frame_start, preview=False)
|
||||
file = bpy.path.abspath(file) # expand '//'
|
||||
if not os.path.exists(file):
|
||||
self.report({'WARNING'}, "File %r not found" % file)
|
||||
|
||||
|
||||
cmd = [player_path]
|
||||
# extra options, fps controls etc.
|
||||
|
@ -52,7 +52,7 @@ typedef struct bMovieHandle {
|
||||
} bMovieHandle;
|
||||
|
||||
bMovieHandle *BKE_movie_handle_get(const char imtype);
|
||||
void BKE_movie_filepath_get(char *string, struct RenderData *rd);
|
||||
void BKE_movie_filepath_get(char *string, struct RenderData *rd, bool preview);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -263,11 +263,11 @@ static void end_avi(void)
|
||||
#endif /* WITH_AVI */
|
||||
|
||||
/* similar to BKE_image_path_from_imformat() */
|
||||
void BKE_movie_filepath_get(char *string, RenderData *rd)
|
||||
void BKE_movie_filepath_get(char *string, RenderData *rd, bool preview)
|
||||
{
|
||||
bMovieHandle *mh = BKE_movie_handle_get(rd->im_format.imtype);
|
||||
if (mh->get_movie_path)
|
||||
mh->get_movie_path(string, rd, false);
|
||||
mh->get_movie_path(string, rd, preview);
|
||||
else
|
||||
string[0] = '\0';
|
||||
}
|
||||
|
@ -119,10 +119,10 @@ static void rna_Scene_update_tagged(Scene *scene)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
|
||||
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int preview, char *name)
|
||||
{
|
||||
if (BKE_imtype_is_movie(rd->im_format.imtype)) {
|
||||
BKE_movie_filepath_get(name, rd);
|
||||
BKE_movie_filepath_get(name, rd, preview != 0);
|
||||
}
|
||||
else {
|
||||
BKE_image_path_from_imformat(
|
||||
@ -287,6 +287,8 @@ void RNA_api_scene_render(StructRNA *srna)
|
||||
RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame");
|
||||
RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "",
|
||||
"Frame number to use, if unset the current frame will be used", MINAFRAME, MAXFRAME);
|
||||
parm = RNA_def_boolean(func, "preview", 0, "Preview", "Use preview range");
|
||||
|
||||
parm = RNA_def_string_file_path(func, "filepath", NULL, FILE_MAX, "File Path",
|
||||
"The resulting filepath from the scenes render settings");
|
||||
RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
|
||||
|
Loading…
Reference in New Issue
Block a user