...also... I don't think isInstanced() is even available in 0.7.10.
Are you, perhaps, using 0.9.0 documentation, with 0.7.x code?

Here's a sample of how to use it in 0.9.0:

from pymel import *

cmds.file(f=1, new=1)

cubeTrans, cubeMaker = polyCube()
cubeShape = cubeTrans.getShape()

cubeDupe = duplicate(cubeTrans)[0]
cubeGroup = group(cubeTrans)

# Nothing should be instanced - we made a duplicate (copy), not an inst.
print "is shape instanced?", cubeShape.isInstanced()
print "is transform instanced?", cubeTrans.isInstanced()

# Now, shape should be instance, group not
cubeInst = instance(cubeTrans)[0]
print "is shape instanced?", cubeShape.isInstanced()
print "is transform instanced?", cubeTrans.isInstanced()


# Now both should be
groupInst = instance(cubeGroup)[0]
print "is shape instanced?", cubeShape.isInstanced()
print "is transform instanced?", cubeTrans.isInstanced()


# Delete the shape instance, and it should
# still report as instanced - since the group it is part of
# is still instanced
delete(cubeInst)
print "is shape instanced?", cubeShape.isInstanced()
print "is transform instanced?", cubeTrans.isInstanced()


- Paul

On Mon, Mar 23, 2009 at 1:36 PM, Paul Molodowitch <[email protected]> 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