global proc selectUDIMPatch(){
global float $uNum,$vNum;
convertUDIM;
float $uPoint = $uNum + 0.5;
float $vPoint = $vNum + 0.5;
polySelectConstraint -m 3 -t 0x0010 -d 1 -dp $uPoint $vPoint 0 -db 0 0.7075; // select uv covering the whole tile.
ConvertSelectionToUVShellBorder; // convert to uv border to save time and iterations
string $preProcessSel[] = `ls -sl -fl`;
polySelectConstraint -m 0 -t 0x0010 -d 0 -dp 0 0 0 -db 0 0;// Zero out select Constraint
resetPolySelectConstraint;
float $minU = $uNum; //
float $minV = $vNum; ////
float $maxU = $uNum + 1; //// set boundary
float $maxV = $vNum + 1; //
string $finalUV[]; //variable for storing UV selection after testing
int $numUVs = `size $preProcessSel`;
int $MaxAmount = $numUVs * 2;
int $pAmount = 0;
progressWindow
-title "Selecting UV Patch"
-maxValue $MaxAmount
-progress $pAmount
-status "Selecting: 0%"
-isInterruptable false;
float $Uarray[]; // using array because I read somewhere that matrix doesn't handle strings. MEL limitation
float $Varray[];
float $tempUV[];
for($i = 0; $i < ($numUVs)*2; $i++){
$tempUV = `polyEditUV -q -u -v $preProcessSel`;
}
for($j = 0; $j < ($numUVs)*2; $j++){ //store u into seperate array
$Uarray[size($Uarray)] = $tempUV[$j];
$j++;
}
for($k = 1; $k < ($numUVs)*2; $k++){ //store v into seperate array
$Varray [size($Varray)] = $tempUV[$k];
$k++;
}
for($L = 0; $L < ($numUVs); $L++){ //testing to see if uvs lies within the tile boundary then storing it
if ($Uarray[$L] > $minU && $Uarray[$L] < $maxU && $Varray[$L] > $minV && $Varray[$L] < $maxV){
$finalUV[size($finalUV)] = $preProcessSel[$L];
}
else{
continue;
}
}
select -replace $finalUV;
SelectUVShell;
//inViewMessage -smg ("UDIM Patch " + $UDIMinput + " Selected") -pos topRight -bkc 0x00000000 -fade;
progressWindow -endProgress;
}
You were right mspeer, after some more testing i was able to get a script functioning. Since it runs for more than a few seconds. I want to create a progresswindow for User to see, so they can get some feedback. Problem is I have no idea where to put the $pAmount counter in the proc, since i have several for loops. Im also not sure about what to set the Max Amount as. I was hoping you can help me a bit Mspeer.
https://www.artstation.com/kelvintam