7
$\begingroup$

Is there a way to have a preview of the rendered image during the render process (like the one you get after you press the render button) if the render process is started from a script with

bpy.ops.render.render()

?

$\endgroup$

1 Answer 1

6
$\begingroup$

If you call the render() operator via PyConsole or Text Editor, a different default execution context is used. It is 'EXEC_DEFAULT'.

In contrast, buttons in panels and also menu entries use 'INVOKE_DEFAULT' by default for operators.

You can override the execution context in layouts:

col = layout.column()
col.operator_context = 'EXEC_DEFAULT'
col.operator("render.render")

As well as in the console / editor:

bpy.ops.render.render('INVOKE_DEFAULT')

If you use an override and keyword arguments for an operator call, the order is:

bpy.ops.render.render({'dict': "override"}, # dictionary for context overriding
                      'EXECUTION_CONTEXT',  # a valid execution context
                      undo,                 # undo support (True or False)
                      keyword="argument_1", # first operator argument
                      ...)                  # more operator arguments follow here

Links:

$\endgroup$
2
  • $\begingroup$ Where did this info come from? I didn't see anything of this here. Is there a way to preview the rendered image, yet only return once the render is done (to do multiple renders in a row)? $\endgroup$
    – karamike
    Commented Aug 12, 2014 at 19:11
  • 1
    $\begingroup$ I added some references to the API docs. If you want to do something when rendering is done, you may wanna look into the app handler render_complete. $\endgroup$
    – CodeManX
    Commented Aug 12, 2014 at 19:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .