View layer API access wishlist: collection.expand_set()



What was obj.hide in Blender 2.79 is now obj.hide_viewport in 2.80.

This is different from the visibility on view layers, which describes visibility on different viewlayers, and is what the default show/hide ops manipulate and what the eye icons in the outliner represent.

Using obj.visible_get() you can return the the visibility state on the active view layer.

There is no visible_set() method however, as far as I can tell. So how can you set the visibility on the active or other view layers?

An object hidden via the obj.hide_viewport prop, can not be unhidden by the user using ALT + H for example.


Hide_viewport currently broken?


Expanding on this, it would be extremely useful to to access the collection expand behavior, just like it can be done for modifiers.

Currently collections are always expanded when created, with no way to collapse them as far as I can tell.

1 Like



I absolutely agree, it would be nice to have a mean in Python to expand/collapse these collections.
So, what is the state, is there still no way?



Not possible right now.

Basically what would be great to have is a collection.expand_set(state, view_layer=None) function, where you can optionally pass a view layer.
Very similar to the new hide_set() for objects. And btw, the collections could need the hide_set() as well.

@dfelinto :slight_smile: