0
$\begingroup$

I found the (kinda minimalistic) documentation about overriding contexts here: https://docs.blender.org/api/current/bpy.ops.html#overriding-context

Unfortunately, it only explains how to override setting the selection or the active object for script runs. An extensive list on what you can override with it would be helpful, but I wasn't able to find one.

Specifically, I want to override which objects are rendered using

bpy.ops.render.render() 

usage could look something like this

override = context.copy()
override["render_objects"] = list(obj1, obj2, obj3)
with context.temp_override(**override):
   bpy.ops.render.render()
$\endgroup$
2
  • $\begingroup$ Hello ! Here are all the things you should be able to override with this operator. github.com/blender/blender/blob/master/source/blender/editors/… So AFAIK you can't override the renderable objects. You can however specify a view layer. Another more straightforward method is to temporarily disable all object rendering before your script except for the ones you want to render, then reset the render state at the end. $\endgroup$
    – Gorgious
    Commented Jan 3, 2023 at 10:39
  • $\begingroup$ The disable-all-then-enable-selectively is what i am doing now, but i don't really like it. I would prefer if rendering would not change the file. It might be worth noting I am automatically rendering dozens of objects in the file, to different outputs. Would it be worth it creating a temporary view layer each time and destroying it afterwards? Can I create a view layer and not put it in the file? $\endgroup$
    – A. Tropics
    Commented Jan 3, 2023 at 21:02

0

You must log in to answer this question.

Browse other questions tagged .