global proc render() { //get the vars string $fileName = `textFieldGrp -q -tx imageName`; string $padding = `textFieldGrp -q -tx padding`; string $extension = `textFieldGrp -q -tx extension`; string $range = `textFieldGrp -q -tx range`; string $oScale = `textFieldGrp -q -tx oScale`; string $fps = `textFieldGrp -q -tx fps`; string $renderDir = `textFieldGrp -q -tx renderDir`; string $movName = `textFieldGrp -q -tx movName`; //check fot empty string if ($range == "") { error "specify the render's range"; return; } if ($oScale == "") { error "specify the render's scale"; return; } if ($fps == "") { error "specify the render's fps"; return; } //get the padding format int $paddingSize = size($padding); int $i = 0; string $forPadding; for ($i = 0;$i<$paddingSize;$i++) { $forPadding += "@"; } //get the output mov files name string $fileOutMov = $renderDir + "/" + $movName + ".mov"; //get the output bat files name //string $fileOutBat = $renderDir + "/" + $movName + ".bat"; string $fileOutBat = "render.bat"; //string for the bat file string $batFile; $batFile += "shake " + $fileName + "." + $forPadding + "." + $extension + " -proxyscale " + $oScale + " -fps " + $fps + " -vv -fo " + $movName + ".mov -t " + $range + "\n"; $batFile += "copy " + $movName + ".mov " + $renderDir + "\n"; $batFile += "del render.bat"; //write the bat file $fileId=`fopen $fileOutBat "w"`; fwrite $fileId $batFile; fclose $fileId; //launch the bat file exec("render.bat"); deleteUI alienMakeAMov; } global proc rangeHelp() { if (`window -ex rangeHelp`) deleteUI rangeHelp; window -title "range help" -widthHeight 300 200 rangeHelp; formLayout -bgc 1 1 1 info; text -en false -bgc 1 1 1 -label "Specify render's range." txt1; text -en false -bgc 1 1 1 -label "Here's some examples:" txt2; text -en false -bgc 1 1 1 -label "1-100 : from 1 to 100 step 1" txt3; text -en false -bgc 1 1 1 -label "1-100x2 : from 1 to 100 step 2" txt4; text -en false -bgc 1 1 1 -label "1-20,30-40 : from 1 to 20 and from 30 to 40" txt5; text -en false -bgc 1 1 1 -label "1-10x2,15 : from 1 to 10 step 2 and frame 15" txt6; text -en false -bgc 1 1 1 -label "100-1 : from 100 to 1" txt7; formLayout -e -af txt1 "top" 10 -ac txt2 "top" 10 txt1 -ac txt3 "top" 0 txt2 -ac txt4 "top" 0 txt3 -ac txt5 "top" 0 txt4 -ac txt6 "top" 0 txt5 -ac txt7 "top" 0 txt6 info; showWindow rangeHelp; } global proc int selectSceneFile( string $firstImage, string $fileType ) { string $imageName; int $i; textFieldButtonGrp -e -text $firstImage firstImage; string $tokens[]; $numTokens = `tokenize $firstImage "." $tokens`; int $counter = size($tokens) - 2; for ($i=0;$i < $counter;$i++) { $imageName += $tokens[$i]; } textFieldGrp -e -text $imageName imageName; textFieldGrp -e -text $tokens[size($tokens)-2] padding; textFieldGrp -e -text $tokens[size($tokens)-1] extension; return 1; } global proc int selectDir( string $dirName, string $fileType ) { textFieldButtonGrp -e -text $dirName renderDir; return 1; } global proc alienMakeAMov() { if (`window -ex alienMakeAMov`) deleteUI alienMakeAMov; window -title "alien Make A Mov" alienMakeAMov; string $timeFPS = `currentUnit -q -t`; float $frameRate; if ($timeFPS == "game") $frameRate = 15; if ($timeFPS == "film") $frameRate = 24; if ($timeFPS == "pal") $frameRate = 25; if ($timeFPS == "ntsc") $frameRate = 30; if ($timeFPS == "show") $frameRate = 48; if ($timeFPS == "palf") $frameRate = 50; if ($timeFPS == "ntscf") $frameRate = 60; string $firstImage,$imageName,$padding,$extension; formLayout rcl1; separator -style "in" sep1; textFieldButtonGrp -label "Select Image" -tx $firstImage -buttonLabel " ... " -bc "fileBrowserDialog -m 0 -ft \"image\" -fc \"selectSceneFile\" -an \"Select\";" firstImage; textFieldGrp -label "Image Name" - text $imageName imageName; textFieldGrp -label "Padding" - text $padding padding; textFieldGrp -label "extension" - text $extension extension; separator -style "in" sep2; textFieldButtonGrp -label "render range" -buttonLabel " ? " -bc "rangeHelp" range; textFieldGrp -label "frame per second" -text $frameRate fps; textFieldGrp -label "output scale" -text "1" oScale; separator -style "in" sep3; textFieldButtonGrp -label "Render Directory" -text "" -buttonLabel " ... " -bc "fileBrowserDialog -m 4 -fc \"selectDir\" -ft \"directory\" -an \"Select\";" renderDir; textFieldGrp -label "mov name" movName; separator -style "in" sep4; $submitButton= `button -h 25 -label "RENDER" -command "render()"`; $resetButton= `button -h 25 -label "RESET VALUES" -command "alienMakeAMov()"`; $exitButton= `button -h 25 -label "EXIT" -command "evalDeferred \"deleteUI alienMakeAMov\";"`; separator -style "in" sep5; formLayout -e -af sep1 "left" 0 -af sep1 "top" 5 -af sep1 "right" 0 -af firstImage "left" -40 -ac firstImage "top" 5 sep1 -af imageName "left" -40 -ac imageName "top" 2 firstImage -af padding "left" -40 -ac padding "top" 2 imageName -af extension "left" -40 -ac extension "top" 2 padding -af sep2 "left" 0 -ac sep2 "top" 5 extension -af sep2 "right" 0 -af range "left" -40 -ac range "top" 5 sep2 -af fps "left" -40 -ac fps "top" 2 range -af oScale "left" -40 -ac oScale "top" 2 fps -af sep3 "left" 0 -ac sep3 "top" 5 oScale -af sep3 "right" 0 -af renderDir "left" -40 -ac renderDir "top" 5 sep3 -af movName "left" -40 -ac movName "top" 2 renderDir -af sep4 "left" 0 -ac sep4 "top" 5 movName -af sep4 "right" 0 -af $submitButton "left" 100 -ac $submitButton "top" 5 sep4 -ac $resetButton "left" 30 $submitButton -ac $resetButton "top" 5 sep4 -ac $exitButton "left" 30 $resetButton -ac $exitButton "top" 5 sep4 -af sep5 "left" 0 -ac sep5 "top" 5 $exitButton -af sep5 "right" 0 rcl1; showWindow alienMakeAMov; }