XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

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

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?

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

08-15-2012, 09:13 PM
i take it you already have, but if not

the mel/python documentation is a lifesaver at times.

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

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...

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

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.