diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-28 14:18:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-28 14:18:54 +0300 |
commit | 3bbf1917c51bc005d8c5f5d64c5f7546b3e459c2 (patch) | |
tree | 677864a3240218f4d354741152bc33670a95275a /release | |
parent | f9d24eab559b2252c8840498b5bdc66170375f29 (diff) |
python BLF module for drawing text, updated template to draw text in the 3D view.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/templates/operator_modal_draw.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/release/scripts/templates/operator_modal_draw.py b/release/scripts/templates/operator_modal_draw.py index d830a380250..0cf2dede4ce 100644 --- a/release/scripts/templates/operator_modal_draw.py +++ b/release/scripts/templates/operator_modal_draw.py @@ -1,7 +1,13 @@ import BGL +import BLF def draw_callback_px(self, context): - print("mouse points", len(self.mouse_path)) + print("mouse points", len(self.mouse_path)) + + # draw some text + BLF.position(15, 30, 0) + BLF.size(20, 72) + BLF.draw("Hello Word " + str(len(self.mouse_path))) # 50% alpha, 2 pixel width line BGL.glEnable(BGL.GL_BLEND) @@ -22,8 +28,8 @@ def draw_callback_px(self, context): class ModalDrawOperator(bpy.types.Operator): '''Draw a line with the mouse''' - bl_idname = "object.modal_operator" - bl_label = "Simple Modal Operator" + bl_idname = "view3d.modal_operator" + bl_label = "Simple Modal View3D Operator" def modal(self, context, event): context.area.tag_redraw() @@ -66,4 +72,4 @@ def unregister(): if __name__ == "__main__": - register() + register()
\ No newline at end of file |