~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to release/scripts/templates/operator_simple.py

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 is not 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()