Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Prevent vertex grouping on selection for Mel script

Prevent vertex grouping on selection for Mel script

lukinu.u
Explorer Explorer
370 Views
1 Reply
Message 1 of 2

Prevent vertex grouping on selection for Mel script

lukinu.u
Explorer
Explorer

I'm building a script that need to act separately each selected vertex individually.
For this I'm using the following script :


string $sel[] = `ls -os`;
for($vtx in $sel)
{print $vtx};

The {print $vtx} is just temporary to see if it work but when I do it the vertices with successive index are grouped together. For example when I select vertex 20, 21 and 22, it will be labeled as "mesh.vtx[20:22]" and this group will be considered as one entry in the array.
This is very problematic because my script will just apply on the whole group instead of each vertex individually as it should.
So I wonder if there is a way to set up Maya to not group them like that on selection, or to let the script interpret the selection differently.

0 Likes
Accepted solutions (1)
371 Views
1 Reply
Reply (1)
Message 2 of 2

143110913
Enthusiast
Enthusiast
Accepted solution

Add the flatten flag to your ls command. Like this:

 

string $sel[] = `ls -os -fl`;