Skip to content

Instantly share code, notes, and snippets.

@patwooky
Created October 24, 2016 05:08
Show Gist options
  • Save patwooky/2c6261bdbce81a8da6de0a7f96b229cc to your computer and use it in GitHub Desktop.
Save patwooky/2c6261bdbce81a8da6de0a7f96b229cc to your computer and use it in GitHub Desktop.
Maya attributes can have categories assigned to them. We can implement our own categories in attributes at creation time. This function returns a list of categories present in a Maya object's attributes.
from pymel.core import
def getAttrCategories(obj=None):
'''
Maya attributes can have categories assigned to them
we can implement our own categories in attributes at creation time
this function returns a list of categories present in a Maya object's attributes
'''
if not obj:
print 'getAttrCategories: no objects passed in. aborted'
return
categories=[]
for x in PyNode('shaderPublish_infoNode').listAttr():
# print x
try:
# attributeQuery will return a list
attrCat = attributeQuery(x.longName(), node='shaderPublish_infoNode', categories=True)
for item in attrCat:
if not item in categories:
categories.append(item)
except:
pass
return categories
getAttrCategories(ls(sl=True)[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment