Thursday, February 01, 2007

Rig a paperbag

Step 01:
create joints and move to the position like the below picture then do the smooth skin
use expression to adjust the joints and control locator
a. CnLocator translateX, L and R joint Up and Dn rotate outward, the bottom joint also move up
b. CnLocator translateX, Mid joint Up and Dn translate into center
Step 02:
use component editor to change the vertex weight in the bottom to 1
Step 03:
use component editor to change the vertex weight on the side
from top column to the bottom column
Mid_jointDn Bottom_joint
1 0
0.7 0.3
0.6 0.4
0.5 0.5
0.4 0.6
0.25 0.75
0.1 0.9
Do the adjustments depend on the demand

Step 04:
Do the same thing on the vertex on the other side again


Sample:


Tuesday, July 25, 2006

Rigging_Attach the controller to splineFK (description only)


The easiest way to put the calv controller I found is
- put your calv controller to the shoulder joint then group the controller itself
- change the pivot point of the group to the shoulder joint
- calv joint orient constrain the group of calv controller
- freeze the C_calv (so the rotate will be the same as calv joint)
- delete the orient constrain
- point constrain C_calv by shoulder joint (so the C_calv will follow theposition of Shoulder joint)
- C_calv orient constrain the calv joint (so C_calv can orient the Calv joint)

problem
- no translate on that

Rigging_easy way to put Calv controler (description)


The easiest way to put the calv controller I found is
- put your calv controller to the shoulder joint then group the controller itself
- center pivot the group
- calv joint orient constrain the group of calv controller
- freeze the C_calv (so the rotate will be the same as calv joint)
- delete the orient constrain
- point constrain C_calv by shoulder joint (so the C_calv will follow theposition of Shoulder joint)
- C_calv orient constrain the calv joint (so C_calv can orient the Calv joint)

Tuesday, May 16, 2006

yeSnapSho 2.75

yeSnapSho 2.75 a tool to creat Pose liberary




the Mel
==================================================
global proc tMel()
{
if (`window -query -exists yeGUIWindow`)
{
deleteUI yeGUIWindow;
windowPref -remove yeGUIWindow;
}
//main window with menu
window -menuBar 1 -menuBarVisible 1 -s 1 -t "yeTools" -rtf 1 yeGUIWindow;
menu -label "File" ;
menuItem -label "save all buttons" -command "yeSaveButton";
menuItem -label "load buttons" -command "yeLoadButton";
menuItem -divider true;
menuItem -label "close Window" -command "yeClose";
menu -label "button Size" ;
menuItem -label "large" -c "goXL" ;
menuItem -label "Small" -c "goXS";
menu -label "Help";
menuItem -label "there is no Help yet";
menuItem -label "I am trying" -c "yeOpen";

//Windows and buttons

//columnLayout -adjustableColumn true;
frameLayout -collapsable 1 -l "" yeFrame;
columnLayout yeColumn;
rowColumnLayout -numberOfColumns 2 -columnWidth 1 150 -columnWidth 2 350 yeRowColumn;

textScrollList -selectCommand "yeSelectItem()"
-deleteKeyCommand "yeDeleteIt()"
-doubleClickCommand "yeGetAll"
-manage yes
-ams 1 -width 150 -height 300 selections;

popupMenu -p selections -mm 1 -b 3 yePopTextMenu;
menuItem -l "select all" -c "yeGetAll";
menuItem -l "add to Maya shelf" -c "yeAddToShelf";
menuItem -l "add selected" -c "yeAddIt";
menuItem -l "delete" -c "yeDeleteIt";
menuItem -l "Clean the List" -c "yeCleanIt";
shelfTabLayout -image "smallTrash.xpm" -imageVisible 1 yeShelfTab;

/*
shelfLayout "selection" ;

setParent..;

shelfLayout "pose" ;
setParent..;
*/
setParent..;
setParent..;

//
frameLayout -width 500 -collapsable 1 -label "Functions";
rowColumnLayout -numberOfColumns 3 -columnWidth 1 150 -columnWidth 2 150 -columnWidth 3 150;
button -l "add selected" -w 150 -c "yeAddIt";
// 1
text -l "Name your selection group";
// 2
text -l "Name your pose";
// 3
button -l "delete" -c "yeDeleteIt";
// 4
textField groupName;
// 5
textField poseName;
// 6
button -l "Clean the List" -c "yeCleanIt";
// 7
button -bgc 99 99 02 -l"add selection " -c "yeSetSelection" ;
// 8
button -bgc 99 200 02 -l "add pose " -c "yeGetPose";
// 9
setParent..;
setParent..;


showWindow yeGUIWindow;

//set to large button


//Creat the shelf Folder in user shelf dir
string $yeTheDir = (`internalVar -userShelfDir`);
sysFile -makeDir ($yeTheDir + "yeShelfDir");

yeShelfTabss;
goXL;
yeLoadButton;
yePopupMenuAddOn;


}
global proc yeClose()
{
string $result = `confirmDialog
-title "closing window"
-message "save buttons?"
-button "Yes" -button "No" `;

if ($result == "Yes")
{
yeSaveButton;
}

deleteUI yeGUIWindow;

}

//large shelf Button
global proc goXL()
{
global string $gShelfTopLevel;

string $temp = $gShelfTopLevel;

$gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab" ;

setShelfStyle "iconOnly" "Large";
//optionVar -sv shelfItemStyle "iconOnly";

$gShelfTopLevel = $temp;

print ("goXL==>" + $gShelfTopLevel + "\n");

yePopupMenuAddOn;

}


//Small Shelf Button
global proc goXS()
{
global string $gShelfTopLevel;

string $temp = $gShelfTopLevel;

$gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab" ;

setShelfStyle "iconOnly" "Small" ;
optionVar -sv shelfItemStyle "iconOnly";

$gShelfTopLevel = $temp;

print ("goXS==>" + $gShelfTopLevel + "\n");

yePopupMenuAddOn;

}

//get selected items into textScorllList
global proc yeAddIt()
{
string $obj[] =`ls -sl`;
if ((size($obj)) == 0)
{
confirmDialog -t "ops!!!" -m "Please select an object..." -button "Ok...";
//error "please select an object" ;
}
else
{
for ($i=0;$i<(size($obj));$i++) textScrollList -edit -append $obj[$i] selections; } } global proc yeSelectItem() { select -cl; string $curObjs[] = `textScrollList -q -si selections`; for ($item in $curObjs) { select -add $curObjs; } } global proc yeDeleteIt() { string $curObjs[] = `textScrollList -q -si selections`; for ($item in $curObjs) { //delete $item; textScrollList -e -ri $item selections; } } global proc yeSetSelection() { global string $gShelfTopLevel; global string $buttons[]; string $selObj[]; string $tabName = `textField -q -text groupName`; $selObj = `textScrollList -q -ai selections`; //check item in the scrollList if((size($selObj))==0) { confirmDialog -t "<======check!!!" -m "Please make you selection list..." -button "Ok..."; return; //error "Please make your selection!!!"; } //check input of textfield if((size($tabName))==0) { confirmDialog -t "check!!!" -m "Please Name your Shelf Button..." -button "Ok..."; return; //error "Please Name your Shelf Button"; } //check is the naming is the same if (`shelfButton -exists ("yeSelButton_"+ $tabName)`) { confirmDialog -t "check!!!" -m "please give it another name..." -button "Ok..."; return; //error "please give it another name"; } else { //for each item in the list add to the $command string string $command=("//selection for: " + "yeSelButton_" +$tabName + "\n" + "select -cl ;\n"); for ($item in $selObj) { $command += ("select -add " + $item + ";\n" ); } //creat shelfButton shelfButton -label $tabName //-p ($gShelfTopLevel + "" + `tabLayout -q -selectTab $gShelfTopLevel`) -p ("yeGUIWindow" + "" +"yeFrame" + "" + "yeColumn" +"" + "yeRowColumn" +"" + "yeShelfTab" +""+ "selection") -imageOverlayLabel $tabName -image "commandButton.xpm" -command $command -vis yes //button name ("yeSelButton_"+ $tabName); print ("yeSelButton_" + $tabName); int $buttonNum = size($buttons); $buttons[$buttonNum] = ("yeSelButton_" + $tabName); //popupMenu -p ("yeSelButton_"+ $tabName); // menuItem -l "delete button" -c ("yeDeleButtom("+$buttonNum+")"); } string $thePage = `shelfTabLayout -q -st yeShelfTab`; if ($thePage != "selection") { confirmDialog -m "A button have been creat in \"selection\" page" -button "Ok..."; return; } yeSaveButton; yePopupMenuAddOn; } global proc yeDeleButtom(int $which) { global string $buttons[]; print ("Deleting item number: " + $which +"\n"); deleteUI -control $buttons[$which]; } global proc yeCleanIt() { textScrollList -edit -ra selections; } global proc yeGetPose() { string $poseName = `textField -q -text poseName`; string $thePage =`shelfTabLayout -q -st yeShelfTab`; //print $thePage; if ($thePage == "selection") { confirmDialog -t "check!!! Current page \"selection\"" -m " Please select a \"Pose\" Page... " -button "Ok..."; return; } if (size($poseName)==0) { confirmDialog -t "check!!!" -m "Please Name your Pose..." -button "Ok..."; return; //error "Please Name your Pose!!"; //Get selection } string $selected[] = `ls -sl`; if (size($selected) == 0) { confirmDialog -t "check!!!" -m "Nothing is selected..." -button "Ok..."; return; //error -sl on "Nothing is selected!!!"; } if (`shelfButton -exists ("yePoseButton_"+ $poseName)`) { confirmDialog -t "check!!!" -m "please give it another name..." -button "Ok..."; return; //error "please give it another name"; } string $command = ("//Pose: '" + $poseName + "'\n"); for ($item in $selected) { string $attrs[] = `listAttr -keyable $item`; for ($attr in $attrs) { float $value = `getAttr ($item + "." + $attr)`; $command += ("catch(`setAttr " + $item + "." + $attr + " " + $value + "`);\n"); //print $command; } } int $origImageFormat = `getAttr defaultRenderGlobals.imageFormat`; setAttr defaultRenderGlobals.imageFormat 20; string $iconsFolder = `internalVar -userBitmapsDir`; int $currentFrame = `currentTime -q`; string $editorName = `getPanel -withFocus`; string $origDisplayState = `modelEditor -q -stateString $editorName`; $origDisplayState = `substitute "$editorName*" $origDisplayState $editorName`; $origDisplayState = `substitute "$editorName*" $origDisplayState $editorName`; modelEditor -e -allObjects off $editorName; modelEditor -edit -nurbsSurfaces on -polymeshes on -subdivSurfaces on -grid off $editorName; //Take the snapshot playblast -showOrnaments off -frame $currentFrame -percent 100 -wh 64 64 -viewer off -format "image" -filename ($iconsFolder + " yePose_" + $poseName); eval $origDisplayState; setAttr defaultRenderGlobals.imageFormat $origImageFormat; //string $theTab =`tabLayout -q -selectTab yeShelfTab`; //print $theTab; //print(`shelfLayout -q -ca pose`); <==get all the self button in the shelf shelfButton -label $poseName //-p ($gShelfTopLevel + "" + `tabLayout -q -selectTab $gShelfTopLevel`) -p ("yeGUIWindow" + "" +"yeFrame" + "" + "yeColumn" +"" + "yeRowColumn" +"" + "yeShelfTab" +""+ $thePage) -imageOverlayLabel $poseName -image (" yePose_" + $poseName + ".0000.bmp") -command $command -vis yes //button name ("yePoseButton_"+ $poseName); yeSaveButton; yePopupMenuAddOn; } global proc yeSaveButton() { string $yeTopShelf = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab"; string $theDir = (`internalVar -userShelfDir`); string $allTab[] =(`shelfTabLayout -q -ca yeShelfTab`); //print $allTab; for ($i=0; $i<(size($allTab)); $i++) { string $yeDirAll = ($theDir + "yeShelfDir" + "/shelf_" + $allTab[$i] ); //string $yeDirSelection = ($theDir + "yeShelfDir" + "/shelf_selection" ); //print ( "the dir=====>" + $yeDirAll + "\n");
string $yeAllShelf = ($yeTopShelf + $allTab[$i]);
//print ( "whole line " + $yeAllShelf + "\n");

saveShelf $yeAllShelf $yeDirAll;
//saveShelf yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTabselection $yeDirSelection;
}
print "files saved";
}
global proc yeLoadButton()
{
global string $gShelfTopLevel;
string $temp = $gShelfTopLevel;

$gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab";

string $theDir = (`internalVar -userShelfDir`);
string $yeDirMain = ($theDir +"yeShelfDir/shelf_");

string $allTab[] =(`shelfTabLayout -q -ca yeShelfTab`);

for ($i=0; $i<(size($allTab)); $i++) { $gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab"; $gShelfTopLevel = $gShelfTopLevel + $allTab[$i]; print ("$gShelfTopLevel===>" + $gShelfTopLevel +"\n");

string $yeDirAll = $yeDirMain + $allTab[$i] ;
print ("dir===>" + $yeDirAll + "\n") ;

string $selTab = "source \"" + $yeDirAll + "\";";
eval $selTab;
setParent $gShelfTopLevel;

string $shelfTab ="shelf_" + $allTab[$i];
eval $shelfTab ;

//string $yeDirPose = ($theDir + "yeShelfDir" + "/shelf_pose" );
//string $yeDirSelection = ($theDir + "yeShelfDir" + "/shelf_selection" );

//global string $gShelfTopLevel;

//string $temp = $gShelfTopLevel;
/*
//$gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTabselection";
string $selSelection = "source \""+ $yeDirSelection+ "\";";
eval $selSelection;
setParent $gShelfTopLevel;
eval shelf_selection;


$gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTabpose";
string $selPose = "source \""+ $yeDirPose+ "\";";
eval $selPose;
setParent $gShelfTopLevel;
eval shelf_pose;
*/
}

$gShelfTopLevel = $temp;
print ("old gshlef ===>" + $gShelfTopLevel +"\n");
yePopupMenuAddOn;
}


global proc yePopupMenuAddOn()
{
//global string $gShelfTopLevel;
string $yeTopShelf = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab";
//print $yeTopShelf;


if (`popupMenu -exists yePopupMenu`)
deleteUI yePopupMenu;

popupMenu -p $yeTopShelf -mm 1 -b 3 yePopupMenu;
menuItem -l "Save all Buttons" -c "yeSaveButton";
menuItem -l "Load Page Buttons" -c "yeLoadOne";
menuItem -l "add New Pose Page" -c "yeAddShelf";
menuItem -l "delete Page" -c "yeDelePage";

string $shelfTabs[] = `tabLayout -q -ca $yeTopShelf`;
for ($shelfTab in $shelfTabs)
{
string $shelfButtons[] = `shelfLayout -q -ca $shelfTab`;
for ($shelfButton in $shelfButtons)
{
if (`popupMenu -exists ("yePopupMenu " + $shelfButton)`)
deleteUI ("yePopupMenu " + $shelfButton);

popupMenu -p $shelfButton -mm 1 -b 3 ("yePopupMenu " + $shelfButton);
menuItem -l "Remane Button" -c ("yeRename " +$shelfButton);
menuItem -l "Delete Button" -c ("newyeDeleButton " + $shelfButton);
menuItem -l "Save all Buttons" -c "yeSaveButton";
menuItem -l "Load Page Buttons" -c "yeLoadOne";

}

}


}


global proc newyeDeleButton (string $shelfButton)
{
string $yeTopShelf = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab";
string $shelfTab = `tabLayout -q -st $yeTopShelf`;
//print ("TOP1=====" + $shelfTabs + "\n");


if ($shelfTab == "pose")
{
string $icoDir = `internalVar -userBitmapsDir`;
//print $icoDir;

string $icoName = (`shelfButton -q -iol $shelfButton`);
print ("ICON=====>" + $icoName + "\n");

string $fileName = (" yePose_" + $icoName +".0000.bmp");
$fileName = $icoDir + $fileName;
//print $fileName;

sysFile -delete $fileName;
}


deleteUI $shelfButton;


}

global proc yeRename(string $shelfButton)
{
string $oldName = `shelfButton -q -iol $shelfButton`;

string $result =`promptDialog -t "Rename Button"
-text $oldName
-message "Enter the new Name"
-button "Ok" -button "Cancel"
-defaultButton "Ok" -cancelButton "Cancel"
-dismissString "Cancel"`;


if ($result == "Ok")
{
print "oooooooooooooooOKKKKKKKKKKKKKKKKK";
string $text = `promptDialog -query -text`;

shelfButton -e -iol $text $shelfButton;
print ("this is====>" + $shelfButton +"\n");
}

}

//
global proc yeShelfTabss()
{


string $theFile =(`internalVar -userScriptDir` + "yeTabb.ye");
int $fileID = `fopen $theFile "r"`;
string $yeShelfs =(`fread $fileID $yeShelfs`);
print ("$yeshelf=====>" + $yeShelfs + "\n");

string $yeTab[];

$numTokens = tokenize ($yeShelfs, $yeTab);
fclose $fileID;
print $yeTab;



for ($i=0; $i<(size($yeTab)); $i++) { setParent yeShelfTab; shelfLayout $yeTab[$i]; } goXL; } global proc yeAddToShelf() { global string $gShelfTopLevel; global string $buttons[]; string $selObj[]; string $tabName = `textField -q -text groupName`; $selObj = `textScrollList -q -ai selections`; //check item in the scrollList if((size($selObj))==0) { confirmDialog -t "<======check!!!" -m "Please make you selection list..." -button "Ok..."; return; //error "Please make your selection!!!"; } else { string $result =`promptDialog -t "shelf Button name" -message "enter the Name" -button "Ok" -button "Cancel" -defaultButton "Ok" -cancelButton "Cancel" -dismissString "Cancel"`; if ($result == "Ok") { string $text = `promptDialog -query -text`; //for each item in the list add to the $command string string $command=("//selection for: " + "yeToShelf_" +$text + "\n" + "select -cl ;\n"); for ($item in $selObj) { $command += ("select -add " + $item + ";\n" ); } //creat shelfButton shelfButton -label $tabName -p ($gShelfTopLevel + "" + `tabLayout -q -selectTab $gShelfTopLevel`) //-p ("yeGUIWindow" + "" +"yeFrame" + "" + "yeColumn" +"" + "yeRowColumn" +"" + "yeShelfTab" +""+ "selection") -imageOverlayLabel $text -image "commandButton.xpm" -command $command -vis yes //button name ("yeToShelf_"+ $text); } } } global proc yeGetAll() { string $allItem[] = ` textScrollList -q -ai selections`; for ($item in $allItem) { textScrollList -e -selectItem $item selections; } yeSelectItem; } global proc yeAddShelf() { setParent yeShelfTab; string $result =`promptDialog -t "New Page" -message "Page Name" -button "Ok" -button "Cancel" -defaultButton "Ok" -cancelButton "Cancel" -dismissString "Cancel"`; if ($result == "Ok") { string $text = `promptDialog -query -text`; shelfLayout $text; string $allTab[] =`shelfTabLayout -q -ca yeShelfTab`; //print $allTab; string $theFile =(`internalVar -userScriptDir` + "yeTabb.ye"); int $fileID = `fopen $theFile "w"`; //print ($theFile + "\n"); //print ($fileID + "\n"); string $yeShelfs; for ($i=0; $i<(size($allTab)); $i++) { $yeShelfs += ($allTab[$i] + " "); } //print ("$yeShelfs====>" + $yeShelfs +"\n");

fprint $fileID $yeShelfs ;

fclose $fileID;


yeSaveButton;

}
}

global proc yeLoadOne()
{

string $thePage =`shelfTabLayout -q -st yeShelfTab`;

global string $gShelfTopLevel;
string $temp = $gShelfTopLevel;

string $theDir = (`internalVar -userShelfDir`);
string $yeDirMain = ($theDir +"yeShelfDir/shelf_");

$gShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab";
$gShelfTopLevel = $gShelfTopLevel + $thePage;
print ("$gShelfTopLevel===>" + $gShelfTopLevel +"\n");

string $yeDirAll = $yeDirMain + $thePage ;
print ("dir===>" + $yeDirAll + "\n") ;

string $selTab = "source \"" + $yeDirAll + "\";";
eval $selTab;
setParent $gShelfTopLevel;

string $shelfTab ="shelf_" + $thePage;
eval $shelfTab ;

$gShelfTopLevel = $temp;
print ("LoadOne's $gShelfTopLevel===>" +$gShelfTopLevel + "\n");

}
global proc yeDelePage()
{

string $result = `confirmDialog

-message "Are you sure you want to delete the page?"
-button "Yes" -button "No" `;

if ($result == "Yes")
{

string $thePage = `shelfTabLayout -q -st yeShelfTab`;
string $yeShelfTopLevel = "yeGUIWindowyeFrameyeColumnyeRowColumnyeShelfTab";
deleteUI -layout ($yeShelfTopLevel + "" + $thePage);


string $fileName = (`internalVar -userBitmapsDir` + "yeShelfDir/" + "shelf_" + $thePage +".mel");
print $fileName;
sysFile -delete $fileName;



string $allTab[] =`shelfTabLayout -q -ca yeShelfTab`;
//print $allTab;

string $theFile =(`internalVar -userScriptDir` + "yeTabb.ye");
int $fileID = `fopen $theFile "w"`;
//print ($theFile + "\n");
//print ($fileID + "\n");
string $yeShelfs;

for ($i=0; $i<(size($allTab)); $i++) { $yeShelfs += ($allTab[$i] + " "); } //print ("$yeShelfs====>" + $yeShelfs +"\n");

fprint $fileID $yeShelfs ;

fclose $fileID;

}
}

Monday, May 15, 2006

MEL for Render Cameras selection by Chiou


click "find ALL cameras"
multiply select the cameras you want to work, add cameras


in the camera list, check the camera you want to render
choose cpu amount,
Begin to Render




/*
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;
}
}