zbw_appendPath.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def append(*args):
    paths = []

    #get paths
    path1 = cmds.textFieldButtonGrp(widgets["path1"], q=True, tx=True)
    path2 = cmds.textFieldButtonGrp(widgets["path2"], q=True, tx=True)
    path3 = cmds.textFieldButtonGrp(widgets["path3"], q=True, tx=True)
    paths.append(path1)
    paths.append(path2)
    paths.append(path3)

    #append path with text from fields
    check = 0
    for path in paths:
        if path:
            if os.path.isdir(path):
                if path in sys.path:
                    cmds.warning("'%s' is already in sys.path. Skipping!"%path)
                else:
                    sys.path.append(path)
                    check += 1
            else:
                cmds.warning("%s is not an existing path and wasn't added to sys.path"%path)
    if check > 0:
        cmds.warning("Added paths! Check the 'View Paths' tab to see them")

    #delete the text
    cmds.textFieldButtonGrp(widgets["path1"], e=True, tx="")
    cmds.textFieldButtonGrp(widgets["path2"], e=True, tx="")
    cmds.textFieldButtonGrp(widgets["path3"], e=True, tx="")

    #refresh the path list on second tab
    refresh()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号