I am trying to grab only the group nodes within the hierarchy as shown in the screenshot…
While I use this code:
sel = cmds.listRelatives(cmds.ls(transforms=True), ap=True, ni=True)
print sel
It is giving me the following results:
[u'Group_1', u'Group_2', u'Group_2', u'Group_2', u'Group_2', u'Group_2', u'Group_3', u'Group_4', u'Group_5']
Though it gives me duplicated result of certain groups, is this the best way to approach this?
I am using Group_ as a generic naming and hence my reluctance to use Group_*, in case you are wondering…