fix for various python bugs and remove unused var.
[blender.git] / release / scripts / templates / operator_simple.py
1 import bpy
2
3
4 def main(context):
5     for ob in context.scene.objects:
6         print(ob)
7
8
9 class SimpleOperator(bpy.types.Operator):
10     '''Tooltip'''
11     bl_idname = "object.simple_operator"
12     bl_label = "Simple Object Operator"
13
14     @classmethod
15     def poll(cls, context):
16         return context.active_object != None
17
18     def execute(self, context):
19         main(context)
20         return {'FINISHED'}
21
22
23 def register():
24     bpy.utils.register_class(SimpleOperator)
25
26
27 def unregister():
28     bpy.utils.unregister_class(SimpleOperator)
29
30
31 if __name__ == "__main__":
32     register()
33
34     # test call
35     bpy.ops.object.simple_operator()