This code renders two images to files: default render (
Render Active Scene, result is
render0001.png) and viewport (result is
import bpy bpy.context.scene.render.filepath = '//opengl' bpy.ops.render.render() bpy.ops.render.opengl(write_still=True) print('Render Finished')
I want the
.render() operator act like it was called from the interface (show progress bar, show render window in the end), so I add invoke context:
import bpy bpy.context.scene.render.filepath = '//opengl' bpy.ops.render.render('INVOKE_DEFAULT') bpy.ops.render.opengl(write_still=True) print('Render Finished')
however after adding this my second
.opengl() doesn't produce an image. I still see
Render Finished message in a console so the code executes, it's just the render that isn't fired.
If I switch places of
.render(), I'm getting both images again. If I add
.opengl(), I'm also getting both images, so I'm using this workaround at the moment. However I'd appreciate if someone could explain why adding
'INVOKE_DEFAULT' like in my second example blocks
.opengl() from executing.