There are several modes in Blender for hiding objects: common hiding, hiding for all scenes and view layers, and hiding for render. Any of these modes can be enabled or disabled using the Blender Python API.
Hiding an object for the current scene
Indicated by the “eye” icon in the outliner.
Hiding the active object:
1 |
bpy.context.object.hide_set(True) |
Unhiding:
1 |
bpy.context.object.hide_set(False) |
Hiding an object for all scenes
Indicated by the “monitor” icon in the outliner.
Hiding the active object:
1 |
bpy.context.object.hide_viewport = True |
Unhiding:
1 |
bpy.context.object.hide_viewport = False |
Hiding an object for rendering
Indicated by the “camera” icon in the outliner.
Hiding the active object:
1 |
bpy.context.object.hide_render = True |
Unhiding:
1 |
bpy.context.object.hide_render = False |