Fix #135355: ops.render.opengl() in the console wont return {'FINISHED'}
Caused by 40ac21e5a5 [does not remember/resore the previous ScrArea &
ARegion anymore].
Without this, the operator reporting might get confused by using the
wrong area/region, so added back
NOTE: I tried to just notify `NC_SPACE | ND_SPACE_INFO_REPORT` in
`screen_opengl_render_end` (same as in `wm_operator_finished` >
`wm_operator_register`), but to no avail...
Think this is quite good pratice to leave us with the original area/
region anyways though.
Thx @brecht for improvements (restoring in `screen_opengl_render_init`
already, also taking care of restoring in some early out cases)
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/135394
This commit is contained in:
committed by
Philipp Oeser
parent
3589c5489a
commit
64c15823f7
@@ -693,6 +693,8 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
||||
WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ScrArea *prev_area = CTX_wm_area(C);
|
||||
ARegion *prev_region = CTX_wm_region(C);
|
||||
GPUOffScreen *ofs;
|
||||
OGLRender *oglrender;
|
||||
int sizex, sizey;
|
||||
@@ -716,6 +718,12 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
|
||||
BKE_report(
|
||||
op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_sequencer) {
|
||||
is_view_context = false;
|
||||
}
|
||||
@@ -732,12 +740,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
|
||||
BKE_report(
|
||||
op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* stop all running jobs, except screen one. currently previews frustrate Render */
|
||||
WM_jobs_kill_all_except(wm, CTX_wm_screen(C));
|
||||
|
||||
@@ -756,6 +758,8 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
||||
|
||||
if (!ofs) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer, %s", err_out);
|
||||
CTX_wm_area_set(C, prev_area);
|
||||
CTX_wm_region_set(C, prev_region);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -850,6 +854,9 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
CTX_wm_area_set(C, prev_area);
|
||||
CTX_wm_region_set(C, prev_region);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user