I have a Maya scripting problem for those willing to look into it for me!
I have 3 group nodes in my scene with relatively similarly named objects. When I call the list I created, it gives me names like "group|name" for the majority of all of the objects in the group node. I have one or two objects that don't use the "group|name" so they literally show up as "name". Unfortunately, I need all of these objects in my scene and the tool I am writing is "group|name" dependent.
Here is my code:
import pymel.core as pm
test = pm.ls(orderedSelection = 1)
for sel in test:
print(sel)
Replies
for i in range(len(s)):
____if '|' in str(s):
________s = str(s)
________continue
____temp = [str(s)]
____while pc.listRelatives(temp[0], p=1, f=1):
________temp.insert(0, str(pc.listRelatives(temp[0], p=1, f=1)[0]))
____s = '|'.join(temp)
print s
ug the formatting is gone. Replace underscore _ with space.
A little note that you'll only get the full hierarchy when you ls only if the object name is not unique. I personally think it's a better idea, if you have the control, to name everything properly and don't allow them to clash to begin with.