I see then, missed the fact that the pyNode object  wasn't just a
MObject but a dagPath + object combination. Remember at the time it was
put in I was thinking a MObject was enough but needing to reconstruct
dagPath on the fly when you query info about them can be costly.

Technically it's the same shape object though. Move a vertice and all
move, which is all the point. But makes sense to represent it as
different pymel objects if it allows easier access.

Paul Molodowitch wrote:
> Yeah, but I think what he's saying is the the PyMel shape object ALSO
> contains a dagPath, in addition to the shape MObject.  So a PyMel
> object (should) refer uniquely to one instance.
>
> - Paul
>
> On Thu, Apr 9, 2009 at 9:40 AM, Olivier Renouard
> <[email protected]> wrote:
>   
>> But I think in the instance case it's not just a name thing. It's actually
>> the same dag node (shape) having multiple transforms.
>>
>> That's the reason why worldMatrix is a multiple attribute. Though you
>> usually use worldMatrix[0], in case of an instanced shape you can have
>> multiple worldMatrix :
>>
>> polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
>> // Result: pCube1 polyCube1 //
>> instance; move -r 1 0 0;
>> getAttr pCube1.worldMatrix;
>> // Result: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 //
>> getAttr pCube2.worldMatrix;
>> // Result: 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 //
>> getAttr pCubeShape1.worldMatrix[0];
>> // Result: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 //
>> getAttr pCubeShape1.worldMatrix[1];
>> // Result: 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 //
>>
>> Chad Dombrova wrote:
>>
>> I think it's ok in pymel's case because your shape will be a uniquely
>> identified dagNode.
>> -chad
>>
>>
>> On Apr 9, 2009, at 6:33 AM, Sylvain Berger wrote:
>>
>> 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.
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> Olivier Renouard
>>
>>     
>
> >
>
>   


-- 
Olivier Renouard


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to