zbw_attributes.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def get_selected_channel(tfbg, *args):
    """
    gets the selected channel of the selected objects
    tfbg = the key of the widget for the ui (from widgets dict). string
    """

    obj = ""
    channel = ""

    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)
        cmds.textFieldButtonGrp(widgets[tfbg], e=True, tx=full)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号