PDA

View Full Version : Help with a simple selection thingie: restore last selection (components)


DeadlyNightshade
08-15-2012, 08:52 PM
These... minor annoyances are what's making me hate MEL the more I sit with it.

string $select[] = `ls -psh`;
polyMapSewMove -nf 10 -lps 0 -ch 1;
select $select[];

Tried like 10 different types of code, half of them ls -sl -variants I googled for.
I just want to save a selection to a variable, perform an operation that removes the select (polyMapSewMove in this example) and then just "go back" and restore the selection. The crappy error reporting and the shitty manual is making this harder than it should be imo.
So how do I save a bunch of selected edges to an array and restore them later?

ldunham1
08-15-2012, 09:09 PM
almost there.

string $selection[] = `ls -sl -l -fl` ; # gets selection
// do operations
select $selection ;

EDIT: realised you wanted a component stored - altered selection to flatten with longNames

ldunham1
08-15-2012, 09:13 PM
i take it you already have, but if not
http://download.autodesk.com/us/maya/2010help/Commands/ls.html

the mel/python documentation is a lifesaver at times.

DeadlyNightshade
08-15-2012, 09:15 PM
Thanks.
I was stupid when trying to do ls -sl as I wrote select $select[] instead of "just" select $select


polyMapCut;
PolySelectTraverse 2;
string $selection[] = `ls -sl`;
polyMapSewMove -nf 10 -lps 0 -ch 1;
select $selection;
PolySelectConvert 4;
PolySelectTraverse 1;


That's the script I needed the selection for. It's supposed to convert selected faces into a new UV shell (aka "tear off faces"). Seems to work okay - might need something controlling that the selection is made out of faces though...

rgkovach123
08-15-2012, 10:06 PM
if you need to restore a selection you should be using the "-replace" flag.

NaughtyNathan
08-15-2012, 10:27 PM
if you need to restore a selection you should be using the "-replace" flag.-replace is the default option, there's never any practical reason to explicitly use it, other than purely for clarity.

CGTalk Moderation
08-15-2012, 10:27 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.