MEL supports automatic propagation from transforms to shapes:
import maya.cmds as cmds transform = cmds.polyCube()[0] cmds.getAttr( transform + ".primaryVisibility" ) # Result: 1 # in the example above primaryVisibility is an attribute of the mesh, but it can be accessed from the transform. PyMEL supports this same transform-to-shape propagation in its object-oriented design: #continuing from the example above pytrans = PyNode( transform ) pytrans.primaryVisibility.get() # an attribute of Mesh # Result: 1 # pytrans.numVertices() # a method of Mesh # Result: 8 # MEL does not support propagating back UP the dag. #continuing from the example above mesh = cmds.listRelatives( transform, s=1 )[0] cmds.getAttr(mesh + ".tx" ) # Error: Object pCubeShape3.tx is invalid # Traceback (most recent call last): # File "<maya console>", line 1, in <module> # TypeError: Object pCubeShape3.tx is invalid # Including this feature is worth considering, but i personally don't feel that it is consistent with the conventions that have been established in Maya: a transform "owns" a shape, but a shape does not "own" a transform. -chad --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
