Skip to content Skip to sidebar Skip to footer

In Maya, How Can I Toggle The 'ignore Hidden In Outliner' Flag Using Python?

Using Maya 2018, how can I write a simple Python command that will toggle the outliner flag, 'ignore hidden in outliner' ? I am having trouble accessing that panel attribute using

Solution 1:

defsetHiddenInOutliner(nodes=list, value=bool):
    for n in nodes:
        cmds.setAttr('{}.hiddenInOutliner'.format(n), value)

    # refresh any outliner editors
    eds = cmds.lsUI(editors=True)
    for ed in eds:
        if cmds.outlinerEditor(ed, exists=True):
            cmds.outlinerEditor(ed, e=True, refresh=True)

Here is the code im using, it is just a simple attribute

Solution 2:

This is part of the Maya outlinerEditor command and be done using:

from maya import cmds

outliner = "outlinerPanel1"
cmds.outlinerEditor(outliner, edit=True, ignoreHiddenAttribute=False)
cmds.outlinerEditor(outliner , edit=True, refresh=True)

You'll need to make sure you have the right outliner name for the one you want to act upon. I believe the default outliner is outlinerPanel1 in about 99% of the time - but with maya you never know.

You can also do it over all outliners:

from maya import cmds

for panel in cmds.getPanel(typ="outlinerPanel"):
    cmds.outlinerEditor(panel, edit=True, ignoreHiddenAttribute=True)
    cmds.outlinerEditor(panel, edit=True, refresh=True)

Post a Comment for "In Maya, How Can I Toggle The 'ignore Hidden In Outliner' Flag Using Python?"