Perhaps this is what you're looking for?

worldMatrices = [xform(mesh.getParent(), q=1, worldSpace=1, matrix=1)
for mesh in ls(type='mesh', ap=1)]

...or, you can also query individual components of the transform -
translation, rotation, etc. - using the xform command.

However, unless I'm misreading your question, I think you have a
misconception of the way instancing works in Maya.  In maya, an
instance is simply any object with more than one DAG parent... so
there is no 'master' and 'instance', they're both just instances: two
different DAG hierarchy paths to the same object.  Also, their
transform nodes WOULDN'T (or at least, wouldn't have to be) the
same... in most cases, they aren't.  This also means that the way
you'd go about getting world-space transformation info for an instance
(once you have a dag path) is exactly the same as it would be for any
other object.

- Paul


On Tue, Mar 24, 2009 at 7:11 PM, Justin Ball <[email protected]> wrote:
>
> I am still trying to get the best setup running with version 0.9.0
> with the script editor bug.
>
> I was using the line ls(type='mesh', ap=1)
>
> and yes I get all the meshes... but I need their transform information.
>
> and if I have instanced meshs, I am getting just the translation
> information from the transform node.  with is the same for both the
> master and the instance since their transform nodes are the same.
>
> So I was wanting to use the function isInstanced() to tell me if a
> mesh is instanced and could then get the world transform information
> for the transform node and then add that to the transform information.
>
> I am assuming that is right?  Right?
>
> I have lots of geo, that are getting placed into groups and are
> instanced, and then the larger group are instanced as well.  I just
> need to make sure I catch everything.  This is to save out every mesh
> as an OBJ to import them into Nuke. (specific situation)
>
> Thank you!
> On Mar 23, 2009, at 4:36 PM, Paul Molodowitch wrote:
>
>>
>> 2 notes:
>>
>> 1) If you're not already aware, there's a new version of pymel up -
>> 0.9.0.  You can grab it from highend3d.  If you were already aware,
>> and wanted to keep with the 0.7.x branch for compatability, carry
>> on... ;)
>>
>> 2) If you just want a list of all the meshes in your scene, accounting
>> for all the possible instanced paths, try:
>>
>> ls(type='mesh', allPaths=True )
>>
>>
>> On Mon, Mar 23, 2009 at 12:43 PM, Justin Ball
>> <[email protected]> wrote:
>>>
>>> I am having trouble using this command.
>>>
>>> I seem not to be prepping the info for the isInstanced() command
>>> properly.  Could someone give me a hand?
>>>
>>> Here is just some test code that I am trying to get to respond
>>> properly.
>>>
>>> snip--
>>>
>>> from pymel import *
>>>
>>>
>>> for x in ls(type='mesh'):
>>>   select(x, add=1) #select them
>>>   print "Name: " + x
>>>   print "stripNameSpace: " + x.stripNamespace()
>>>   print "PyNode: " + PyNode(x)
>>>   try:
>>>       a = x.stripNamespace()
>>>       a.isInstanced()
>>>       print "Strip TRUE"
>>>       print a
>>>   except:
>>>       pass
>>>   try:
>>>       p = PyNode(x)
>>>       p.isInstanced()
>>>       print "PyNode TRUE"
>>>   except:
>>>       pass
>>>
>>>
>>>
>>> print "Exit"
>>>
>>>
>>> --snip
>>>
>>> I have tried with both with 0.7.9 and 0.7.10 with still no luck.
>>>
>>> What I am trying to do is get the transform information of all the
>>> objects in a scene.  And if I have instanced geo, I need to get it's
>>> proper transform info in world space since the local space
>>> information
>>> does not provide the additional transform for the group in instanced
>>> geometry.  If someone has a better way of doing this, I am all ears.
>>>
>>> Thank you!
>>>
>>>
>>>>
>>>
>>
>> >
>
>
> >
>

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

Reply via email to