// =========================================================================== // 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 global proc string ilrSetParentToGlobalsTab() { // Early out if it doesn't exist if(!`layout -exists turtleGlobalsTabLayout`) { return ""; } global string $gMasterLayerRendererName; string $renderer = isDisplayingAllRendererTabs() ? $gMasterLayerRendererName : `currentRenderer`; string $oldParent = `setParent -query`; // First set the parent to the correct tab layout. string $tabLayout = rendererTabLayoutName($renderer); if(!`layout -exists $tabLayout`) { return ""; } setParent $tabLayout; // Now set the parent to the correct turtle column layout if(!`layout -exists turtleGlobalsColumnLayout`) { setParent $oldParent; return ""; } setParent turtleGlobalsColumnLayout; // Now set the parent to the correct turtle tab layout if(!`layout -exists turtleGlobalsTabLayout`) { setParent $oldParent; return ""; } setParent turtleGlobalsTabLayout; // Return the new parent return `setParent -query`; } global proc string ilrSetParentToSamplingTab() { string $tab = ilrSetParentToGlobalsTab(); if (size($tab) && `layout -exists turtleSamplingTabLayout`) { setParent turtleSamplingTabLayout; return `setParent -query`; } return $tab; } global proc string ilrSetParentToGITab() { string $tab = ilrSetParentToGlobalsTab(); if (size($tab) && `layout -exists turtleGITabLayout`) { setParent turtleGITabLayout; return `setParent -query`; } return $tab; } global proc string ilrSetParentToEnvironmentTab() { string $tab = ilrSetParentToGlobalsTab(); if (size($tab) && `layout -exists turtleEnvironmentTabLayout`) { setParent turtleEnvironmentTabLayout; return `setParent -query`; } return $tab; } global proc string ilrSetParentToOptionsTab() { string $tab = ilrSetParentToGlobalsTab(); if (size($tab) && `layout -exists turtleOptionsTabLayout`) { setParent turtleOptionsTabLayout; return `setParent -query`; } return $tab; } global proc string ilrSetParentToBakingTab() { string $tab = ilrSetParentToGlobalsTab(); if (size($tab) && `layout -exists turtleBakingTabLayout`) { setParent turtleBakingTabLayout; return `setParent -query`; } return $tab; } global proc ilrUpdateTurtleTab() { if(!`layout -exists turtleGlobalsTabLayout` || currentRenderer() != "turtle") return; // Create default nodes if they don't exist ilrDefaultNodes(); ilrUpdateSamplingTab(); ilrUpdateGITab(); ilrUpdateEnvironmentTab(); ilrUpdateOptionsTab(); ilrUpdateBakingTab(); } global proc ilrBuildTurtleTab() { // Reference: MAYA-23578 MAYA-50239 // Workaround for cleaning the dirtied scene until there's a way to create default // nodes through the API. $sceneDirty = `file -query -modified`; // Create nodes if they don't exist ilrDefaultNodes(); // Setup layout string $parentForm = `setParent -query`; setUITemplate -pushTemplate attributeEditorTemplate; scrollLayout -horizontalScrollBarThickness 0 -childResizable 1 turtleGlobalsScrollLayout; columnLayout -adjustableColumn true turtleGlobalsColumnLayout; // Render Type Options attrEnumOptionMenuGrp -label "Render Type" -at "TurtleRenderOptions.renderer" ilrRenderTypeMenu; tabLayout -innerMarginWidth 5 -innerMarginHeight 5 turtleGlobalsTabLayout; string $tab1 = ilrBuildSamplingTab(); string $tab2 = ilrBuildGITab(); string $tab3 = ilrBuildEnvironmentTab(); string $tab4 = ilrBuildOptionsTab(); string $tab5 = ilrBuildBakingTab(); tabLayout -edit -tabLabel $tab1 "Sampling" -tabLabel $tab2 "Global Illumination" -tabLabel $tab3 "Environment" -tabLabel $tab4 "Options" -tabLabel $tab5 "Baking" turtleGlobalsTabLayout; setParent ..; setParent ..; setParent ..; setUITemplate -popTemplate; formLayout -edit -af turtleGlobalsScrollLayout "top" 0 -af turtleGlobalsScrollLayout "bottom" 0 -af turtleGlobalsScrollLayout "left" 0 -af turtleGlobalsScrollLayout "right" 0 $parentForm; ilrUpdateTurtleTab(); // Reference: MAYA-23578 MAYA-50239 // If the scene was previously unmodified, return it to that state since // we've only created shared nodes which are only holding attributes // in their default state (and will thus be recreated by the plugin if the // node is missing) if (! $sceneDirty) { file -modified 0; } } global proc ilrUpdateSamplingTab() { if(!`layout -exists turtleGlobalsTabLayout`) return; string $oldparent = `setParent -query`; ilrSetParentToSamplingTab(); ilrUpdateSamplingOptions; ilrUpdatePrepassOptions; ilrUpdateRaytracingOptions; setParent $oldparent; } global proc string ilrBuildSamplingTab() { setUITemplate -pushTemplate attributeEditorTemplate; string $layout = `columnLayout -adjustableColumn true turtleSamplingTabLayout`; // Sampling Options frameLayout -label "Anti-Aliasing" -cll true -cl 0 roSamplingFrame; setParent ..; // Create ui directly since anti-aliasing // should be visible by default string $oldparent = `setParent -q`; ilrBuildSamplingOptions("roSamplingFrame"); setParent $oldparent; // Prepass Options frameLayout -label "Prepass" -cll true -cl 1 -preExpandCommand "ilrBuildPrepassOptions (\"roPrepassFrame\")" roPrepassFrame; setParent ..; // Raytracing Options frameLayout -label "Ray Tracing" -cll true -cl 1 -preExpandCommand "ilrBuildRaytracingOptions (\"roRaytracingFrame\")" roRaytracingFrame; setParent ..; // End of layout setParent ..; setUITemplate -popTemplate; ilrUpdateSamplingTab(); return $layout; } global proc ilrUpdateEnvironmentTab() { if(!`layout -exists turtleGlobalsTabLayout`) return; string $oldparent = `setParent -query`; ilrSetParentToEnvironmentTab(); if (`layout -exists turtleEnvironmentTabLayout`) ilrUpdateEnvironmentCommonOptions(); if (`layout -exists roSkyLightFrame`) ilrUpdateSkyLightOptions(); if (`layout -exists roIBLFrame`) ilrUpdateIBLOptions(); setParent $oldparent; } global proc string ilrBuildEnvironmentTab() { setUITemplate -pushTemplate attributeEditorTemplate; string $layout = `columnLayout -adjustableColumn true turtleEnvironmentTabLayout`; ilrBuildEnvironmentCommonOptions("turtleEnvironmentTabLayout"); // Sky Light Options frameLayout -label "Sky Light" -cll true -cl 1 -preExpandCommand "ilrBuildSkyLightOptions(\"roSkyLightFrame\")" roSkyLightFrame; setParent ..; // IBL Options frameLayout -label "Image Based Lighting" -cll true -cl 1 -preExpandCommand "ilrBuildIBLOptions(\"roIBLFrame\")" roIBLFrame; setParent ..; // End of layout setParent ..; setUITemplate -popTemplate; ilrUpdateEnvironmentTab(); return $layout; } global proc ilrUpdateOptionsTab() { if(!`layout -exists turtleGlobalsTabLayout`) return; string $oldparent = `setParent -query`; ilrSetParentToOptionsTab(); if (`layout -exists roPerformaceFrame`) ilrUpdatePerformanceOptions(); if (`layout -exists roFrameBufferFrame`) ilrUpdateFrameBufferOptions(); if (`layout -exists roVerboseFrame`) ilrUpdateVerboseOptions(); if (`layout -exists roAdvancedSettingsFrame`) ilrUpdateAdvancedSettingsOptions(); setParent $oldparent; } global proc string ilrBuildOptionsTab() { setUITemplate -pushTemplate attributeEditorTemplate; string $layout = `columnLayout -adjustableColumn true turtleOptionsTabLayout`; // Performance Options frameLayout -label "Memory and Performance" -cll true -cl 1 -preExpandCommand "ilrBuildPerformanceOptions(\"roPerformanceFrame\")" roPerformanceFrame; setParent ..; // Framebuffer Options frameLayout -label "Framebuffer" -cll true -cl 1 -preExpandCommand "ilrBuildFrameBufferOptions(\"roFrameBufferFrame\")" roFrameBufferFrame; setParent ..; // Verbose frameLayout -label "Output Verbosity" -cll true -cl 1 -preExpandCommand "ilrBuildVerboseOptions (\"roVerboseFrame\")" roVerboseFrame; setParent ..; // Options Advanced Settings frameLayout -label "Advanced Settings" -cll true -cl 1 -preExpandCommand "ilrBuildAdvancedSettingsOptions (\"roOptionsAdvancedSettingsFrame\")" roOptionsAdvancedSettingsFrame; setParent ..; // End of layout setParent ..; setUITemplate -popTemplate; ilrUpdateOptionsTab(); return $layout; } global proc ilrUpdateGITab() { if(!`layout -exists turtleGlobalsTabLayout`) return; string $oldparent = `setParent -query`; ilrSetParentToGITab(); if (`layout -exists turtleGITabLayout`) ilrUpdateGICommonOptions(); setParent $oldparent; } global proc string ilrBuildGITab() { setUITemplate -pushTemplate attributeEditorTemplate; string $layout = `columnLayout -adjustableColumn true turtleGITabLayout`; ilrBuildGICommonOptions("turtleGITabLayout"); // Color Balance Options frameLayout -label "Color Balance" -cll true -cl 1 -preExpandCommand "ilrBuildGIColorBalanceOptions(\"roGIColorBalanceFrame\")" roGIColorBalanceFrame; setParent ..; // Final Gather Options frameLayout -label "Final Gather" -cll true -cl 1 -preExpandCommand "ilrBuildFinalGatherOptions(\"roFinalGatherFrame\")" roFinalGatherFrame; setParent ..; // Path Tracer Options frameLayout -label "Path Tracer" -cll true -cl 1 -preExpandCommand "ilrBuildPathTracerOptions(\"roPathTracerFrame\")" roPathTracerFrame; setParent ..; // Monte Carlo Options frameLayout -label "Monte Carlo" -cll true -cl 1 -preExpandCommand "ilrBuildMonteCarloOptions(\"roMonteCarloFrame\")" roMonteCarloFrame; setParent ..; // Global Photon Map Options frameLayout -label "Global Photon Map" -cll true -cl 1 -preExpandCommand "ilrBuildGlobalPhotonMapOptions(\"roGlobalPhotonMapFrame\")" roGlobalPhotonMapFrame; setParent ..; // Dynamic Photon Map Options frameLayout -label "Dynamic Photon Map" -cll true -cl 1 -preExpandCommand "ilrBuildDynamicPhotonMapOptions(\"roDynamicPhotonMapFrame\")" roDynamicPhotonMapFrame; setParent ..; // Caustics Photon Map Options frameLayout -label "Caustics Photon Map" -cll true -cl 1 -preExpandCommand "ilrBuildCausticsPhotonMapOptions(\"roCausticsPhotonMapFrame\")" roCausticsPhotonMapFrame; setParent ..; // GI Advanced Options frameLayout -label "Advanced Settings" -cll true -cl 1 -preExpandCommand "ilrBuildGIAdvancedOptions(\"roGIAdvancedFrame\")" roGIAdvancedFrame; setParent ..; // End of layout setParent ..; setUITemplate -popTemplate; ilrUpdateGITab(); return $layout; } global proc ilrUpdateBakingTab() { if(!`layout -exists turtleGlobalsTabLayout`) return; string $oldparent = `setParent -query`; ilrSetParentToBakingTab(); if (`optionMenuGrp -exists ilrCurrentBakeLayerMenu`) { string $layer = ilrGetCurrentBakeLayer(); optionMenuGrp -edit -value $layer ilrCurrentBakeLayerMenu; connectControl -index 2 ilrBakeToField ($layer + ".renderType"); } if (`layout -exists roBakeTargetsFrame`) ilrUpdateBakeTargetsUI(); if (`layout -exists roCommonBakeFrame`) ilrUpdateCommonBakeUI(); if (`layout -exists roTextureBakeFrame`) ilrUpdateTextureBakeUI(); if (`layout -exists roVertexBakeFrame`) ilrUpdateVertexBakeUI(); if (`layout -exists roBakeOutputsFrame`) ilrUpdateBakeOutputsUI(); setParent $oldparent; } global proc string ilrBuildBakingTab() { setUITemplate -pushTemplate attributeEditorTemplate; string $layout = `columnLayout -adjustableColumn true turtleBakingTabLayout`; string $layer = ilrGetCurrentBakeLayer(); // Current Bake Layer string $menu = `optionMenuGrp -label "Bake Layer" ilrCurrentBakeLayerMenu`; optionMenuGrp -edit -cc ("ilrSetCurrentBakeLayerFromMenu(\"" + $menu + "\")") ilrCurrentBakeLayerMenu; ilrBuildCurrentBakeLayerMenu($menu); separator -height 15; optionMenuGrp -label "Bake To" -cc "ilrUpdateBakingTab" ilrBakeToField; menuItem -label "Texture" -data 1; menuItem -label "Vertices" -data 2; // Bake Targets frameLayout -label "Targets" -cll true -cl false roBakeTargetsFrame; ilrBuildBakeTargetsUI("roBakeTargetsFrame"); setParent ..; // Common Options frameLayout -label "Common Settings" -cll true -cl true -preExpandCommand "ilrBuildCommonBakeUI(\"roCommonBakeFrame\")" roCommonBakeFrame; setParent ..; // Texture Baking Options frameLayout -label "Texture Bake Settings" -cll true -cl true -preExpandCommand "ilrBuildTextureBakeUI(\"roTextureBakeFrame\")" roTextureBakeFrame; setParent ..; // Vertex Baking Options frameLayout -label "Vertex Bake Settings" -cll true -cl true -preExpandCommand "ilrBuildVertexBakeUI(\"roVertexBakeFrame\")" roVertexBakeFrame; setParent ..; // Outputs frameLayout -label "Outputs" -cll true -cl false roBakeOutputsFrame; ilrBuildBakeOutputsUI("roBakeOutputsFrame"); setParent ..; // End of layout setParent ..; setUITemplate -popTemplate; ilrUpdateBakingTab(); return $layout; }