I have a simple script:
import bpy
from bpy.types import Panel,Operator
class MarkerAdd(Operator):
bl_idname = 'marker.add'
bl_label = 'Add Marker'
def execute(self,context):
bpy.ops.object.empty_add(type='PLAIN_AXES',radius=0.5,location=context.scene.cursor_location)
return '{FINISHED}'
class AddObject(bpy.types.Panel):
bl_label = "Add Object"
bl_idname = "add_object"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
scn = context.scene
row = layout.row()
row.operator('marker.add')
def register():
bpy.utils.register_class(AddObject)
bpy.utils.register_class(MarkerAdd)
def unregister():
bpy.utils.unregister_class(AddObject)
bpy.utils.unregister_class(MarkerAdd)
if __name__ == "__main__":
register()
Which seems to work, but after pressing the button, a huge error appears:
RuntimeError: class MARKER_OT_add, function execute: incompatible return value , str(, Function.result expected a set, not a NoneType)
which I have no idea why. Is the execute function from MarkerAdd operator supposed to have a different result type? It does not matter whether I put there '{FINISHED}' or not.