in Maya, how can I toggle the 'ignore hidden in outliner' flag using Python?

与世无争的帅哥 提交于 2019-12-11 16:18:07

问题


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



来源:https://stackoverflow.com/questions/57432934/in-maya-how-can-i-toggle-the-ignore-hidden-in-outliner-flag-using-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!