Render: Abort operator if there is no render_to_image() function

This commit is contained in:
2018-01-29 17:09:38 +01:00
parent b6dbd8723c
commit 847613c34e

View File

@@ -295,6 +295,7 @@ static void screen_render_view_layer_set(wmOperator *op, Main *mainp, Scene **sc
static int screen_render_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
RenderEngineType *re_type = RE_engines_find(scene->view_render.engine_id);
ViewLayer *view_layer = NULL;
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Render *re;
@@ -306,6 +307,11 @@ static int screen_render_exec(bContext *C, wmOperator *op)
const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
/* Cannot do render if there is not this function. */
if (re_type->render_to_image == NULL) {
return OPERATOR_CANCELLED;
}
/* custom scene and single layer re-render */
screen_render_view_layer_set(op, mainp, &scene, &view_layer);
@@ -858,6 +864,11 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
const char *name;
ScrArea *sa;
/* Cannot do render if there is not this function. */
if (re_type->render_to_image == NULL) {
return OPERATOR_CANCELLED;
}
/* XXX FIXME If engine is an OpenGL engine do not run modal.
* This is a problem for animation rendering since you cannot abort them.
* This also does not open an image editor space. */