yea no problem:
There are 2 methods to pass the return of a command string to a variable or another command: either the `-bachtick- or the brackets()-method.
for most issues the backtick-one is adequate because you can wrap stuff simply into the backticks
and done:
CODE
$sel[] = ls -sl
;
with the other method it would look this way:
CODE
$sel[] = ls("-sl"); //or
$sel[] = ls("-sl","-tr");
you see with the brackets you'd have to write a little more if you have lots of flags: they'd need to be in qoutation marks and like any item you pass this way ($variables and of course other commands
) separated by commas.
Now the downside of the backtick-method is: you cannot pack a command into another command:
CODE
//WRONG:
$meshTransforms = listRelatives -p -type "transform"
ls -type "mesh"
;
So to make this inline you'd need to have it the brackets-way. Of course you could also get all the meshes into another variable and put the variable into the listRelatives call as well:
CODE
$meshes[] = ls -type "mesh"
;
$meshTransforms[] = listRelatives("-p","-type", "transform", $meshes);
// or of course:
$meshes[] = ls -type "mesh"
;
$meshTransforms[] = listRelatives -p -type "transform" $meshes
;
you see each method has its use.
some people even double mix up these ones like this:
CODE
float $tx = getAttr ($obj + ".tx")
;
which works! but ...
this said you could write that line bracket-style only of course:
CODE
listRelatives("-p","-type", "transform", ls("-type", "mesh"));
ah! Another drawback of the backtick-method: Of course It doesn't work standalone! Only when passing:
CODE
ls -type "mesh"; // works
ls ("-type", "mesh"); // works
ls -type "mesh"
; // doesn't work