def attributeMenuItem(node, attr):
plug = node+'.'+attr
niceName = mc.attributeName(plug, nice=True)
#get attribute type
attrType = mc.getAttr(plug, type=True)
if attrType == 'enum':
listEnum = mc.attributeQuery(attr, node=node, listEnum=True)[0]
if not ':' in listEnum:
return
listEnum = listEnum.split(':')
mc.menuItem(label=niceName, subMenu=True)
for value, label in enumerate(listEnum):
mc.menuItem(label=label, command=partial(mc.setAttr, plug, value))
mc.setParent('..', menu=True)
elif attrType == 'bool':
value = mc.getAttr(plug)
label = 'Toggle '+ niceName
mc.menuItem(label=label, command=partial(mc.setAttr, plug, not value))
评论列表
文章目录