Created
October 24, 2016 05:08
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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