selection=cmds.ls(sl=1)[0]
selection=cmds.ls(sl=1)[0]
attributes=cmds.listAttr(selection)
attributeList=[]
print "\n"
for eachAttr in attributes:
name=eachAttr,
try: type=cmds.nodeType(selection+"."+eachAttr),
except: type="Error"
try: value=cmds.getAttr(selection+"."+eachAttr)
except: value="Cannot Read"
attributeList.append([name[0], type[0], value])
col1length=max([len(str(item[0])) for item in attributeList])
col2length=max([len(str(item[1])) for item in attributeList])
col3length=max([len(str(item[2])) for item in attributeList])
print ("Attribute".ljust(col1length),
"Type".ljust(col2length),
"Value".ljust(col3length))
for eachAttr in attributeList:
print str(eachAttr[0]).ljust(col1length),
print str(eachAttr[1]).ljust(col2length),
print str(eachAttr[2]).ljust(col3length)
Sunday, January 2, 2011
Attributes and Values
Here is a simple script to list all the attributes, attributeType, and values.
Labels:
Maya