I'm currently trying to figure out how i can change the active view layer with python. The change to 2.8 made sourcing for documentation quite difficult.
I'd be thankfull for any help!
Set Window.view_layer
From https://code.blender.org/2017/09/view-layers-and-collections/
For simplicity now, we stick to having a single ‘active View Layer’ per Blender window.
Set the view_layer
property of the context window to the view layer you wish to be active for that window.
Example using py console. I have 3 viewlayers "RenderLayer", "View Layer" and "XXXX", code below sets "XXXX" as active in current (context) window.
>>> vl = C.scene.view_layers['
RenderLayer']
View Layer']
XXXX']
>>> vl = C.scene.view_layers['XXXX']
>>> C.window.view_layer = vl
>>>
context.screen.scene = scn
, now that is also done via window also. context.window.scene = scn
.
$\endgroup$
Commented
Feb 15, 2019 at 15:24