ml_graphEditorMask.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ml_tools 作者: morganloomis 项目源码 文件源码
def isolate(option):

    sel = mc.ls(sl=True)
    if not sel:
        return

    graphVis = mc.selectionConnection('graphEditor1FromOutliner', query=True, obj=True)

    channels = list()
    wildCard = str()
    alreadyIsolated = True

    if graphVis:
        for c in graphVis:
            if not '.' in c and mc.objExists(c):
                attrs = mc.listAttr(c, keyable=True, unlocked=True)
                if attrs:
                    channels.extend([c+'.'+a for a in attrs])
            else:
                attr = c.split('.')[-1]
                if attr.startswith(option):
                    channels.append(c)
                    if not wildCard:
                        wildCard = option+'*'
                elif attr.endswith(option):
                    channels.append(c)
                    if not wildCard:
                        wildCard = '*'+option
                elif attr == option:
                    channels.append(c)
                    if not wildCard:
                        wildCard = option
                else:
                    #found a curve that is outside our search parameters
                    alreadyIsolated = False

    if channels and alreadyIsolated:

        #if the option is already the only thing being displayed, then show everything that matches the option

        for obj in sel:
            attrs = mc.listAttr(obj, keyable=True, unlocked=True, string=wildCard)
            if attrs:
                channels.extend([obj+'.'+a for a in attrs])

    if not channels:
        for obj in sel:
            attrs = mc.listAttr(obj, keyable=True, unlocked=True)

            for a in attrs:
                if a==option or a.startswith(option) or a.endswith(option):
                    channels.append(obj+'.'+a)

    clear()
    for c in channels:
        mc.selectionConnection('graphEditor1FromOutliner', edit=True, select=c)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号