zbw_scriptList.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def executeCommand(*args):
    item = cmds.textScrollList(widgets["list"], q=True, si=True)[0]
    #### here we should reference a dictionary of scriptName: code to execute script
    #### load our file from userprefs(?)

    # with open("/Bluearc/HOME/CHRLX/zwillie/Desktop/jsonTest.json" ,"w") as f:
    # json.dump(animals, f, sort_keys = True, indent=4)

    # with open("/Bluearc/HOME/CHRLX/zwillie/Desktop/jsonTest.json", "r") as f:
    #     data  = json.load(f)

    #if there is an item or items that AREN'T in the dictionary as keys, throw a warning and ask for the correct input--
    #separate function to add stuff to our dictionary and save it
    #BETTER - color code the item in the list as red and when clicked, bring up a window to enter the call for the script (and add to dict and save)

    #if the key exists (aka the script name), then execute the code (value) next to it

    #print out in the script editor (warning) which command your trying to run.
    #catch key errors - i.e. this script:command pair isn't registered in the fileName.json

    if (item.rpartition(".")[2] == "mel"):
        mel.eval(item.rpartition(".")[0])

    elif (item.rpartition(".")[2] == "py"):
        exec(pythonRun[item.rpartition(".")[0]])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号