I want to invoke an operator when rendering is finished.
import bpy
class FooOp(bpy.types.Operator):
bl_idname = "development.fooop"
bl_label = "Foo"
@classmethod
def poll(cls,context):
return True
def invoke(self,context,event):
self.report({'INFO'},"running FooOp!")
return {'FINISHED'}
def make_foo(scene):
bpy.ops.development.fooop('INVOKE_DEFAULT')
bpy.app.handlers.render_complete.append(make_foo)
bpy.utils.register_class(FooOp)
When rendering finishes, this error message is printed to the terminal:
Traceback (most recent call last):
File "/Users/reillyi/Dropbox/blender_dev/addons/render_notification/call_operator.blend/Text", line 16, in make_foo
File "/Applications/Blender/blender.app/Contents/MacOS/2.71/scripts/modules/bpy/ops.py", line 186, in __call__
ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Operator bpy.ops.development.fooop.poll() Missing 'window' in context
If I replace line 16, calling my FooOp operator, with
bpy.ops.mesh.primitive_torus_add()
Then a torus is created with no problem.
Can you help?