hide_viewport is the new api (old hide) but no have new api for "Close little eye" is possible?

edit: For now this visibility (collection or object) is not expose in bpy,as Confirmed,with Medium priority in date 2 Mar 2019 https://developer.blender.org/T62062

From wiki.blender:

obj = bpy.context.object
print("Object %s:\n\thide in viewport: %r\n\thide in render: %r\n\tis selectable: %r\n" %
      (obj.name, obj.hide_viewport, obj.hide_render, not obj.hide_select))
  • 1
    $\begingroup$ Sorry, I don't get it. What's your question? You'd like to hide the object for rendering or in the viewport or both? $\endgroup$ – brockmann Mar 4 at 14:59
  • $\begingroup$ Hi, i like to find api by hiding object in viewport, but the api to close "little eye" but i not find . New hide_viewport make off "frame" but i whant "Eye" close, like to click on eye with mouse $\endgroup$ – Pastrokkio Mar 4 at 15:05
  • 2
    $\begingroup$ Nope, it's showing an empty screen icon @batFINGER $\endgroup$ – brockmann Mar 4 at 15:25
  • 1
    $\begingroup$ Oh ok. Gives the alt-click result. There is obj.visible_get() .. but not set. $\endgroup$ – batFINGER Mar 4 at 15:30
  • 1
    $\begingroup$ Returns whether the object is visible or not @Andrea $\endgroup$ – brockmann Mar 4 at 15:38

There is the operator.

In addition to @brockmann's answer

>>> for a in C.screen.areas:
...     if a.type == 'OUTLINER':
...         break
>>> a

>>> a.type

>>> c = {"area": a}
>>> bpy.ops.outliner.hide(c)

which does the click "shut" the eye thing.

Also there is


to report the visibility of the object in the context.

  • $\begingroup$ so there is only the possibility to do it with the operator for now? $\endgroup$ – Pastrokkio Mar 4 at 15:45
  • 2
    $\begingroup$ Not sure. Once it is turned off via the operator I have no idea how to turn it back on... lol. $\endgroup$ – batFINGER Mar 4 at 15:51

I guess the Outliner isn't finished yet and it's just showing the wrong icon.

You can set Object.hide_render as well as Object.hide_viewport like Object.hide and Object.hide_render in 2.7x versions.

Disable visibility in all viewports:

>>> bpy.context.object.hide_viewport = True

Disable the object in renders:

>>> bpy.context.object.hide_render = True

Note: Might be a bug and worth to report that behavior.

  • $\begingroup$ think api is incomplete, because new system istance work with 2 type of hide in viewport, try to press "Alt" in outliner on the "Eye" is the perfectly "hide_viewport" $\endgroup$ – Pastrokkio Mar 4 at 15:31
  • 1
    $\begingroup$ Then you'll need to wait or report that... @Andrea $\endgroup$ – brockmann Mar 4 at 15:37
  • $\begingroup$ Bug report or another type of report? $\endgroup$ – Pastrokkio Mar 4 at 16:24

In final 2.80 you can do it:



  • $\begingroup$ Bingo. This is the one. $\endgroup$ – Lewis Aug 30 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.