fix [#36842] OpenGL Animation Playblast renders 1 too many frames
authorCampbell Barton <ideasman42@gmail.com>
Mon, 30 Sep 2013 08:21:12 +0000 (08:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 30 Sep 2013 08:21:12 +0000 (08:21 +0000)
source/blender/editors/render/render_opengl.c

index cdebbf4e103d9ac4dbf50a31fa939a92d35cc9f3..21074bdc47cc55fd95dd3ba1a7ea639ed6013f50 100644 (file)
@@ -517,7 +517,7 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
 
        return 1;
 }
-static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
+static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 {
        Main *bmain = CTX_data_main(C);
        OGLRender *oglrender = op->customdata;
@@ -549,12 +549,9 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
                BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, &scene->r.im_format, scene->r.scemode & R_EXTENSION, TRUE);
 
                if ((scene->r.mode & R_NO_OVERWRITE) && BLI_exists(name)) {
-                       printf("skipping existing frame \"%s\"\n", name);
-
-                       /* go to next frame */
-                       oglrender->nfra += scene->r.frame_step;
-
-                       return 1;
+                       BKE_reportf(op->reports, RPT_INFO, "Skipping existing frame \"%s\"", name);
+                       ok = true;
+                       goto finally;
                }
        }
 
@@ -656,6 +653,9 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
        /* movie stats prints have no line break */
        printf("\n");
 
+
+finally:  /* Step the frame and bail early if needed */
+
        /* go to next frame */
        oglrender->nfra += scene->r.frame_step;
 
@@ -673,7 +673,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
 {
        OGLRender *oglrender = op->customdata;
        int anim = RNA_boolean_get(op->ptr, "animation");
-       int ret;
+       bool ret;
 
        switch (event->type) {
                case ESCKEY:
@@ -698,11 +698,12 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
                screen_opengl_render_end(C, op->customdata);
                return OPERATOR_FINISHED;
        }
-       else
+       else {
                ret = screen_opengl_render_anim_step(C, op);
+       }
 
        /* stop at the end or on error */
-       if (ret == 0) {
+       if (ret == false) {
                return OPERATOR_FINISHED;
        }
 
@@ -750,7 +751,7 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
                return OPERATOR_FINISHED;
        }
        else {
-               int ret = 1;
+               bool ret = true;
 
                if (!screen_opengl_render_anim_initialize(C, op))
                        return OPERATOR_CANCELLED;