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.OpenMaya as om | |
import maya.cmds as mc | |
import uuid | |
def get_name(node): | |
"""Get the long name from the MObject where appropriate""" | |
if node.hasFn(om.MFn.kDagNode): | |
return om.MFnDagNode(node).fullPathName() | |
else: | |
return om.MFnDependencyNode(node).name() |
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.OpenMaya as om | |
import maya.cmds as mc | |
def callback(node, clientData): | |
fnDep = om.MFnDependencyNode(node) | |
node_name = fnDep.name() | |
print node_name | |
if __name__ == '__main__': | |
# Delete previous run (testing only) |
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.OpenMaya as om | |
import maya.cmds as mc | |
import uuid | |
def get_name(node): | |
"""Get the long name from the MObject where appropriate""" | |
if node.hasFn(om.MFn.kDagNode): | |
return om.MFnDagNode(node).fullPathName() | |
else: | |
return om.MFnDependencyNode(node).name() |
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
""" | |
maya.cmds.listHistory() will always include the node itself when history is returned. | |
Here we're testing whether it's always the first node returned, if not a RuntimeError is raised. | |
We're also checking whether all nodes in the scene will return a valid history list, which isn't True. | |
The 'defaultColorMgtGlobals' node returns None instead of an empty list. | |
""" | |
from maya import cmds |
NewerOlder