Created
February 22, 2021 11:38
-
-
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.
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
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