Use preview option to detect frame range for filename when using ctrl
authorAntony Riakiotakis <kalast@gmail.com>
Fri, 27 Mar 2015 10:39:09 +0000 (11:39 +0100)
committerAntony Riakiotakis <kalast@gmail.com>
Fri, 27 Mar 2015 10:39:09 +0000 (11:39 +0100)
F11.

release/scripts/startup/bl_operators/screen_play_rendered_anim.py
source/blender/blenkernel/BKE_writeavi.h
source/blender/blenkernel/intern/writeavi.c
source/blender/makesrna/intern/rna_scene_api.c

index 3a7a9b9..5fe74ee 100644 (file)
@@ -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.
index 8206c36..bc06be0 100644 (file)
@@ -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
 }
index b0e23b6..a86ffac 100644 (file)
@@ -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';
 }
index 36657c8..0d8d58e 100644 (file)
@@ -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 */