Get coordinates 3dview Render Border

Hi all,

as there are a couple addons which are used for precise render border. I would like to know if anyone knows how to get the coordinates of the render border outside camera view. So the coordinates when you pan around and have ‘use_render_border’ on.

The only coordinates i see is when its set, i cant seem to find a method to get them by Python though. Have searched high and low and most is about the coordinates from camera view.

Attachments


scene.render.border_min_x etc.

https://docs.blender.org/api/blender_python_api_current/bpy.types.RenderSettings.html#bpy.types.RenderSettings

You get them in 0-1 of camera space.

Thanks, i did forget to post here as well. I got it sorted by the help of Nikita in this post
I did actually found that page, but with almost all of them. Its totally unclear on how to use it, its only the raw code. I ended up searching a lot and finally find this other thread. Luckily Nikita anwsered super fast :slight_smile:

This is the code i ended up with

if area.spaces.active.use_render_border and (thea_globals.frame_px == False):                    activeScr = area.spaces.active
                    minX = activeScr.render_border_min_x
                    maxX = activeScr.render_border_max_x
                    minY = activeScr.render_border_min_y
                    maxY = activeScr.render_border_max_y


                    renderRegion = ('1' if area.spaces.active.use_render_border else '0')
                    message = 'set "./UI/Viewport/Camera/Render Region" = %s' % renderRegion
                    data = sendSocketMsg('localhost', port, message.encode(), waitForResponse=True)


                    region = "(%s,%s)-(%s,%s)" % (int(resX * minX), int(resY - resY * maxY), int(resX * maxX), int(resY - resY * minY))
                    message = 'set "./UI/Viewport/Camera/Region" = %s' % region
                    data = sendSocketMsg('localhost', port, message.encode(), waitForResponse=True)

It works like a charm im can now use a different external render engine and use border render in the 3dviewport as well in camera mode.

Ill change the title of this thread to [SOLVED]

Attachments