zbw_attributes.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def getInput(*args):
    """ collects the input from the selected obj.channel"""

    obj = ""
    channel = ""
    conv = cmds.checkBox(widgets["conversionCB"], q=True, v=True)

    cBox = mel.eval('$temp=$gChannelBoxName')
    sel = cmds.ls(sl=True, l=True)

    if sel:
        if not len(sel) == 1:
            cmds.warning("You have to select ONE node!")
        else:
            obj = sel[0]
    else:
        cmds.warning("You have to select ONE node!")

    if sel:
        channels = cmds.channelBox(cBox, q=True, sma=True, ssa=True, sha=True, soa=True)

        if channels:
            if not len(channels) == 1:
                cmds.warning("You have to select ONE channel!")
            else:
                channel = channels[0]
        else:
            cmds.warning("You have to select ONE channel!")

    if obj and channel:
        full = "%s.%s" % (obj, channel)
        inAttr = cmds.listConnections(full, plugs=True, scn=conv, d=False, s=True)
        if inAttr:
            for each in inAttr:
                print "%s -----> %s" % (each, full)
        else:
            cmds.warning("No input connections on this attr!")
        inNodes = cmds.listConnections(full, scn=conv, d=False, s=True)
        if inNodes:
            cmds.select(cl=True)
            for node in inNodes:
                cmds.select(node, add=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号