Skip to main content
'Render Layer' -> 'View Layer' (new default?)
Source Link
brockmann
  • 12.8k
  • 4
  • 51
  • 94

Use the View Layer

enter image description here

From the context view layer

>>> C.view_layer.active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.view_layer.active_layer_collection.name
'My Leaf 0.0'

>>> C.view_layer.active_layer_collection.exclude
False

Alternatively from scene

>>> C.scene.view_layers['RenderLayer']view_layers['View Layer'].active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.scene.view_layers['RenderLayer']view_layers['View Layer'].active_layer_collection.name
'My Leaf 0.0'

>>> C.scene.view_layers['View Layer'].active_layer_collection.exclude = True

Related

Change active collection: Change active collection

Use the View Layer

enter image description here

From the context view layer

>>> C.view_layer.active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.view_layer.active_layer_collection.name
'My Leaf 0.0'

>>> C.view_layer.active_layer_collection.exclude
False

Alternatively from scene

>>> C.scene.view_layers['RenderLayer'].active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.scene.view_layers['RenderLayer'].active_layer_collection.name
'My Leaf 0.0'

Related

Change active collection

Use the View Layer

enter image description here

From the context view layer

>>> C.view_layer.active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.view_layer.active_layer_collection.name
'My Leaf 0.0'

>>> C.view_layer.active_layer_collection.exclude
False

Alternatively from scene

>>> C.scene.view_layers['View Layer'].active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.scene.view_layers['View Layer'].active_layer_collection.name
'My Leaf 0.0'

>>> C.scene.view_layers['View Layer'].active_layer_collection.exclude = True

Related: Change active collection

Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Use the View Layer

enter image description here

From the context view layer

>>> C.view_layer.active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.view_layer.active_layer_collection.name
'My Leaf 0.0'

>>> C.view_layer.active_layer_collection.exclude
False

Alternatively from scene

>>> C.scene.view_layers['RenderLayer'].active_layer_collection
bpy.data.scenes['Scene']...LayerCollection

>>> C.scene.view_layers['RenderLayer'].active_layer_collection.name
'My Leaf 0.0'

Related

Change active collection