/*
TT's Render Cameras select tools vr.002 updated date:May-18-2006
known bug:
1.不能點2次以上的add camera, 得一次選完.
Resolve method:
暫時懶得改
*/
global string $CamNameG[];
global proc TT_RenderCamSel()
{
if (`window -exists TT_RenderCamSel`)
{
deleteUI -window TT_RenderCamSel;
}
window -title "TT_RenderCamSel"
-rtf 1
-mxb 0
-sizeable 1
TT_RenderCamSel
;
columnLayout;
string $TTform =`formLayout myform`;
string $textCam =`text -l "Select the Cameras :" textListCam`;
string $SelCam = `textScrollList -width 250 -height 200 -ams 1 ScrolCam`;
string $SelButton = `button -l "Find ALL Cameras" -c "FindCam()" FindCamButton`;
string $AddButton = `button -l "Add Cameras" -c "AddCam()" AddCamButton`;
formLayout -e
-af $textCam "top" 4
-af $textCam "left" 4
-ap $textCam "right"0 50
-af $SelCam "left" 4
-ac $SelCam "top" 4 $textCam
-ap $SelCam "right" 0 50
-af $SelButton "left" 4
-ac $SelButton "top" 4 $SelCam
-ap $SelButton "right" 0 50
-af $AddButton "left" 4
-ac $AddButton "top" 4 $SelButton
-ap $AddButton "right" 0 50
$TTform;
showWindow;
}
global proc FindCam()
{
//Find all cameras in Outlinear and list them to the scrolllist
string $Sel[]=`listCameras`;
textScrollList -e -ra ScrolCam;
for ($item in $Sel)
{
textScrollList -e -append $item ScrolCam;
}
}
global proc AddCam()
{
global string $CamNameG[];
string $Sel[]=`textScrollList -q -si ScrolCam`;
string $itemToform[];
string $CamName[];
text -l "Camera List :" CamList;
formLayout -e
-af CamList "top" 4
-ac CamList "left" 10 textListCam
myform;
for($j=0; $j<(size($Sel)); $j++)
{
//$CamName[$j] = $Sel[$j]+("_Cam");
$CamName[$j] = $Sel[$j];
checkBox -l $CamName[$j] $CamName[$j];
if ($j==0)
{
formLayout -e
-ac $CamName[$j] "top" 4 CamList
-ac $CamName[$j] "left" 10 textListCam
myform;
}
else
{
formLayout -e
-ac $CamName[$j] "top" 2 $CamName[($j-1)]
-ac $CamName[$j] "left" 10 textListCam
myform;
}
}
for ($item in $CamName)
{
$CamNameG=$CamName;
}
text -l "Cpu numbers for Rendering" tCPU;
intSliderGrp
-field true
-minValue 1 -maxValue 2
-fieldMinValue 1 -fieldMaxValue 2
-value 1
SelCpu;
button -l "Begin to Render" -c "RenderIt()" ButtonR;
formLayout -e
-af tCPU "left" 4
-ac tCPU "top" 4 AddCamButton
-ap tCPU "right" 0 50
-af SelCpu "left" 4
-ac SelCpu "top" 4 tCPU
-ap SelCpu "right" 0 50
-af ButtonR "left" 4
-ac ButtonR "top" 4 SelCpu
-ap ButtonR "right" 0 50
myform;
}
global proc RenderIt()
{
global string $CamNameG[];
//print $CamNameG;
int $CheckC;
string $buffer[];
int $temp[];
for($i=0; $i<(size($CamNameG)); $i++)
{
$CheckC = `checkBox -q -v $CamNameG[$i]`;
if ($CheckC ==1)
{
//$temp[$i] = `tokenize $CamNameG[$i] "_Cam" $buffer`;
//string $shapesTemp[] = `listRelatives -shapes $buffer[0]`;
string $shapesTemp[] = `listRelatives -shapes $CamNameG[$i]`;
string $ShapeName= $shapesTemp[0]+".renderable";
//print $ShapeName;
setAttr $ShapeName 1;
}
else
{
//$temp[$i] = `tokenize $CamNameG[$i] "_" $buffer`;
//string $shapesTemp[] = `listRelatives -shapes $buffer[0]`;
string $shapesTemp[] = `listRelatives -shapes $CamNameG[$i]`;
string $ShapeName= $shapesTemp[0]+".renderable";
setAttr $ShapeName 0;
}
}
string $CPUnum = `intSliderGrp -q -v SelCpu`;
print $CPUnum;
if ($CPUnum == 1)
{
batchRender -n 1;
BatchRender;
}
else
{
batchRender -n 0;
BatchRender;
}
}
No comments:
Post a Comment