// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // provided at the time of installation or download, or which otherwise accompanies // // IBL Light Rig Editor procedures // global proc ilrIBLLightRigCreateAction() { string $array[] = `listConnections TurtleUIOptions.iblRigEnvShader`; if (size($array) == 0) { error("No environment shader is connected in IBL Light Rig Editor"); return; } $shader = $array[0]; $lightSet = `getAttr TurtleUIOptions.iblRigLightSet`; if (size($lightSet) == 0) { $lightSet = "turtleLightRig"; } $samples = `getAttr TurtleUIOptions.iblRigSamples`; $intens = `getAttr TurtleUIOptions.iblRigIntensity`; $emitDiff = `getAttr TurtleUIOptions.iblRigEmitDiffuse`; $emitSpec = `getAttr TurtleUIOptions.iblRigEmitSpecular`; $emitPhot = `getAttr TurtleUIOptions.iblRigEmitPhotons`; $globPhot = `getAttr TurtleUIOptions.iblRigGlobalPhotons`; $causPhot = `getAttr TurtleUIOptions.iblRigCausticsPhotons`; $energy = `getAttr TurtleUIOptions.iblRigPhotonEnergy`; $shadows = `getAttr TurtleUIOptions.iblRigShadows`; $shadRays = `getAttr TurtleUIOptions.iblRigShadowRays`; $shadAngl = `getAttr TurtleUIOptions.iblRigShadowAngle`; $cmd = "ilrIBLCmd"; $cmd += " -shader \"" + $shader + "\""; $cmd += " -setName \"" + $lightSet + "\""; $cmd += " -samples " + $samples; $cmd += " -intensity " + $intens; $cmd += " -emitDiffuse " + $emitDiff; $cmd += " -emitSpecular " + $emitSpec; $cmd += " -emitPhotons " + $emitPhot; $cmd += " -globalPhotons " + $globPhot; $cmd += " -causticsPhotons " + $causPhot; $cmd += " -photonEnergy " + $energy; $cmd += " -shadows " + $shadows; $cmd += " -shadowRays " + $shadRays; $cmd += " -shadowAngle " + $shadAngl; $cmd += ";"; print($cmd + "\n"); eval($cmd); } global proc ilrUpdateIBLLightRigEditor() { if(!`window -query -exists ilrIBLLightRigMainWindow`) { return; } $shadows = `getAttr TurtleUIOptions.iblRigShadows`; $photons = `getAttr TurtleUIOptions.iblRigEmitPhotons`; attrControlGrp -edit -enable $shadows ilrIBLLightRigShadowRaysField; attrControlGrp -edit -enable $shadows ilrIBLLightRigShadowAngleField; attrControlGrp -edit -enable $photons ilrIBLLightRigCausticsPhotonsField; attrControlGrp -edit -enable $photons ilrIBLLightRigGlobalPhotonsField; attrControlGrp -edit -enable $photons ilrIBLLightRigPhotonEnergyField; } global proc ilrIBLLightRigEditor() { // Make sure the default nodes exists // ilrDefaultNodes(); // Remove any existing UI to avoid duplicate element names // if(`window -query -exists ilrIBLLightRigMainWindow`) { deleteUI ilrIBLLightRigMainWindow; } // Build the UI // string $oldParent = `setParent -query`; setUITemplate -pushTemplate attributeEditorTemplate; string $editor = `window -title "Turtle IBL Light Rig Editor" -resizeToFitChildren true ilrIBLLightRigMainWindow`; setParent $editor; formLayout; columnLayout -rowSpacing 2 -adjustableColumn true; attrControlGrp -label "Light Rig Name" -attribute "TurtleUIOptions.iblRigLightSet" ilrIBLLightRigLightSetField; attrNavigationControlGrp -label "Environment Shader" -columnAttach 1 "right" 5 -columnAttach 3 "left" 5 -attribute "TurtleUIOptions.iblRigEnvShader" ilrIBLLightRigEnvShaderField; separator; attrControlGrp -label "Samples" -attribute "TurtleUIOptions.iblRigSamples" ilrIBLLightRigSamplesField; attrControlGrp -label "Intensity" -attribute "TurtleUIOptions.iblRigIntensity" ilrIBLLightRigIntensityField; attrControlGrp -label "Emit Diffuse" -attribute "TurtleUIOptions.iblRigEmitDiffuse" ilrIBLLightRigEmitDiffuseField; attrControlGrp -label "Emit Specular" -attribute "TurtleUIOptions.iblRigEmitSpecular" ilrIBLLightRigEmitSpecularField; attrControlGrp -label "Enable Shadows" -attribute "TurtleUIOptions.iblRigShadows" -cc "ilrUpdateIBLLightRigEditor" ilrIBLLightRigShadowsField; attrControlGrp -label "Shadow Rays" -attribute "TurtleUIOptions.iblRigShadowRays" ilrIBLLightRigShadowRaysField; attrControlGrp -label "Light Angle" -attribute "TurtleUIOptions.iblRigShadowAngle" ilrIBLLightRigShadowAngleField; separator; attrControlGrp -label "Emit Photons" -attribute "TurtleUIOptions.iblRigEmitPhotons" -cc "ilrUpdateIBLLightRigEditor" ilrIBLLightRigEmitPhotonsField; attrControlGrp -label "Caustics Photons" -attribute "TurtleUIOptions.iblRigCausticsPhotons" ilrIBLLightRigCausticsPhotonsField; attrControlGrp -label "Global Photons" -attribute "TurtleUIOptions.iblRigGlobalPhotons" ilrIBLLightRigGlobalPhotonsField; attrControlGrp -label "Photon Energy" -attribute "TurtleUIOptions.iblRigPhotonEnergy" ilrIBLLightRigPhotonEnergyField; separator; columnLayout -adjustableColumn true; rowLayout -numberOfColumns 3 -columnWidth3 160 160 160 -columnAttach3 "both" "both" "both" -columnOffset3 3 3 3 -columnAlign3 "center" "center" "center"; button -label "Create Light Rig" -c ("ilrIBLLightRigCreateAction"); button -label "Close" -c ("deleteUI -window " + $editor); setParent ..; setParent ..; setParent ..; setParent ..; setParent ..; ilrUpdateIBLLightRigEditor(); setUITemplate -popTemplate; showWindow $editor; setParent $oldParent; } global proc ilrCloseIBLLightRigEditor() { if(`window -query -exists ilrIBLLightRigMainWindow`) { deleteUI ilrIBLLightRigMainWindow; } }