My problem is as follows: I'm working on a script that renders all the scenes in a file (matching some criteria, in this case having a default Camera on Layer 0).
This works.
But I cannot make a Render option based on this.
The (bad) code is as follows
import bpy
class LoopRenderEngine(bpy.types.RenderEngine):
bl_idname = 'loop_renderer'
bl_label = 'Loop Renderer'
def render(self, scene):
#bpy.context.scene.render.engine = 'BLENDER_RENDER'
bpy.ops.render.render()
bpy.utils.register_class(LoopRenderEngine)
Since this calls the render() function in when implementing the render() function, it's not a surprise that this doesn't work.
Switching back as mentioned above to the BLENER_RENDER engine didn't work.
Any idea how to render within the render function?
PS Here is the whole code to understand my intentions better.
import bpy
import time
class LoopRenderEngine(bpy.types.RenderEngine):
bl_idname = 'loop_renderer'
bl_label = 'Loop Render Test'
bl_use_preview = True
def render(self, scene):
bpy.context.scene.render.engine='BLENDER_RENDER'
bpy.ops.render.render()
bpy.utils.register_class(LoopRenderEngine)
This works (ie starts rendering), but crashes when rendering. The command line shows:
Error: EXCEPTION_ACCESS_VIOLATION
What I'm curious about is whether I can include this function in the roll-down list of Blender renderers (Blender/Cycles/Game/Network).
If it's not possible, I add a button to the Properties/Render and bind that button to a hotkey.
– Gyula Sámuel Karli May 20 '16 at 16:44sceneyet your code is usingbpy.context.scenewhat if context is not known to render engine? – batFINGER Oct 10 '17 at 10:36