I'm working on some features for Node Wrangler and seem to be a bit stumped.

The task is to draw some text and shapes using the BGL module near a certain node.

BGL is drawn in screen space (the origin always at the bottom left and measured in pixels). However the node location is kept in some kind of region space, the origin being the origin of the background grid and is not measured in pixels (for example, some node is 200 units wide no matter what zoom level you're at)

How could I find the coordinate of some node converted to screen space, so that I can draw some BGL stuff near it?

  • $\begingroup$ just add region.x/y? $\endgroup$ Feb 11, 2014 at 11:15
  • 1
    $\begingroup$ @pinkvertex: that won't account for zoom! $\endgroup$
    – CodeManX
    Feb 11, 2014 at 11:31

1 Answer 1


There are two utility functions for regions to convert 2D spaces:


-- API Docs

You might not even need it, try 'POST_VIEW' for your draw callback:

bpy.types.SpaceNodeEditor.draw_handler_add(draw_callback_px, args, 'WINDOW', 'POST_VIEW')

This set, you can draw in the node space in your callback function, unlike 'POST_PIXEL', which will always give you the screen space.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .