Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigRoy/e6bec080de851c02f7d553cc4de25e5c to your computer and use it in GitHub Desktop.
Save BigRoy/e6bec080de851c02f7d553cc4de25e5c to your computer and use it in GitHub Desktop.
For a given 'node' and 'attr' print API properties and it's "attributeAffects" for the attribute - for inspecting/debugging attributes from existing nodes.
import maya.api.OpenMaya as om
node = "myNode"
attr = "myAttribute"
sel = om.MSelectionList()
sel.add(node)
fn_dep = om.MFnDependencyNode(sel.getDependNode(0))
o_attr = fn_dep.attribute(attr)
fn_attr = om.MFnAttribute(o_attr)
print '-- properties'
for property in [
"affectsAppearance",
"affectsWorldSpace",
"array",
"cached",
"channelBox",
"connectable",
"disconnectBehavior",
"dynamic",
"extension",
"hidden",
"indeterminant",
"indexMatters",
"internal",
"isProxyAttribute",
"keyable",
"name",
"parent",
"readable",
"renderSource",
"shortName",
"storable",
"usedAsColor",
"usedAsFilename",
"usesArrayDataBuilder",
"worldSpace",
"writable"
]:
print property, getattr(fn_attr, property)
print '-- getAddAttrCmd'
print fn_attr.getAddAttrCmd(True)
print '-- getAffectedAttributes'
for dep_attr in fn_dep.getAffectedAttributes(o_attr):
print om.MFnAttribute(dep_attr).name
print '-- getAffectingAttributes'
for dep_attr in fn_dep.getAffectingAttributes(o_attr):
print om.MFnAttribute(dep_attr).name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment