3
$\begingroup$

I'd like to be able to change the restriction toggles (filters) that are displayed on the right of the outliner, similar to this :

enter image description here

But with the Python API.

$\endgroup$

1 Answer 1

3
$\begingroup$

These restriction toggles are attributes of the SpaceOutliner class which is a child class of Space.

Each Area in the Screen holds one or more Space(s). Thankfully the Outliner area only holds one.

import bpy

# Fetch the first outliner area in the screen
# Will throw error if workspace doesn't contain any outliner editor.
outliner_area = next(a for a in bpy.context.screen.areas if a.type == "OUTLINER")

space = outliner_area.spaces[0]
space.show_restrict_column_enable = True  # Collection exclusion (Checkbox icon)
space.show_restrict_column_select = True  # Selection state (Cursor icon)
space.show_restrict_column_hide = True  # Local visibility (Eye icon)
space.show_restrict_column_viewport = True  # Global visibility (Monitor icon)
space.show_restrict_column_render = True  # Render visibility (Camera icon)
space.show_restrict_column_holdout = True  # Holdout
space.show_restrict_column_indirect_only = True  # Indirect only

enter image description here

$\endgroup$

You must log in to answer this question.

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