def getObj(*args):
#get selection and put it in the widgets["objTFG"]
clearList()
sel = cmds.ls(sl=True, type="transform")
if (sel and (len(sel)==1)):
cmds.textFieldGrp(widgets["objTFG"], e=True, tx=sel[0])
else:
cmds.warning("you must select one object with the \"follow\" attribute")
#------------maybe add attr onto end of obj text, then you don't have to get it later if you needed to ???
#now create a button for each value in the "follow" attr
#channels = cmds.channelBox ('mainChannelBox', query=True, selectedMainAttributes=True)
enumValueStr = cmds.attributeQuery("follow", node=sel[0], listEnum=True)[0]
values = enumValueStr.split(":")
for i in range(0,len(values)):
#pick a random color?
r = random.uniform(0.5,1)
g = random.uniform(0.5,1)
b = random.uniform(0.5,1)
color = (r, g, b)
#here create the button
cmds.button(l=values[i], w=125, p=widgets["bottomRCLO"], bgc=color, h=50, c=partial(switchMatchSpace, i))
评论列表
文章目录