global proc GetEdRenderWindow() { global string $controlwindow; if (`window -exists $controlwindow`) { deleteUI $controlwindow; } $controlwindow = `window -mxb 0 -mnb 0 -rtf 1 -i 1 -title "GetED Render Window" `; createWindow(); showWindow $controlwindow; userWindowPrefs(); startUp(); } global proc createWindow() { getShotCam(); getFarClipPlane(); global string $shotCam; global float $fcp; columnLayout -columnAttach "both" 5 -rowSpacing 5 -columnWidth 350; //Load Settings ================================== rowLayout -numberOfColumns 4 -columnWidth4 100 100 50 50 -columnAlign 1 "right" -columnAlign 2 "left" -columnAlign 3 "right" -columnAlign 4 "left" -columnAttach 1 "both" 5 ; text -label "Settings" -align "left" -fn boldLabelFont; //button -label "Load" -c "loadCommon;loadSettings" -align "center" "ld"; button -label "Refresh" -c "GetEdRenderWindow;" -align "left" "CW"; button -label "Save" -c "loadCommon;saveSettings" -align "center" "Sv"; button -label "delete" -c "deleteSettings;startUp" -align "center" "Re"; setParent ..; separator -height 10 -style "out"; //Panel Layout ================================== rowLayout -numberOfColumns 4 -columnWidth4 100 75 50 10 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Panel Layout" -align "left" -fn boldLabelFont; radioCollection; radioButton -label " 4 view" -onc "fourPanel" -align "left" "4P"; radioButton -label " 3 view" -onc "threePanel" -align "left" "3P"; setParent ..; separator -height 10 -style "out"; //Use Lights Row ================================== rowLayout -numberOfColumns 4 -columnWidth4 100 230 10 10 -columnAlign 1 "right" -columnAlign 2 "left" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 "lightRow"; text -label "Use Light" -align "left" -fn boldLabelFont; createLightMenu(); //button -label "Refresh" -c "createLightMenu;" -align "left" "CW"; //button -label "Refresh" -c "GetEdRenderWindow;" -align "left" "CW"; setParent ..; separator -style "none"; //Ray Trace Shadows ================================== string $curlight; string $cc; string $cc = ("$curlight=`optionMenu -q -v SceneLightsMenu`"); string $On; $On = ("select -r $curlight; setAttr " + $curlight+ ".useRayTraceShadows 1"); string $Off; $Off = ("select -r $curlight; setAttr " + $curlight+ ".useRayTraceShadows 0"); rowLayout -numberOfColumns 4 -columnWidth4 100 70 75 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Shadows" -align "left" -fn boldLabelFont; radioCollection; radioButton -label "On" -onc $On -cc $cc -align "left" "RTO"; radioButton -label "Off" -onc $Off -cc $cc -align "left" "RTF"; setParent ..; separator -height 5 -style "in"; //Mental Ray Row ================================== rowLayout -numberOfColumns 4 -columnWidth4 100 70 75 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Mental Ray" -align "left" -fn boldLabelFont; radioCollection; radioButton -label " Hi Res" -onc "mr_load();mr_hi();" -align "left" "MRH"; radioButton -label "Low Res" -onc "mr_load();mr_lo();" -align "left" "MRL"; setParent ..; // separator -height 10 -style "out"; //Geometry Row ====================================== rowLayout -numberOfColumns 4 -columnWidth4 100 70 75 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Geometry" -align "left" -fn boldLabelFont; radioCollection; radioButton -label " Hi Res" -onc "hi_on" -align "left" "GH"; radioButton -label "Low Res" -onc "hi_off" -align "left" "GL"; setParent ..; // separator -height 10 -style "out"; //Armour Row ====================================== rowLayout -numberOfColumns 4 -columnWidth4 100 70 75 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Armour" -align "left" -fn boldLabelFont; radioCollection; radioButton -label " On" -onc "armourOn" -align "left" "AO"; radioButton -label " Off" -onc "armourOff" -align "left" "AF"; setParent ..; // separator -height 10 -style "out"; //Day Night Row ====================================== rowLayout -numberOfColumns 4 -columnWidth4 100 70 75 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Day or Night" -align "left" -fn boldLabelFont; radioCollection; radioButton -label " Day" -onc "gE_texTimeShift" -align "left" "DNO"; radioButton -label "Night" -onc "gE_texTimeShift" -align "left" "DNF"; setParent ..; separator -height 5 -style "in"; //Delete Row ====================================== rowLayout -numberOfColumns 4 -columnWidth4 100 50 50 10 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Delete" -align "left" -fn boldLabelFont; if (size(`ls -type imagePlane`) >0) { iconTextButton -style "iconOnly" -image1 "_del_ip.bmp" -c "delete_ip;iconTextButton -e -en 0 -di _del_ip0.bmp del_ip" "del_ip"; } else { iconTextButton -style "iconOnly" -image1 "_del_ip0.bmp" -en 0 "del_ip"; } if (size(`ls -type audio`) >0) { iconTextButton -style "iconOnly" -image1 "_delAudio.bmp" -c "deleteAudio;iconTextButton -e -en 0 -di _delAudio0.bmp delAudio" "delAudio"; } else { iconTextButton -style "iconOnly" -image1 "_delAudio0.bmp" -en 0 "delAudio"; } setParent ..; separator -height 3 -style "in"; // Camera Row ====================================== rowLayout -numberOfColumns 4 -columnWidth4 100 50 50 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 5 -columnAttach 4 "left" 5; text -label "Camera" -align "right" -fn boldLabelFont; iconTextButton -style "iconOnly" -image1 "_Clipping.bmp" -c sliderMax; iconTextButton -style "iconOnly" -image1 "_find.bmp" -c frameShotCam; iconTextButton -style "iconOnly" -image1 "_snap.BMP" -c "renderWindowRenderCamera snapshot renderView $shotCam" "U1"; setParent ..; rowLayout -numberOfColumns 4 -columnWidth4 100 50 50 10 -columnAlign 1 "right" -columnAlign 4 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 5 -columnAttach 4 "right" 5; text -label "Clipping" -align "right" -fn boldLabelFont; floatSliderGrp -field true -cw 1 50 -cw 2 120 //-w 100 -max $fcp -fmx 100000000 -min 1 -s 1000 -cc updateSlider -pre 0 -v $fcp -dc updateSlider clipslider; setParent ..; separator -height 10 -style "out"; // Render Row ================================== rowLayout -numberOfColumns 4 -columnWidth4 100 75 75 75 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 0 -columnAttach 4 "left" 0; text -label "Render" -align "left" -fn boldLabelFont; iconTextButton -style "iconOnly" -image1 "_CF.bmp" -c "createFolders;iconTextButton -e -en 0 -di _CF0.bmp CF" "CF"; // Save As iconTextButton -style "iconOnly" -image1 "_saveAs.bmp" -c "SaveSceneAs" "saveAs"; // Submit to Deadline iconTextButton -style "iconOnly" -image1 "_dff.bmp" -c "createRenderFolders;SubmitJobToDeadline" "SubmitJob"; setParent ..; // Visibilty CheckBoxes ================================== frameLayout -cll 1 -cl 0 -label "Objects" -w 200 -borderStyle "etchedIn" -labelAlign "top"; rowColumnLayout -numberOfRows 10 ; // -columnSpacing 1 20 -columnWidth 1 150 -columnWidth 2 150; global string $namespaceList[]; $namespaceList = `namespaceInfo -lon`; string $ns; int $count =1; global string $topNodeList[]; global string $checkboxList[]; $topNodeList={}; $checkboxList={}; //columnLayout ; for ($ns in $namespaceList) { if ($ns != "Camera" && $ns != "UI") { string $matchstring = "^" + $ns + ":"; //start of line string $topnode=""; for ($topnode in `ls -assemblies`) { //print("\n$topnode=" + $topnode); // Match namespace to topnode string $match =""; $match = `match $matchstring $topnode`; if ($match != "") { // Get all children of valid topnode string $shape=""; string $relatives[] =`listRelatives -f -ad $topnode`; int $breakloop =0; //print("\n$match=" + $match + "| $ns=" + $ns ); for($shape in $relatives) { string $renderable = `objectType $shape`; // Check if topnode has renderable children if ($renderable =="mesh" || $renderable =="nurbsSurface" ) //print("\n$renderable=" + $renderable ); { //Check for non godNode string $match =""; $matchstring = "godNode"; $match = `match $matchstring $topnode`; if ($match =="") { if ($breakloop ==0) { checkBox -label $ns -cc ("changeButton(\"" + $ns + "\")") -v 1 -align "left" $ns; $breakloop=1; $checkboxList[`size($checkboxList)`] = $ns; $topNodeList[`size($topNodeList)`] = $topnode; //print("\ncreating checkbox " + $ns); } } } } } } } } setParent..; setParent..; setParent..; print("\nCHECKBOXLIST \n"); print($checkboxList); print("\nTOPNODELIST \n"); print($topNodeList); separator -height 10 -style "none"; // Visibilty Row ================================== rowLayout -numberOfColumns 4 -columnWidth4 100 75 50 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "right" 5 -columnAttach 4 "left" 5; text -label "Visibilty" -align "left" -fn boldLabelFont; button -label "showall" -align "center" -w 50 -c "showButtons"; button -label "hideall" -align "center" -w 50 -c "hideButtons"; setParent ..; separator -style "none"; // Shader Row ================================== frameLayout -cll 1 -cl 0 -label "user" -w 200 -borderStyle "etchedIn" -labelAlign "top"; rowLayout -numberOfColumns 5 -columnWidth5 100 50 50 50 50 -columnAlign 1 "right" -columnAttach 1 "both" 5 -columnAttach 2 "left" 5 -columnAttach 3 "left" 5 -columnAttach 4 "left" 5; text -label "Shaders" -align "left" -fn boldLabelFont; // BG Shader iconTextButton -style "iconOnly" -image1 "_BGShader.bmp" -c "BGShader" "BG"; // BH Shader iconTextButton -style "iconOnly" -image1 "_BHShader.bmp" -c "BHShader" "BH"; // WH shader iconTextButton -style "iconOnly" -image1 "_WHShader.bmp" -c "WHShader" "WH"; // Cast Shadows iconTextButton -style "iconOnly" -image1 "_CS.bmp" -c "castShadows" "CS"; setParent ..; setParent ..; // Other Row ================================== frameLayout -cll 1 -cl 1 -label "other" -w 200 -borderStyle "etchedIn" -labelAlign "top"; userButtons(); setParent ..; setParent ..; setParent ..; } // ---------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- global proc startUp(){ // Check for Settings file string $GetEdRendering = (`internalVar -uad` + "GetEDRendering.txt"); if (`filetest -r $GetEdRendering`) { print ("\n----loading Settings------\n"); loadCommon(); loadSettings(); } else { print ("\n----loading Defaults------\n"); loadCommon(); loadDefaults(); } } global proc loadCommon(){ checkLayout(); ChangeLights(); // Need to be on - ArmourCheck will override visorsOn; deleteAudio; iconTextButton -e -en 0 -di _delAudio0.bmp "delAudio"; delete_ip; iconTextButton -e -en 0 -di _del_ip0.bmp "del_ip"; mr_load; } global proc loadDefaults() { mr_lo; radioButton -e -sl "MRL"; hi_off; radioButton -e -sl "GL"; dayNightSwitch; checkArmour; } global proc loadSettings(){ $exampleFileName = ( `internalVar -uad` + "GetEDRendering.txt" ); $fileId=`fopen $exampleFileName "r"`; string $nextLine = `fgetline $fileId`; //Load Mental Ray -1stLine string $nextvalue = substring ($nextLine, 4, 5); if ( $nextvalue == "01") { mr_hi; radioButton -e -sl MRH; print("Mental Ray loaded HI\n"); } else { mr_lo; radioButton -e -sl MRL; print("Mental Ray loaded LO\n"); } //Load Geometry -2nd Line $nextLine = `fgetline $fileId`; $nextvalue = substring ($nextLine, 4, 5); if ( $nextvalue == "01") { hi_on; radioButton -e -sl GH; print("Geometry loaded HI\n"); } else { hi_off; radioButton -e -sl GL; print("Geometry loaded LO\n"); } //Load Armour -3rd Line $nextLine = `fgetline $fileId`; $nextvalue = substring ($nextLine, 4, 5); if ($nextvalue == "01") { armourOn; radioButton -e -sl AO; print("Armour ON\n"); } if ($nextvalue == "00") { armourOff; radioButton -e -sl AF; print("Armour OFF\n"); } if ($nextvalue == "-1") { radioButton -e -en 0 AO; radioButton -e -en 0 AF; print("Armour DISABLED\n"); } //Day or Night -4th Line $nextLine = `fgetline $fileId`; $nextvalue = substring ($nextLine, 4, 5); if ( $nextvalue == "01") { dayNightSet(1); radioButton -e -sl DNO; print("\nDayTime\n"); } else { dayNightSet(0); radioButton -e -sl DNF; print("\nNightTime\n"); } /* //Other Lines while ( size( $nextLine ) > 0 ) { $nextLine = `fgetline $fileId`; //string $string= match( "^[^(\r\n)]*", $nextLine); print ($nextLine + "\n"); } */ print("--------------------\n"); fclose $fileId; } global proc saveSettings(){ $exampleFileName = ( `internalVar -uad` + "GetEDRendering.txt" ); $fileId=`fopen $exampleFileName "w"`; // Mental Ray status if (`radioButton -q -sl MRH` ==1) { fprint $fileId "MR 01\n"; } else { fprint $fileId "MR 00\n"; } // Geometry status if (`radioButton -q -sl GH` ==1) { fprint $fileId "GE 01\n"; } else { fprint $fileId "GE 00\n"; } // Armour status if (`radioButton -q -en AO` ==1){ if (`radioButton -q -sl AO` ==1) { fprint $fileId "AR 01\n"; } else { fprint $fileId "AR 00\n"; } } else { fprint $fileId "AR -1\n"; } // Day Night status if (`radioButton -q -sl DNO` ==1) { fprint $fileId "DN 01\n"; } else { fprint $fileId "DN 00\n"; } fprint $fileId "End of Settings File\n"; // Make sure the data is witten to the file fflush $fileId; fclose $fileId; } global proc deleteSettings(){ $exampleFileName = ( `internalVar -uad` + "GetEDRendering.txt" ); sysFile -delete $exampleFileName; } global proc checkLayout(){ //radioButton -e -en 1 "3P"; //radioButton -e -en 1 "4P"; //if Panellayout = "Four views" { // radioButton -e -sl "4P"; //} } global proc ChangeLights (){ string $lightparent; string $lightlist[] = `ls -lights`; int $size = size($lightlist); int $i; global string $curlight; $curlight =`optionMenu -q -v "SceneLightsMenu" `; for ($i=0;$i<$size;$i++) { $lightparent = stringArrayToString(`listRelatives -ap $lightlist[$i]`,""); select -r $lightparent; if ($curlight == $lightlist[$i]) { ShowSelectedObjects; frameLight(); } else { HideSelectedObjects; } } $lightparent = stringArrayToString(`listRelatives -ap $curlight`,""); select -r $lightparent; if (`getAttr ($curlight+ ".useRayTraceShadows")` == 1 ) { radioButton -e -sl "RTO"; } else { radioButton -e -sl "RTF"; } } global proc frameLight(){ string $curlight =`optionMenu -q -v "SceneLightsMenu" `; string $perspPanel = `getPanel -withLabel "Persp View"`; setFocus $perspPanel; select -r $curlight; FrameSelected; fitPanel -selected; } global proc updateSlider(){ global string $shotCam; setAttr ($shotCam + "Shape.farClipPlane") (`floatSliderGrp -q -v "clipslider"`); } global proc sliderMax(){ global string $shotCam; viewClipPlane -acp $shotCam; viewClipPlane -ncp 1.00 $shotCam; float $maxval; $maxval = `getAttr ($shotCam + ".farClipPlane")`; //$maxval=`viewClipPlane -fcp $shotCam`; floatSliderGrp -e -max $maxval clipslider; floatSliderGrp -e -v $maxval clipslider; } global proc createLightMenu(){ //Lights string $lightlist[] = `ls -lights`; int $maxcount = size($lightlist); int $count; if (`optionMenu -ex SceneLightsMenu`) { deleteUI "SceneLightsMenu"; } optionMenu -p "lightRow" -w 30 -cc ChangeLights "SceneLightsMenu"; for($count=0;$count<$maxcount;$count++) { string $name=$lightlist[$count]; menuItem -label $name ; } } global proc changeButton (string $whichbutton) { global string $topNodeList[]; string $matchstring = "^" + $whichbutton + ":"; //start of line string $topnode=""; string $match =""; for ($topnode in $topNodeList) { $match = `match $matchstring $topnode`; if ($match != "") { select $topnode; int $vis = `getAttr ($topnode + ".visibility")`; if ($vis ==1) { checkBox -e -v 0 $whichbutton; HideSelectedObjects; hideKeepSelection `ls -sl`; } else { checkBox -e -v 1 $whichbutton; ShowSelectedObjects; showHidden -a; } } } } global proc showButtons (){ global string $checkboxList[]; global string $topNodeList[]; string $checkbox; string $topNode; for ($checkbox in $checkboxList) { checkBox -e -v 1 $checkbox; string $matchstring = "^" + $checkbox + ":"; //start of line string $topnode=""; string $match =""; for ($topnode in $topNodeList) { $match = `match $matchstring $topnode`; if ($match != "") { select $topnode; ShowSelectedObjects; showHidden -a; } } } } global proc hideButtons () { global string $checkboxList[]; global string $topNodeList[]; string $checkbox; string $topNode; for ($checkbox in $checkboxList) { checkBox -e -v 0 $checkbox; string $matchstring = "^" + $checkbox + ":"; //start of line string $topnode=""; string $match =""; for ($topnode in $topNodeList) { $match = `match $matchstring $topnode`; if ($match != "") { select $topnode; HideSelectedObjects; hideKeepSelection `ls -sl`; } } } } global proc checkArmour(){ if (`objExists "*:headCTRL"`) { // Make sure all armour is either on or off !!!!!! gE_armorToggle; gE_armorToggle; // Done twice int $armorCheck = `gE_armorToggle_armorCheck`; if ($armorCheck ==1) { radioButton -e -sl "AO"; } if ($armorCheck ==0) { radioButton -e -sl "AF"; } if ($armorCheck ==-1) { radioButton -e -en 0 "AO"; radioButton -e -en 0 "AF"; } } } global proc armourOn() { if (`objExists "*:headCTRL"`) { if (`gE_armorToggle_armorCheck` ==0){ gE_armorToggle; } } } global proc armourOff() { if (`objExists "*:headCTRL"`) { if (`gE_armorToggle_armorCheck` ==1){ gE_armorToggle; } } } global proc int dayNightSet(int $statusRequested){ if (`checkValidObject("cityTower")`) { int $timeCheck = `gE_texTimeShift`; // Status if ($timeCheck != $statusRequested) { // Try again gE_texTimeShift; } //Buttons & Return Value if ($timeCheck ==1) { radioButton -e -sl "DNO"; return 1; } else { radioButton -e -sl "DNF"; return 0; } } else { // disable buttons radioButton -e -en 0 "DNO"; radioButton -e -en 0 "DNF"; } } global proc dayNightSwitch(){ if (`checkValidObject("cityTower")`) { //Run once to set to opposite gE_texTimeShift; // Next time it returns to original state int $timeCheck = `gE_texTimeShift`; if ($timeCheck ==1) { radioButton -e -sl "DNO"; } else { radioButton -e -sl "DNF"; } } else { // disable buttons radioButton -e -en 0 "DNO"; radioButton -e -en 0 "DNF"; } } global proc frameShotCam(){ global string $shotCam; //Persp Panel string $perspPanel = `getPanel -withLabel "Persp View"`; //string $perspPanel = $panelList[1]; setFocus $perspPanel; select -r $shotCam; FrameSelected; fitPanel -selected; }