Get screen space coordinate for node position 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?
There are two utility functions for regions to convert 2D spaces:

Region.view2d.region_to_view()
Region.view2d.view_to_region()


-- 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.