You can make a script like this:
import bpy
max_saves = 4 # if you have that many saved regions, trying to create a new one will throw an error
# remove old saves to create a new one
save_name = "restore_render_regions_{}.py"
out = "import bpy\n\n"
for name, scene in bpy.data.scenes.items():
out += f"scene = bpy.data.scenes.get('{name}')\n"
f"if scene:\n"
f" scene.render.border_min_x = {scene.render.border_min_x}\n"
f" scene.render.border_max_x = {scene.render.border_max_x}\n"
f" scene.render.border_min_y = {scene.render.border_min_y}\n"
f" scene.render.border_max_y = {scene.render.border_max_y}\n"
f"# --\n\n"
for i in range(max_saves):
filename = save_name.format(i)
if filename not in bpy.data.texts:
break
else:
raise MemoryError("Number of saved render region states exceeded the limit - increase the limit or "
"remove old saves")
file = bpy.data.texts.new(filename)
file.write(out)
Running it will create another script named restore_render_regions_{0}.py with saved region coordinates, so you can run the automatically generated script to restore the coordinates at any time (the Texts are saved with the file).
I've got a bunch of animated objects in my project I need to export separately. I would like to assign render regions to each of the exported elements, so I end up with consistent output through my many revisions.
As it is, the render border is something that's drawn and deleted - it's just such a temporary entity!
– Dan McKinney Mar 16 '21 at 20:49