Get list of root geo instances?

Get list of root geo instances?

Anonymous
Not applicable
760 Views
1 Reply
Message 1 of 2

Get list of root geo instances?

Anonymous
Not applicable
Hi there, I need to get a list of root geo instances out of maya, e.g. i have 3 instances of 'pSphere1' each with its own individual transform and i want a way to find a list of root geometry in the scene

So far is i do

cmds.ls(typ='mesh')


i get something like this:


pSphere2|pSphereShape1
pSphere4|pSphereShape1


but thats not all that useful without a lot of parsing

does anyone know of a good solution

jt
0 Likes
761 Views
1 Reply
Reply (1)
Message 2 of 2

lee.dunham
Collaborator
Collaborator
im abit unsure what you mean. Do you mean geo that has no transform parent? or do you mean geo that's transform parent is child of world? and what do you want returned? the geo names or its parent?

btw there isnt muchg issue with parsing using a list comprehension and split method.
ie


#list mesh nodes whose transform node's have no parent
import maya.cmds as mc
geo = for geo in mc.ls(type='mesh',l=True) if geo.count('|') < 3]


this can be done in various ways, using listRelatives, pickWalk etc.
0 Likes