fix [#36842] OpenGL Animation Playblast renders 1 too many frames

This commit is contained in:
Campbell Barton
2013-09-30 08:21:12 +00:00
parent d6a52c67d5
commit be654aab58

View 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;