blender/release/scripts/templates/operator_simple.py
Campbell Barton bbe13e7823 * register operators like other classes
* operators now return sets (converted into flags)
* can't remove bpy_operator_wrap.c since macro's still use the custom register funcs
2009-12-24 19:50:43 +00:00

22 lines
469 B
Python

def main(context):
for ob in context.scene.objects:
print(ob)
class SimpleOperator(bpy.types.Operator):
''''''
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
def poll(self, context):
return context.active_object != None
def execute(self, context):
main(context)
return {'FINISHED'}
bpy.types.register(SimpleOperator)
if __name__ == "__main__":
bpy.ops.object.simple_operator()