user: Show practical ways to work with SpaceOutliner(Space) in a Blender add-on or script – include code.

assistant: # SpaceOutliner(Space)

base classes — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct"), [`Space`](bpy.types.Space.html#bpy.types.Space "bpy.types.Space")

*class* bpy.types.SpaceOutliner(*Space*)
:   Outliner space data

    display_mode
    :   Type of information to display

        - `SCENES`
          Scenes – Display scenes and their view layers, collections and objects.
        - `VIEW_LAYER`
          View Layer – Display collections and objects in the view layer.
        - `SEQUENCE`
          Video Sequencer – Display data belonging to the Video Sequencer.
        - `LIBRARIES`
          Blender File – Display data of current file and linked libraries.
        - `DATA_API`
          Data API – Display low level Blender data and its properties.
        - `LIBRARY_OVERRIDES`
          Library Overrides – Display data-blocks with library overrides and list their overridden properties.
        - `ORPHAN_DATA`
          Unused Data – Display data that is unused and/or will be lost when the file is reloaded.

        Type:
        :   enum in [`'SCENES'`, `'VIEW_LAYER'`, `'SEQUENCE'`, `'LIBRARIES'`, `'DATA_API'`, `'LIBRARY_OVERRIDES'`, `'ORPHAN_DATA'`], default `'SCENES'`

    filter_id_type
    :   Data-block type to show

        Type:
        :   enum in [Id Type Items](bpy_types_enum_items/id_type_items.html#rna-enum-id-type-items), default `'ACTION'`

    filter_invert
    :   Invert the object state filter

        Type:
        :   boolean, default False

    filter_state
    :   - `ALL`
          All – Show all objects in the view layer.
        - `VISIBLE`
          Visible – Show visible objects.
        - `SELECTED`
          Selected – Show selected objects.
        - `ACTIVE`
          Active – Show only the active object.
        - `SELECTABLE`
          Selectable – Show only selectable objects.

        Type:
        :   enum in [`'ALL'`, `'VISIBLE'`, `'SELECTED'`, `'ACTIVE'`, `'SELECTABLE'`], default `'ALL'`

    filter_text
    :   Live search filtering string

        Type:
        :   string, default “”, (never None)

    lib_override_view_mode
    :   Choose different visualizations of library override data

        - `PROPERTIES`
          Properties – Display all local override data-blocks with their overridden properties and buttons to edit them.
        - `HIERARCHIES`
          Hierarchies – Display library override relationships.

        Type:
        :   enum in [`'PROPERTIES'`, `'HIERARCHIES'`], default `'PROPERTIES'`

    show_mode_column
    :   Show the mode column for mode toggle and activation

        Type:
        :   boolean, default False

    show_restrict_column_enable
    :   Exclude from view layer

        Type:
        :   boolean, default False

    show_restrict_column_hide
    :   Temporarily hide in viewport

        Type:
        :   boolean, default False

    show_restrict_column_holdout
    :   Holdout

        Type:
        :   boolean, default False

    show_restrict_column_indirect_only
    :   Indirect only

        Type:
        :   boolean, default False

    show_restrict_column_render
    :   Globally disable in renders

        Type:
        :   boolean, default False

    show_restrict_column_select
    :   Selectable

        Type:
        :   boolean, default False

    show_restrict_column_viewport
    :   Globally disable in viewports

        Type:
        :   boolean, default False

    use_filter_case_sensitive
    :   Only use case sensitive matches of search string

        Type:
        :   boolean, default False

    use_filter_children
    :   Show children

        Type:
        :   boolean, default False

    use_filter_collection
    :   Show collections

        Type:
        :   boolean, default False

    use_filter_complete
    :   Only use complete matches of search string

        Type:
        :   boolean, default False

    use_filter_id_type
    :   Show only data-blocks of one type

        Type:
        :   boolean, default False

    use_filter_lib_override_system
    :   For libraries with overrides created, show the overridden values that are defined/controlled automatically (e.g. to make users of an overridden data-block point to the override data, not the original linked data)

        Type:
        :   boolean, default False

    use_filter_object
    :   Show objects

        Type:
        :   boolean, default False

    use_filter_object_armature
    :   Show armature objects

        Type:
        :   boolean, default False

    use_filter_object_camera
    :   Show camera objects

        Type:
        :   boolean, default False

    use_filter_object_content
    :   Show what is inside the objects elements

        Type:
        :   boolean, default False

    use_filter_object_empty
    :   Show empty objects

        Type:
        :   boolean, default False

    use_filter_object_grease_pencil
    :   Show Grease Pencil objects

        Type:
        :   boolean, default False

    use_filter_object_light
    :   Show light objects

        Type:
        :   boolean, default False

    use_filter_object_mesh
    :   Show mesh objects

        Type:
        :   boolean, default False

    use_filter_object_others
    :   Show curves, lattices, light probes, fonts, …

        Type:
        :   boolean, default False

    use_filter_view_layers
    :   Show all the view layers

        Type:
        :   boolean, default False

    use_sort_alpha
    :   Type:
        :   boolean, default False

    use_sync_select
    :   Sync outliner selection with other editors

        Type:
        :   boolean, default False

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type

    *classmethod* draw_handler_add(*callback*, *args*, *region_type*, *draw_type*)
    :   Add a new draw handler to this space type.
        It will be called every time the specified region in the space type will be drawn.
        Note: All arguments are positional only for now.

        Parameters:
        :   - **callback** (*Callable**[**...**,* *Any**]*) – A function that will be called when the region is drawn.
              It gets the specified arguments as input, it’s return value is ignored.
            - **args** (*tuple**[**Any**,* *...**]*) – Arguments that will be passed to the callback.
            - **region_type** (*str*) – The region type the callback draws in; usually `WINDOW`. ([`bpy.types.Region.type`](bpy.types.Region.html#bpy.types.Region.type "bpy.types.Region.type"))
            - **draw_type** (*str*) – Usually `POST_PIXEL` for 2D drawing and `POST_VIEW` for 3D drawing. In some cases `PRE_VIEW` can be used. `BACKDROP` can be used for backdrops in the node editor.

        Returns:
        :   Handler that can be removed later on.

        Return type:
        :   object

    *classmethod* draw_handler_remove(*handler*, *region_type*)
    :   Remove a draw handler that was added previously.

        Parameters:
        :   - **handler** (*object*) – The draw handler that should be removed.
            - **region_type** (*str*) – Region type the callback was added to.