ho yeah.... you are right... i'll check my code using the getParent() function to see what appens... i'm guessing a fail :) Thanks
On Thu, Apr 9, 2009 at 9:22 AM, Olivier Renouard < [email protected]> wrote: > I think you would have to account for the cases where a single shape can > have more than one transform if you did that, ie instances > > Sylvain Berger wrote: > > Thanks for this great explanation. It is not a big deal because I can > always asume that the direct parent of a shape is the transform, so i can > live with the getParent() method :) > > > On Wed, Apr 8, 2009 at 4:47 PM, chadrik <[email protected]> wrote: > >> >> >> 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 >> >> >> >> >> >> >> >> >> >> >> > > > -- > They say, "Evil prevails when good men fail to act." What they ought to say > is, "Evil prevails." > Nicolas Cage as Yuri Orlov in Lord of War. > > > > > -- > Olivier Renouard > > > > > -- They say, "Evil prevails when good men fail to act." What they ought to say is, "Evil prevails." Nicolas Cage as Yuri Orlov in Lord of War. --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
