//-----------------MAYA TO INDIGO XML CONVERTER------------------ //Version: BETA 0.3 (0.6.1) //--------------------------------------------- //Credits: //Matt B. (aka MattTheMan or ThatDude33) (converter engine and more) //Arne OOG (aka arneoog) (interface and more) //Outputs in script window //Copy-Paste results into XML file, run using Ini File. //No edits should be neccesary //Start Writing: //-----------------VECTOR CONFIG------------------ global proc vector normalize(vector $v){ float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z); vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>; return $n; } //-----------------MAYA TO INDIGO SYS CONFIG------------------ global proc sysWin() { window -title "System Configurations" -h 228 -w 448 confWin0453; columnLayout; text -label "System Configurations" -w 440 -h 40 -backgroundColor 1 1 1 -font "boldLabelFont" -align "center" ; separator -w 440; text -label ""; textFieldButtonGrp -label "Your Indigo Root Folder" -fileName "" -buttonLabel "Browse" -buttonCommand "sysFolder"; textFieldButtonGrp -label "Your Indigo Scene Folder" -fileName "" -buttonLabel "Browse" -buttonCommand "sysFolder"; textFieldButtonGrp -label "Your Indigo Texture Folder" -fileName "" -buttonLabel "Browse" -buttonCommand "sysFolder"; textFieldButtonGrp -label "Your Indigo HDRI Folder" -fileName "" -buttonLabel "Browse" -buttonCommand "sysFolder"; text -label ""; button -w 440 -h 30 -label "Confirm Configurations" -align "center" -command "confirm"; showWindow; } //-----------------ABOUT MAYA TO INDIGO------------------ global proc abWin() { window -title "About Maya to Indigo" -h 200 -w 300 About; columnLayout; text -label "About Maya to Indigo" -w 300 -h 40 -backgroundColor 1 1 1 -font "boldLabelFont" -align "center" ; separator -w 300; text -label "" -w 300 -align "center"; text -label "Creators:" -w 300 -font "boldLabelFont" -align "center"; text -label "Matt B. " -w 300 -align "center"; text -label "Arne OOG" -w 300 -align "center"; text -label "" -w 300 -align "center"; separator -w 300; text -label "" -w 300 -align "center"; text -label "Copyright © 2006" -w 300 -align "center"; showWindow; } //-----------------MAYA TO INDIGO HELP------------------ global proc helpWin() { window -title "Maya to Indigo Help" -h 220 -w 360 Help; columnLayout; text -label "Maya to Indigo Help" -w 360 -h 40 -backgroundColor 1 1 1 -font "boldLabelFont" -align "center" ; separator -w 360; text -label "" -w 360; text -label "Things to remember before you generate the XML code" -w 360 -font "boldLabelFont"; text -label "- You must create a Camera" -w 360; text -label "- You must triangulate every one of you meshes" -w 360; text -label "- You must delet you history" -w 360; text -label "" -w 360 -align "center"; showWindow; } //-----------------OBJECT EDITOR------------------ global proc objectEditor() { window -title "Object Editor" -h 340 -w 570 objE00444; rowLayout -numberOfColumns 2 -columnWidth2 174 310; textScrollList -width 160 -height 306 -numberOfRows 8 -allowMultiSelection false -append "one" -append "two" -append "three" -append "four" -append "five" -append "six" -append "seven" -append "eight" -append "nine" -append "ten" -append "eleven" -append "twelve" -append "thirteen" -append "fourteen" -append "fifteen" -selectItem "six" -showIndexedItem 4; setParent ..; setParent ..; columnLayout; text -label "Material Settings" -w 400 -align "left" -font "boldLabelFont"; separator -h 10 -w 400; shelfLayout -width 390 -cellWidth 34 -cellHeight 34; shelfButton -annotation "Diffuse Shader" -image "mtiIcons/indigo_diffuce.bmp" -command "diffuce"; shelfButton -annotation "Phong Shader" -image "mtiIcons/indigo_phong.bmp" -command "phong"; shelfButton -annotation "Specular Shader" -image "mtiIcons/indigo_specular.bmp" -command "specular"; shelfButton -annotation "Mesh Light Shader" -image "mtiIcons/indigo_meshLight.bmp" -command "meshlight"; shelfButton -annotation "Metal Shader" -image "mtiIcons/indigo_metal.bmp" -command "metal"; setParent ..; rowLayout -numberOfColumns 2 -columnWidth2 170 230; text -label "Name Of Material Type" -w 170 -align "left"; textField -w 200; setParent ..; colorSliderGrp -h 25 -label "Diffuse" -rgb 0.5 0.5 0.5; colorSliderGrp -h 25 -label "Specular" -rgb 0 0 0; floatSliderGrp -h 25 -label "Exponent" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 10000 -value 10000; separator -h 10 -w 400; text -label "" -h 20 -align "left"; optionMenu -label "Add Existing Materials"; menuItem -label "?????"; text -label "" -align "left"; text -label "Object settings" -w 400 -align "left" -font "boldLabelFont"; separator -h 10 -w 400; checkBox -label "Normal Smoothing" -value 1; setParent ..; setParent ..; showWindow; } //-----------------RENDER WINDOW------------------ proc renderScene() { window -title "Render a Scene" -h 300 -w 440 -menuBar true rend58; columnLayout; frameLayout -label "General Settings" -w 440 -labelAlign "top" -borderStyle "etchedOut"; columnLayout; textFieldButtonGrp -label "Select XML Scene" -fileName "" -buttonLabel "Browse" -buttonCommand "openXMLscene" xSce; intSliderGrp -h 25 -label "Number of Render Threads" -field true -fieldMinValue 1 -fieldMaxValue 100 -minValue 1 -maxValue 10 -value 1 thre; setParent ..; setParent ..; button -w 440 -h 30 -label "Render Scene" -align "center" -command "render"; showWindow; } //----------------RENDER---------------- global proc string getScene(){ return `textFieldButtonGrp -query -fileName xSce`; } global proc string getThreads(){ float $threads = `intSliderGrp -query -value thre`; return $threads; } proc render() { string $xSce = getScene(); string $threads = getThreads(); string $rend =""; $rend +="indigo.exe "+$xSce+" "; $rend +="-t "+$threads+""; showHelp -absolute $rend; } //----------------OTHER STUFF---------------- proc openXMLscene() {fileBrowserDialog -m 0 -fc "openXML;" -ft "xml" -an "Select XML Scene FIle" -om "Open";} //-----------------ACTIVATE FIELDS------------------ global proc int skylight() { int $state = `checkBox -query -value SkylightCheckBox`; if ($state == 0) floatSliderGrp -edit -enable 0 turb; else floatSliderGrp -edit -enable 1 turb; if ($state == 0) floatSliderGrp -edit -enable 0 gain; else floatSliderGrp -edit -enable 1 gain; return $state; } global proc string getenv(){ int $state = `checkBox -query -value SkylightCheckBox`; string $retval; if ($state == 1){ return "physical"; } $state = `checkBox -query -value BgCheckBox`; if ($state == 1){ return "skylight"; } $state = `checkBox -query -value HDRCheckBox`; if ($state == 1){ return "hdri"; } if ($state == 0){ return "null"; } } global proc int bglight() { int $state = `checkBox -query -value BgCheckBox`; if ($state == 0) floatSliderGrp -edit -enable 0 bgSlider; else floatSliderGrp -edit -enable 1 bgSlider; return $state; } global proc int hdrlight() { int $state = `checkBox -query -value HDRCheckBox`; if ($state == 0) text -edit -enable 0 hdrText; else text -edit -enable 1 hdrText; if ($state == 0) textField -edit -enable 0 hdrField; else textField -edit -enable 1 hdrField; if ($state == 0) symbolButton -edit -enable 0 hdrButton; else symbolButton -edit -enable 1 hdrButton; return $state; } //-----------------CREATE STUFF------------------ proc sun() {sphere -r 0.5 -n Sun;} proc reclight() { } proc indcamera() {camera -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1 -horizontalFilmAperture 1.41732 -horizontalFilmOffset 0 -verticalFilmAperture 0.94488 -verticalFilmOffset 0 -filmFit Fill -overscan 1 -motionBlur 0 -shutterAngle 144 -nearClipPlane 0.01 -farClipPlane 1000 -orthographic 0 -orthographicWidth 30; objectMoveCommand; cameraMakeNode 3 "";} proc browseHDR() {fileBrowserDialog -m 0 -fc "openHDR" -ft "image" -an "Select HDR Image" -om "Open";} proc sysFolder() {fileBrowserDialog -m 0 -fc "" -ft "directory" -an "Select Folder" -om "Select";} proc mtiHome() {showHelp -absolute "http://www.elqx.com/mayatoindigo";} proc inreHome() {showHelp -absolute "http://www.indigorenderer.com/";} //-----------------THE CONTROL PANEL------------------ window -title "Maya to Indigo XML converter - BETA 0.3 (0.6.1)" -h 600 -w 440 -menuBar true; menu -label "Edit" -tearOff true; menuItem -label "Save Settings" -annotation "Save your currenct Settings"; menuItem -label "Reset Settings" -annotation "Load the default Settings"; menuItem -divider true; menuItem -label "Close" -annotation "Close this Window" -command "closeWindow"; menu -label "Create" -tearOff true; menuItem -label "Lights" -subMenu true; menuItem -label "Sky Light" -annotation "Create Sky Light" -command "sun"; menuItem -label "Rectangle Light" -annotation "Create a Rectangle Light" -command "reclight"; setParent -menu ..; menuItem -label "Misc" -subMenu true; menuItem -label "Camera" -annotation "Create a Camera" -command "indcamera"; menu -label "Tools" -tearOff true; menuItem -label "Object Editor" -annotation "Open the Object Editor" -command "objectEditor"; menuItem -label "Material Editor" -annotation "Open the Material Editor" -command "materialEditor"; menuItem -divider true; menuItem -label "System Config" -annotation "Open the System Configurations" -command "sysWin"; menuItem -divider true; menuItem -label "Render Scene from Maya" -annotation "This will let you select a scene and render it in Indigo from Maya" -command "renderScene"; menu -label "Help" -helpMenu true; menuItem -label "Maya to Indigo Help..." -annotation "Open the Maya to Indigo Help Window" -command "helpWin"; menuItem -label "Go to Maya to Indigo's homepage" -annotation "This will open the Maya to Indigo homepage in you current Browser" -command "mtiHome"; menuItem -label "Go to Indigo renderer's homepage" -annotation "This will open the Indigo Renderer homepage in you current Browser" -command "inreHome"; menuItem -divider true; menuItem -label "About Maya to Indigo..." -annotation "Open the About Maya to Indigo Window" -command "abWin"; columnLayout -columnAlign "center"; rowColumnLayout -height 24 -numberOfColumns 15 -columnWidth 1 24 -columnWidth 2 5 -columnWidth 3 24 -columnWidth 4 5 -columnWidth 5 24 -columnWidth 6 162 -columnWidth 7 24 -columnWidth 8 5 -columnWidth 9 24 -columnWidth 10 5 -columnWidth 11 24 -columnWidth 12 5 -columnWidth 13 24 -columnWidth 14 5 -columnWidth 15 80 ; shelfButton -height 24 -annotation "Open the Object Editor" -image "mtiIcons/objEdit.bmp" -command "objectEditor"; text -label " " -w 5 -align "center"; shelfButton -height 24 -annotation "Open the Material Editor" -image "mtiIcons/matEdit.bmp" -command "materialEditor"; text -label " " -w 5 -align "center"; shelfButton -height 24 -annotation "Open the System Configurations" -image "mtiIcons/sysCon.bmp" -command "sysWin"; text -label " " -w 162 -align "left"; shelfButton -height 24 -annotation "Open the About Maya to Indigo Window" -image "mtiIcons/mtiAbout.bmp" -command "abWin"; text -label " " -w 5 -align "center"; shelfButton -height 24 -annotation "Open the Maya to Indigo Help Window" -image "mtiIcons/mtiHelp.bmp" -command "helpWin"; text -label " " -w 5 -align "center"; shelfButton -height 24 -annotation "This will open the Maya to Indigo homepage in you current Browser" -image "mtiIcons/mayHom.bmp" -command "mtiHome"; text -label " " -w 5 -align "center"; shelfButton -height 24 -annotation "This will open the Indigo Renderer homepage in you current Browser" -image "mtiIcons/indHom.bmp" -command "inreHome"; text -label "|" -w 5 -align "center"; shelfButton -height 24 -annotation "This will let you select a scene and render it in Indigo from Maya" -image "mtiIcons/render_button.bmp" -command "renderScene"; setParent ..; setParent ..; separator -w 440; picture -image "mtiIcons/mayatoindigo.bmp"; separator -w 440; tabLayout; shelfLayout Lights; shelfButton -annotation "Sky Light" -image "mtiIcons/indigo_sun.bmp" -command "sun"; shelfButton -annotation "Rectangle Light" -image "mtiIcons/indigo_recLight.bmp" -command "reclight"; setParent ..; shelfLayout Misc; shelfButton -annotation "Camera" -image "mtiIcons/indigo_camera.bmp" -command "indcamera"; setParent ..; setParent ..; text -label "General settings" -w 440 -align "center" -font "boldLabelFont"; scrollLayout -height 482; rowColumnLayout -columnWidth 1 418; //-----------------SETTINGS------------------ frameLayout -collapsable false -label "Render Setting" -w 440 -labelAlign "top" -borderStyle "in"; columnLayout -columnAlign "center"; separator -w 440 -h 10; text -label "Metropolis light transport settings" -w 440 -align "left" -font "boldLabelFont"; checkBox -label "Metropolis" -value 1 Metrocb; floatSliderGrp -h 25 -label "Large Mutation Prob" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 1 -value 0.4 -precision 3 Largecb; floatSliderGrp -h 25 -label "Max Change" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 0.1 -value 0.025 -precision 3 MaxCh; separator -w 440 -h 10; text -label "General tracing parameters" -w 440 -align "left" -font "boldLabelFont"; floatSliderGrp -h 25 -label "Russian Roulette Live Prob" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 1 -value 0.7 -precision 3 rrcb; floatSliderGrp -h 25 -label "Max Depth" -field true -fieldMinValue 1 -fieldMaxValue 1000 -minValue 1 -maxValue 1000 -value 1000 -precision 0 MaxDepth; checkBox -label "Bidirectional" Bidircb; separator -w 440 -h 10; text -label "Network rendering settings" -w 440 -align "left" -font "boldLabelFont"; floatSliderGrp -h 25 -label "Frame Upload Period" -field true -fieldMinValue 1 -fieldMaxValue 60 -minValue 1 -maxValue 60 -value 20 -precision 0 FUP; separator -w 440 -h 10; text -label "Miscellaneous settings" -w 440 -align "left" -font "boldLabelFont"; floatSliderGrp -h 25 -label "Image Save Period" -field true -fieldMinValue 1 -fieldMaxValue 60 -minValue 1 -maxValue 60 -value 30 -precision 0 ISP; floatSliderGrp -h 25 -label "Halt Time" -field true -fieldMinValue -5 -fieldMaxValue 5 -minValue -5 -maxValue 5 -value -1 -precision 0 HT; optionMenu -label "What is your Up Axis" upAxis; menuItem -label "Y"; menuItem -label "Z"; checkBox -label "Logging" -value 1 Loggicb; checkBox -label "Normal Smoothing" -value 1 Normacb; checkBox -label "Save Tonemapped Exr" SaveTcb; checkBox -label "Save Untonemapped Exr" SaveUcb; setParent ..; setParent ..; frameLayout -collapsable false -label "Tone Mapping- Reinhard" -w 440 -labelAlign "top" -borderStyle "in"; columnLayout -columnAlign "center"; floatSliderGrp -h 25 -label "Pre Scale" -field true -fieldMinValue 0 -fieldMaxValue 10 -minValue 0.001 -maxValue 10 -value 2 -precision 3 PreScale; floatSliderGrp -h 25 -label "Post Scale" -field true -fieldMinValue 0 -fieldMaxValue 10 -minValue 0.001 -maxValue 10 -value 1 -precision 3 PostScale; separator -w 440 -h 12; colorSliderGrp -h 25 -label "Color Correction" -rgb 1.0 1.0 1.0 colCor; setParent ..; setParent ..; frameLayout -collapsable false -label "Camera Setting" -w 440 -labelAlign "top" -borderStyle "in"; columnLayout -columnAlign "center"; floatSliderGrp -h 25 -label "F/stop" -field true -fieldMinValue 1 -fieldMaxValue 32 -minValue 1 -maxValue 32 -value 8 -precision 1 FStop; separator -w 440 -h 12; optionMenu -label "White Balance" Whitecb; menuItem -label "E"; menuItem -label "D50"; menuItem -label "D55"; menuItem -label "D60"; menuItem -label "D65"; menuItem -label "D75"; menuItem -label "A"; menuItem -label "B"; menuItem -label "C"; menuItem -label "9300"; menuItem -label "F2"; menuItem -label "F7"; menuItem -label "F11"; setParent ..; setParent ..; frameLayout -collapsable false -label "Environment Setting" -w 440 -labelAlign "top" -borderStyle "in"; columnLayout -columnAlign "center"; checkBox -label "Sky Light" -align "center" -value 0 -changeCommand "skylight" SkylightCheckBox; floatSliderGrp -h 25 -label "Turbidity" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.1 -maxValue 5 -value 2 -precision 3 -enable 0 turb; floatSliderGrp -h 25 -label "Sky Gain" -field true -fieldMinValue -0.0001 -fieldMaxValue 2 -minValue 0.0001 -maxValue 1 -value 0.05 -precision 4 -enable 0 gain; separator -w 440 -h 12; checkBox -label "Background Light" -align "center" -changeCommand "bglight" BgCheckBox; colorSliderGrp -h 25 -label "Background Light Color" -rgb 0.5 0.5 0.5 -enable 0 bgSlider; separator -w 440 -h 12; checkBox -label "HDR map" -align "center" -changeCommand "hdrlight" HDRCheckBox; rowLayout -numberOfColumns 3 -columnWidth3 140 240 60; text -label "HDR map" -width 140 -align "right" -enable 0 hdrText; textField -fileName "" -width 240 -enable 0 hdrField; symbolButton -height 24 -image "mtiIcons/mtiBrowse.bmp" -command "browseHDR" -enable 0 hdrButton; setParent ..; setParent ..; setParent ..; setParent ..; setParent ..; setParent ..; columnLayout -columnAlign "center"; button -w 440 -h 30 -label "Generate XML code" -align "center" -command "indigoOutput"; showWindow; //-----------------TIEING SCRIPTS------------------ //--SliderGrps-- global proc string getLarge(){ float $larg = `floatSliderGrp -query -value Largecb`; return $larg; } global proc float getFStop(){ float $larg = `floatSliderGrp -query -value FStop`; return $larg; } global proc string getPreScale(){ float $larg = `floatSliderGrp -query -value PreScale`; return $larg; } global proc string getPostScale(){ float $larg = `floatSliderGrp -query -value PostScale`; return $larg; } global proc string getMch(){ float $mch = `floatSliderGrp -query -value MaxCh`; return $mch; } global proc string getRrlp(){ float $rrlp = `floatSliderGrp -query -value rrcb`; return $rrlp; } global proc string getMd(){ float $mch = `floatSliderGrp -query -value MaxDepth`; return $mch; } global proc string getTurb(){ float $xyz = `floatSliderGrp -query -value turb`; return $xyz; } global proc string getSGain(){ float $zyx = `floatSliderGrp -query -value gain`; return $zyx; } global proc string getfup(){ float $mch = `floatSliderGrp -query -value FUP`; return $mch; } global proc string getisp(){ float $mch = `floatSliderGrp -query -value ISP`; return $mch; } global proc string getht(){ float $mch = `floatSliderGrp -query -value HT`; return $mch; } //--CheckBoxes-- global proc string getMetro(){ int $metr = `checkBox -query -value Metrocb`; if ($metr == 0) return "false"; if ($metr == 1) return "true"; } global proc string getBidir(){ int $bidi = `checkBox -query -value Bidircb`; if ($bidi == 0) return "false"; if ($bidi == 1) return "true"; } global proc string getLoggi(){ int $logg = `checkBox -query -value Loggicb`; if ($logg == 0) return "false"; if ($logg == 1) return "true"; } global proc string getNorma(){ int $norm = `checkBox -query -value Normacb`; if ($norm == 0) return "false"; if ($norm == 1) return "true"; } global proc string getSaveT(){ int $savt = `checkBox -query -value SaveTcb`; if ($savt == 0) return "false"; if ($savt == 1) return "true"; } global proc string getSaveU(){ int $savu = `checkBox -query -value SaveUcb`; if ($savu == 0) return "false"; if ($savu == 1) return "true"; } //--OptionMenus-- global proc string getWB(){ return `optionMenu -query -value Whitecb`; } global proc string getupAxis(){ return `optionMenu -query -value upAxis`; } //--HDR-- global proc string getHDRPath(){ return `textField -query -fileName hdrField`; } //-----------------THE XML CONVERTER------------------ global proc int indigoOutput(){ window -title "Progress" -h 86 -w 300 progWin; columnLayout; text -label "Starting..." -w 300 -align "left" -font "boldLabelFont" progText; progressBar -maxValue 25 -width 292 progs; showWindow; string $metr = getMetro(); string $larg = getLarge(); string $bidi = getBidir(); string $logg = getLoggi(); string $norm = getNorma(); string $savt = getSaveT(); string $savu = getSaveU(); string $mch = getMch(); string $rrlp = getRrlp(); string $md = getMd(); string $fup = getfup(); string $isp = getisp(); string $ht = getht(); string $PreScale = getPreScale(); string $PostScale = getPostScale(); float $FStop = getFStop(); string $WB = getWB(); string $upAxis = getupAxis(); string $write = "\n"; text -edit -label "Making Settings..." progText; progressBar -edit -step 1 progs; $write +="\n"; $write += "\n\n"; $write += "\t" + `getAttr defaultResolution.width` +"\n"; $write += "\t" + `getAttr defaultResolution.height` +"\n"; $write += "\t"+$metr+"\n"; $write += "\t"+$larg+"\n"; $write += "\t"+$mch+"\n"; $write += "\t"+$rrlp+"\n"; $write += "\t"+$md+"\n"; $write += "\t"+$bidi+"\n"; $write += "\t10\n"; $write += "\t"+$fup+"\n"; $write += "\t"+$ht+"\n"; $write += "\t"+$logg+"\n"; $write += "\t"+$isp+"\n"; $write += "\t"+$savt+"\n"; $write += "\t"+$savu+"\n"; $write += "\n\n"; $write += "\t\n"; $write += "\t\t\n"; $write += "\t\t\t"+$PreScale+"\n"; $write += "\t\t\t"+$PostScale+"\n"; $write += "\t\t\n"; float $colcor[3] = `colorSliderGrp -query -rgbValue colCor`; $write += "\n\t\t"+$colcor[0]+" "+$colcor[1]+" "+$colcor[2]+"\n"; $write += "\t\n"; //--BG LIGHT-- if (getenv() == "skylight"){ float $col[3] = `colorSliderGrp -query -rgbValue bgSlider`; $write += "\n\t\n\t\t\n\t\t\t"+$col[0]+" "+$col[1]+" "+$col[2]+"\n\t\t\n\t\n\n\n"; } //--SUN LIGHT-- if (getenv() == "physical"){ float $x = `getAttr Sun.tx`; float $y = `getAttr Sun.ty`; float $z = `getAttr Sun.tz`; vector $sun = <<$x, $y, $z>>; $sun = normalize($sun); $write += "\n\n\t"+$sun.x+" "+$sun.y+" "+$sun.z+"\n\t"+getTurb()+"\n\t"+getSGain()+"\n\n"; } //--HDR LIGHT-- if (getenv() == "hdri"){ $write += "\n\n\t\n\t"+getHDRPath()+"\n\t512\n\t0.9\n\t\n\n"; } text -edit -label "Making Camera..." progText; progressBar -edit -step 1 progs; print("\nenvset1-" +getenv()+"\n"); $write += "\n\n"; float $px = `getAttr camera1.tx`; float $py = `getAttr camera1.ty`; float $pz = `getAttr camera1.tz`; vector $pos = <<$px, $py, $pz>>; float $tx = `getAttr camera1_aim.tx`; float $ty = `getAttr camera1_aim.ty`; float $tz = `getAttr camera1_aim.tz`; vector $target= <<$tx, $ty, $tz>>; vector $front = $target-$pos; vector $dist = $front; $front = normalize($front); if ($upAxis == "Y){ $py = -$pz; $pz = $py; } $write += "\t"+$px+" "+$py+" "+$pz+"\n"; float $ux = `getAttr camera1_up.tx`; float $uy = `getAttr camera1_up.ty`; float $uz = `getAttr camera1_up.tz`; vector $up = <<$ux, $uy, $uz>>; $up = $up - $pos; $up = normalize($up); if ($upAxis == "Y){ $up.y = -$up.z; $up.z = $up.y; } if ($upAxis == "Y){ $front.y = -$front.z; $front.z = $front.y; } $write += "\t"+$up.x+" "+$up.y+" "+$up.z+"\n"; $write += "\t"+$front.x+" "+$front.y+" "+$front.z+"\n"; float $fstop = $FStop; float $aprad = 50/$fstop; $aprad = $aprad/200; $write += "\t"+$aprad+"\n"; float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z); $write += "\t"+$FD+"\n"; $write += "\t"+`getAttr defaultResolution.deviceAspectRatio`+"\n"; $write += "\t0.036\n"; $write += "\t0.0523314\n"; $write += "\t"+$WB+"\n"; $write += "\n\n"; text -edit -label "Making Materials..." progText; progressBar -edit -step 1 progs; string $mats[] = `ls -mat`; for ($one in $mats){ float $inc[]=`getAttr ($one + ".incandescence")`; if ($inc[0]+$inc[1]+$inc[2] == 0.0){ if (`objectType $one` == "lambert"){ $write+= "\n\n"; if($one == "initialMaterialInfo"){ $one = "lambert1"; } $write += "\t"+$one+"\n"; $write += "\t\n"; float $color[] = `getAttr ($one + ".color")`; $write+="\t\t"+$color[0]+" "+$color[1]+" "+$color[2]+"\n"; $write += "\t\n"; $write += "\n"; } if (`objectType $one` == "phong"){ $write += "\n\n"; $write += "\t\t"+$one+"\n"; $write += "\t\n"; float $col[] = `getAttr ($one + ".color")`; $write += "\t\t"+$col[0]+" "+$col[1]+" "+$col[2]+"\n"; float $reflectivity = `getAttr($one +".reflectivity")`; if ($reflectivity > 0.0){ $write += "\t\t"+$reflectivity+" "+$reflectivity+" "+$reflectivity+"\n"; } if ($reflectivity == 0.0){ float $refl[] = `getAttr ($one +".reflectedColor")`; $write += "\t\t"+$refl[0]+" "+$refl[1]+" "+$refl[2]+"\n"; } float $exp = `getAttr ($one + ".cosinePower")`; float $exp = $exp * 10; $write += "\t\t"+$exp+"\n"; $write += "\t\t0.5\n"; $write += "\t\n"; $write += "\n"; } } } text -edit -label "Creating Meshes..." progText; progressBar -edit -step 1 progs; string $shapes[] = `ls -s`; for ($one in $shapes){ if(`objectType $one` == "mesh"){ int $nV[] = `polyEvaluate -v $one`; int $nF[] = `polyEvaluate -f $one`; int $x = 0; $write += "\n\n"; $write += "\t"+$one+"\n"; $write += "\t\n"; for($x=0;$x < $nV[0];$x++){ string $cv = $one+".vtx["+$x+"]"; float $pos[] = `pointPosition $cv`; $write += "\t\t\n"; } progressBar -edit -step 1 progs; $write += "\t\n"; string $sg[] = `listConnections -type shadingEngine $one`; string $mat[] = `listConnections $sg[0]`; //$mat[2] holds the actual material. print(`listConnections $sg[0]`); if ($mat[2] == "initialMaterialInfo"){ $mat[2] = $mat[0]; } if ($mat[2] == "renderPartition"){ $mat[2] = $mat[3]; } progressBar -edit -step 1 progs; text -edit -label "Setting Tris..." progText; $write += "\t"+$mat[2]+"\n"; for($x = 0;$x < $nF[0];$x++){ string $curface = $one +".f["+$x+"]"; string $vfl[] = `polyListComponentConversion -ff -tvf $curface`; $vfl = `filterExpand -sm 70 $vfl`; $write +="\t\t"; for ($v in $vfl){ string $vert[]=`polyListComponentConversion -fvf -tv $v`; string $vnum = match("[0-9]+",match("[0-9]+\]",$vert[0])); int $conv = $vnum; $write += $conv + " "; } $write += "\n"; } text -edit -label "Created Model..." progText; $write += "\t\n"; $write += "\t\n"; $write += ""; } } text -edit -label "Making Models..." progText; progressBar -edit -step 1 progs; //Models string $trans[] =`ls -s`; for ($one in $trans) { if (`objectType $one` == "mesh"){ string $sg[] = `listConnections -t shadingEngine $one`; if ($sg[0] == "initialShadingGroup"){ $sg[0] = "lambert1"; } string $amat[] = `listConnections $sg[0]`; if ($amat[2] == "renderPartition"){ $amat[2] = $amat[3]; } if ($amat[2] == "defaultShaderList1"){ $amat[2] = "lambert1"; } float $inc[] = `getAttr ($amat[2]+".incandescence")`; print($one + "/:con " + $amat[2]+"\n"); if ($inc[1]+$inc[2]+$inc[0] ==0){ $write += "\n\n\n\t0 0 0"; $write += "\n\t1"; $write += "\n\t"+$norm+""; if ($upAxis == "Z"){ $write += "\n\t1 0 0 0 1 0 0 0 1\n"; } if ($upAxis == "Y"){ $write += "\n\t1 0 0 0 0 1 0 -1 0"; } $write += "\n\t"+$one +"\n"; } if ($inc[1]+$inc[2]+$inc[0] >0){ $write += "\n\n"; $write += "\t0 0 0\n"; $write += "\t1\n"; if ($upAxis == "Z"){ $write += "\n\t1 0 0 0 1 0 0 0 1\n"; } if ($upAxis == "Y"){ $write += "\n\t1 0 0 0 0 1 0 -1 0\n"; } $write += "\t"+$one+"\n"; $write += "\t\n"; float $bbody2 = $inc[0]+$inc[1]+$inc[2]; int $bbody = $bbody2 * 3000; $write += "\t\n"; $write += "\t\t"+$bbody+"\n"; $write += "\t\t1.0\n"; $write += "\t\n"; $write += "\t\n"; $write += "\n"; } } } $write += "\n"; text -edit -label "Done..." progText; progressBar -edit -step 100 progs; deleteUI progWin; if (`window -exists indOut`) deleteUI indOut; window -title "Output for Indigo Renderer" indOut; windowPref -wh 500 600 indOut; rowLayout -h 600; scrollField -w 492 -h 566 -editable false -tx $write; showWindow indOut; return 1; }