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]])
评论列表
文章目录