erreur duplication UI sous maya
Hello à tous
étant dans le rigg et l'animation 3D sous maya, je commence un peu python, je rencontre évidemment quelques soucis, en fouillant un peu sur le net je tombe sur ce forum
j'ai crée mon interface avec plusieurs raccourcis, boutons etc...
l'interface marche nickel
maintenant, je souhaite dupliquer ce script pour créer une nouvelle UI avec d'autres fonctionnalités et c'est la ou le problème ce pose.
Lorsque je modifie le path des nouveaux icones et load mon scipt pour ma nouvelle UI,
j'obtiens ce message d'erreur
# Error: WindowsError: file C:/Users/elocius/Documents/maya/2017/scripts\rigtool.py line 31: 123 #
l erreur en question faisant reference à la ligne
icons = os.listdir(IconPath)
j'ai bien essayé de changer les names, les path, mais rien n'y fait
du coup si quelqu'un à une éventuelle idée ça m'aiderai vraiment. merci d'avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| import maya.cmds as cmds
import os
from functools import partial
import maya.mel as mel
widgets = {}
def UI():
if cmds.window("rigtool", exists = True):
cmds.deleteUI("rigtool")
widgets["window"] = cmds.window("rigtool", mnb = False, mxb = False, title = (28 * ("-")+ "rigtool" + 28 * ("-")))
widgets["scrollLayout"] = cmds.scrollLayout(hst = 0)
widgets["mainLayout"] = cmds.columnLayout(adj = True, parent = widgets["scrollLayout"])
#find icons and create symbol button for each icon ( largeur * hauteur)
populateIcons()
cmds.showWindow(widgets["window"])
cmds.window(widgets["window"], edit = True, w = 530, h = 610, sizeable = True)
def populateIcons():
IconPath = cmds.internalVar(upd = True) + "\icons\elocius\rigtool/"
icons = os.listdir(IconPath)
categories = []
for icon in icons:
categoryName = icon.partition("_")[0]
categories.append(categoryName)
categoryNames = list(set(categories))
for name in categoryNames:
#create a frameLayout
widgets[(name + "_frameLayout")] = cmds.frameLayout(label = name, collapsable = True, parent = widgets["mainLayout"])
widgets[(name + "_mainLayout")] = cmds.rowColumnLayout(nc = 6, parent = widgets[name + "_frameLayout"])
for icon in icons:
niceName = icon.partition(".")[0]
category = icon.partition("__")[0]
command = icon.partition("__")[2].partition(".")[0] #exemple : nodeeditor
widgets[(niceName + "_button")] = cmds.symbolButton(w = 85, h = 45, image = (IconPath + icon), parent = widgets[(category +"_mainLayout")], c = partial(runMethod, command))
def runMethod(method, *args):
exec(method + "()")
#---------------------------------------------------------------------------------CREATE THE MEL CALL COMMANDS----------------------------------------------------------------------------
#-------------OUTLINE----------------------
def geo__addGeo():
mel.eval("CreateEmptyGroup;")
cmds.showWindow(widgets["window"]) |