Well I've been trying to write this script for years!
Asked on this forum a couple times, but never had a response.
Think I've made a bit of a breakthrough, but it's not perfect!
Sometimes, some of the shells get left behind, but on the whole, it's speeding up my workflow loads.
global proc AD_UVFixer()
// moves the shell of selected UVs to the origin
{
string $Sel[] = ls -sl
;
for ($this in $Sel)
{
select $this;
SelectUVShell;
float $UList = 0;
float $VList = 0;
float $UVs[] = polyEditUVShell -q
;
for ($i = 0; $i < size($UVs); $i++)
{
$UList += $UVs[$i];
$i++;
$VList += $UVs[$i];
}
$UList = ($UList * 2 / size($UVs));
$VList = ($VList * 2 / size($UVs));
float $UMod = -floor $UList
;
float $VMod = -floor $VList
;
polyEditUV -u $UMod -v $VMod;
}
select $Sel;
}