Hi,
I use the command “listRelatives -ad” to return all the children a selected object.
The problem is they are in a reverse order.
For instance, if the hierarchy as follows
grandparent (GP)
parent §
child ©
grandchild (GC)
It would return as
GC, C, P, GP
rather than
GP, P, C, GC.
I searched over the web and found some hits. Unfortunately, this one uses a custom script (“zooTools”) that needs installation. http://forums.cgsociety.org/showthread.php?t=190195
I also stumbled upon this native script in this thread (https://forums.autodesk.com/t5/maya-programming/reversing-the-order-of-a-string-array/td-p/4164197)
but it does not seem to work and returns the list in the same order.
$selected = `listRelatives -ad `;
for($n=0; $n<size($selected); ++$n) {
$reversed=$selected;
}
print $selected;
Thank you for looking at my problem