Why is there no option to copy full data path of the indirect only check in collections? It's possible for "selectable", "disable in renders" but not for "holdout" and "indirect only".

indirect only check

bpy.data.collections["Collection name"].hide_select - this is a full data path for "selectable"

When you hover your mouse over "indirect only" it shows this:

data path from

So the full data path would be:

bpy.data.collections["Collection name"].indirect_only

but it isn't as it doesn't work.

I need it for using in this addon: https://blendermarket.com/products/renderstacknode to set it as a property:


Set collection as Indirect Only (ie. = Shadowcatcher) through python? - in this thread someone proposed using the code below:


And it works but it doesn't take into account the name of the collection, it just uses the active collection which doesn't satisfy me as it would add much manual work to the process.


1 Answer 1


I think the way it's presented in the outliner is a bit confusing. What you have to understand is Collections have global properties :

  • hide_select enter image description here
  • hide_viewport enter image description here
  • hide_render enter image description here

And view layer properties, which are accessed with a LayerCollection object :

  • exclude enter image description here
  • hide_viewport enter image description here (I know, it's presented as the same path as the monitor icon one, but bear with me)
  • holdout enter image description here
  • indirect_only enter image description here

Global properties are accessed in a straightforward way, ie bpy.data.collections["Collection"].hide_select = True for instance. This will make the collection unselectable across ALL view layers. Same goes for viewport and render visibility.

View layer- related properties are accessed by their relative layer_collection which is a property of one and only one view_layer. Each collection has a related layer_collection object for each view_layer in the current scene. This object is responsible for holding and modifying its view layer properties.

The tricky part is collections don't hold a direct reference to their (theoretically infinite number of) layer_collection counterparts. You have to traverse the entire view layer's layer collections to test against the current collection, and only then can you change its properties. (I'd love to be corrected if there is an easier way).

Note that LayerCollection does have a direct reference to its unique collection object. (layer_coll.collection)

It then becomes really similar to this question.

import bpy

def traverse_tree(t):
    yield t
    for child in t.children:
        yield from traverse_tree(child)

coll_name = "Collection"
layer_coll_master = bpy.context.view_layer.layer_collection

for layer_coll in traverse_tree(layer_coll_master):
    if layer_coll.collection.name == coll_name:
        layer_coll.indirect_only = False

I guess the short answer to your question is, no, you can't change this property with a one-liner expression in python. (Again, please correct me if I'm wrong)

  • 1
    $\begingroup$ OK, I understand it, though it's still not very logical to me from a user's point of view. I'm looking for a perfect workflow in my projects and every time I'm close there's a problem but now I'm the closest to the perfect solution. I think I'll create different view layers and access them with the addon, which is also possible and it's not that much more work in my case. $\endgroup$
    – cc03d.com
    Jul 13, 2021 at 5:30
  • $\begingroup$ Another solution which I didn't mention is temporarily change the active collection and use bpy.context.view_layer.active_layer_collection.indirect_only as you found out at first, then reverting the active collection back after. But it may have unintended consequences... $\endgroup$
    – Gorgious
    Jul 13, 2021 at 6:20
  • $\begingroup$ Yeah, I though about it but I think I'll stick with a simpler solution for now :). Thank you anyway. $\endgroup$
    – cc03d.com
    Jul 13, 2021 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .