in Maya, how can I toggle the 'ignore hidden i

2019-08-22 03:41发布

问题:

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 the outlinerPanel command and the outlinerEdit commands.

Here is an example of the node, 'hid', having its attribute, 'Hidden in Outliner' checked on, but it is still visible in the outliner because the outliner option, 'ignore hiddenInOuliner' has been toggled on.

回答1:

def setHiddenInOutliner(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



标签: python maya