CODE
global proc frm_randomSelection()
{
if(`window -exists frm_randomSelection` )
// windowPref -ra;
deleteUI frm_randomSelection ;
window -mxb off -title "Random Selection Ver 1.1 by Vorasorn Ketlek" -widthHeight 320 250 frm_randomSelection ;
string $myForm = `formLayout -numberOfDivisions 100`;
radioCollection;
string $chkUnGrp = `radioButton -sl -l "Selected Only" chkUnGrp`;
string $chkCreateGrp = `radioButton -l "Selected and group" chkGroup`;
string $chkCreateGrpVis = `radioButton -l "Selected and group then disable" chkGroupVis`;
string $chkDelete = `radioButton -l "Selected and delete" chkGroupDel`;
string $myBtn5 = `button -l "Start" -h 30 -w 200 -c "vfn_randomSelection();"`;
string $p1 =`progressBar -pr 0 -w 200 pDeselect `;
formLayout -edit
-attachForm $chkUnGrp "top" 5 -attachForm $chkUnGrp "left" 5
-attachForm $chkCreateGrp "top" 25 -attachForm $chkCreateGrp "left" 5
-attachForm $chkCreateGrpVis "top" 45 -attachForm $chkCreateGrpVis "left" 5
-attachForm $chkDelete "top" 65 -attachForm $chkDelete "left" 5
-attachForm $p1 "top" 100 -attachForm $p1 "left" 5
-attachForm $myBtn5 "top" 125 -attachForm $myBtn5 "left" 5
$myForm;
showWindow frm_randomSelection ;
}
global proc vfn_randomSelection()
{
string $selCurve[] = `ls -sl`;
float $cSize=size($selCurve);
float $t2 = ($cSize/100);
for($i=0;$i<$cSize;$i++)
{
int $rNum = rand(0,$cSize);
vfn_randomSelect($selCurve[$rNum]);
progressBar -e -pr ($i/$t2) pDeselect;
}
progressBar -e -pr 0 pDeselect;
int $chkGroup = `radioButton -q -sl chkGroup`;
int $chkGroupVis = `radioButton -q -sl chkGroupVis`;
int $chkGroupDel = `radioButton -q -sl chkGroupDel`;
//
//setAttr "group1.visibility" 0;
//doDelete;
if($chkGroup ==1 && $chkGroupVis ==0)
{
string $cGrp = `group`;
}
if($chkGroupVis ==1)
{
string $cGrp = `group`;
setAttr ($cGrp+".visibility") 0;
}
if($chkGroupDel ==1)
{
doDelete;
}
}
global proc vfn_randomSelect(string $name)
{
select -d $name;
}
frm_randomSelection();
ไม่มีความคิดเห็น:
แสดงความคิดเห็น