~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import bgl
3
3
import blf
4
4
 
 
5
 
5
6
def draw_callback_px(self, context):
6
7
    print("mouse points", len(self.mouse_path))
7
8
 
8
 
    font_id = 0 # XXX, need to find out how best to get this.
 
9
    font_id = 0  # XXX, need to find out how best to get this.
9
10
 
10
11
    # draw some text
11
12
    blf.position(font_id, 15, 30, 0)
44
45
            context.region.callback_remove(self._handle)
45
46
            return {'FINISHED'}
46
47
 
47
 
        elif event.type in ('RIGHTMOUSE', 'ESC'):
 
48
        elif event.type in {'RIGHTMOUSE', 'ESC'}:
48
49
            context.region.callback_remove(self._handle)
49
50
            return {'CANCELLED'}
50
51
 
52
53
 
53
54
    def invoke(self, context, event):
54
55
        if context.area.type == 'VIEW_3D':
55
 
            context.manager.add_modal_handler(self)
 
56
            context.window_manager.modal_handler_add(self)
56
57
 
57
58
            # Add the region OpenGL drawing callback
58
59
            # draw in view space with 'POST_VIEW' and 'PRE_VIEW'
67
68
 
68
69
 
69
70
def register():
70
 
    bpy.types.register(ModalDrawOperator)
 
71
    bpy.utils.register_class(ModalDrawOperator)
71
72
 
72
73
 
73
74
def unregister():
74
 
    bpy.types.unregister(ModalDrawOperator)
75
 
 
 
75
    bpy.utils.unregister_class(ModalDrawOperator)
76
76
 
77
77
if __name__ == "__main__":
78
78
    register()