Maya selection question

Hello,
Straight to the point, I am trying to figure out the easiest way to select all locators in a scene besides doing it manually or storing the names in a list(unless the list is my only option). I dont know if I am just over looking a command or what but I have yet to come across something. Thank you for any and all help.

//MEL
pickWalk("-d","up",ls("-typ","locator"))

#cmds
maya.cmds.pickWalk(maya.cmds.ls(type="locator"),d="up")

Awesome, thanks Seth, much appreciated!

What was the problem with making a list?

cmds.select(cmds.ls(type=‘spaceLocator’), replace=True)

select -r ls -type "spaceLocator";

I wanted something a little more dynamic which you have both helped me with, I did not know you could nest commands inside the select command. Thank you so much!

[QUOTE=cdmcg;10388]I wanted something a little more dynamic which you have both helped me with, I did not know you could nest commands inside the select command. Thank you so much![/QUOTE]

You can pass returns between MEL commands like you could with most other languages:

select `ls -typ joint`;

//or

select(ls("-typ","joint"));

using the backticks limits your depth, that is:

//this is legal
select(pickWalk("-d","up",ls("-typ","locator")));

//this isn't
select `pickWalk -d up `ls -sl -typ locator``;

but that’s probably not a bad thing

but that’s probably not a bad thing

Nope, but using MEL over python is! :stuck_out_tongue:

[QUOTE=dbsmith;10399]Nope, but using MEL over python is! :p[/QUOTE]

This.