2010-04-18 05:13:58 +00:00
|
|
|
import bpy
|
2009-11-01 15:21:20 +00:00
|
|
|
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2009-10-29 11:26:44 +00:00
|
|
|
def main(context):
|
2009-10-31 19:31:45 +00:00
|
|
|
for ob in context.scene.objects:
|
|
|
|
print(ob)
|
|
|
|
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2009-10-29 11:26:44 +00:00
|
|
|
class SimpleOperator(bpy.types.Operator):
|
2012-07-01 07:55:44 +00:00
|
|
|
"""Tooltip"""
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_idname = "object.simple_operator"
|
|
|
|
bl_label = "Simple Object Operator"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2011-08-22 09:01:49 +00:00
|
|
|
return context.active_object is not None
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
main(context)
|
2009-12-24 19:50:43 +00:00
|
|
|
return {'FINISHED'}
|
2009-10-29 11:26:44 +00:00
|
|
|
|
|
|
|
|
2011-02-12 08:04:32 +00:00
|
|
|
def register():
|
|
|
|
bpy.utils.register_class(SimpleOperator)
|
|
|
|
|
|
|
|
|
|
|
|
def unregister():
|
|
|
|
bpy.utils.unregister_class(SimpleOperator)
|
|
|
|
|
|
|
|
|
2009-10-29 11:26:44 +00:00
|
|
|
if __name__ == "__main__":
|
2011-02-12 08:04:32 +00:00
|
|
|
register()
|
|
|
|
|
|
|
|
# test call
|
2010-08-02 03:30:07 +00:00
|
|
|
bpy.ops.object.simple_operator()
|