I'm pretty new to MEL scripting, but I was wondering if there is some sort of command that can return the number of children an object or group has, because the script I'm writing needs to reference that value. Any help you can provide would be greatly appreciated.
size listRelatives -allDescendents;
thanks a million. =) I'll test that out when I next work on the script.
Hmmm, two things (one's a problem, one's not): When I run the command, the number it returns is 114, but I know in this particular case it's 57 (half the number). Is it returning the shape and transform nodes of each object or something? Not really a problem, since I can just divide the number in half for my purposes, just curious what it's doing under the hood.
Secondly, how can I store the result in a variable? Rather than simply setting the value of the variable based on what I know, how can I make it grab the result and store it automatically?
Shapes are part of the equation yes.
You can use ls to filter the list so it only transforms or whatever type you wish. Its safer than assuming theres 1 shape under each transform.
$var=size( ls("-transforms", listRelatives("-allDescendents")) );
Pretty basic syntax stuff.