If you're only going to call this operator from the callback, you don't really need to use an operator.
However, the reason that your operator fails is that it doesn't support execution rather than invocation.
Add a method called "execute"execute
with (self, context)(self, context)
as the arguments. If you want to use the invoke()invoke()
method's code, just call self.invokeself.invoke
and pass NoneNone
for the event (be careful with this). The executeexecute()
method should return a set for the result just as invokeinvoke()
does, so if you're using invoke's body, just return the result of self.invoke(context, None)self.invoke(context, None)
.
Finally, call the operator as "EXEC_DEFAULT"'EXEC_DEFAULT'
instead of "INVOKE_DEFAULT"'INVOKE_DEFAULT'
import bpy
class FooOp(bpy.types.Operator):
bl_idname = "development"development.fooop"fooop"
bl_label = "Foo""Foo"
@classmethod
def poll(cls,context):
return True
def execute(self, context):
return self.invoke(context, None)
def invoke(self,context,event):
self.report({'INFO'},"running"running FooOp!"")
return {'FINISHED'}
def make_foo(scene):
bpy.ops.development.fooOp('EXEC_DEFAULT')
bpy.app.handlers.render_complete.append(make_foo)
bpy.utils.register_class(FooOp)