Message 1 of 4
(MEL) problem with reordering uvset script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
{
string $mesh[] = `ls -sl`;
string $uvSets[] = `polyUVSet -q -allUVSets`;
int $setNum[];
//int $counter = 0;
for ($i = 0; $i < size($uvSets); $i++){
$setNum[$i] = int(`match "[0-9]+$" $uvSets[$i]`); //extract uvSet number
if ($setNum[$i] != ($i + 1)) // if there is mismatch then run the following
{
int $nuvSetNum = $setNum[$i] - 1;
//print $nuvSetNum;
polyUVSet -reorder -uvSet $uvSets[$i] -nuv $uvSets[$nuvSetNum]; //swap uvSets
$uvSet[$i] = $uvSets[$nuvSetNum]; //update the uvSet array
updateUvSetEditor;
}
}
}
this script is making the assumption that the uvSets are name with the same prefix (ie map1 map2 map3...)
what it is suppose to do is reorder the uvSets to numerical order.
example
map2
map3
map5
map1
map4
would become
map1
map2
map3
map4
map5
not sure where it went wrong in the script. any help is welcomed
https://www.artstation.com/kelvintam