// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // performComposite // // Description: // // Input Arguments: // $option : Whether to set the options to default values. // Return Value: // None // proc string compositeMapFileOutputType_melToUI (string $mel) { string $result = $mel; string $bmp = (uiRes("m_performComposite.kBmp")); string $cin = (uiRes("m_performComposite.kCin")); string $eps = (uiRes("m_performComposite.kEps")); string $gif = (uiRes("m_performComposite.kGif")); string $iff = (uiRes("m_performComposite.kIff")); string $jpg = (uiRes("m_performComposite.kJpg")); string $pix = (uiRes("m_performComposite.kPix")); string $rla = (uiRes("m_performComposite.kRla")); string $sgi = (uiRes("m_performComposite.kSgi")); string $si = (uiRes("m_performComposite.kSi")); string $tga = (uiRes("m_performComposite.kTga")); string $tif = (uiRes("m_performComposite.kTif")); string $yuv = (uiRes("m_performComposite.kYuv")); if ($mel == "bmp"){ $result = $bmp; } else if ($mel == "cin"){ $result = $cin; } else if ($mel == "eps"){ $result = $eps; } else if ($mel == "gif"){ $result = $gif; } else if ($mel == "iff"){ $result = $iff; } else if ($mel == "jpg"){ $result = $jpg; } else if ($mel == "pix"){ $result = $pix; } else if ($mel == "rla"){ $result = $rla; } else if ($mel == "sgi"){ $result = $sgi; } else if ($mel == "si"){ $result = $si; } else if ($mel == "tga"){ $result = $tga; } else if ($mel == "tif"){ $result = $tif; } else if ($mel == "yuv"){ $result = $yuv; } else { uiToMelMsg( "compositeMapFileOutputType_melToUI", $mel, 1 ); } return $result; } proc string compositeMapFileOutputType_UITomel (string $ui) { string $result = $ui; if ( $ui == (uiRes("m_performComposite.kBmp")) ) { $result = "bmp"; } else if ($ui == (uiRes("m_performComposite.kCin")) ) { $result = "cin"; } else if ($ui == (uiRes("m_performComposite.kEps")) ) { $result = "eps"; } else if ($ui == (uiRes("m_performComposite.kGif")) ) { $result = "gif"; } else if ($ui == (uiRes("m_performComposite.kIff")) ) { $result = "iff"; } else if ($ui == (uiRes("m_performComposite.kJpg")) ) { $result = "jpg"; } else if ($ui == (uiRes("m_performComposite.kPix")) ) { $result = "pix"; } else if ($ui == (uiRes("m_performComposite.kRla")) ) { $result = "rla"; } else if ($ui == (uiRes("m_performComposite.kSgi")) ) { $result = "sgi"; } else if ($ui == (uiRes("m_performComposite.kSi")) ) { $result = "si"; } else if ($ui == (uiRes("m_performComposite.kTga")) ) { $result = "tga"; } else if ($ui == (uiRes("m_performComposite.kTif")) ) { $result = "tif"; } else if ($ui == (uiRes("m_performComposite.kYuv")) ) { $result = "yuv"; } else { uiToMelMsg( "compositeMapFileOutputType_UITomel", $ui, 1 ); } return $result; } proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists "compositeMapFileName"`) optionVar -stringValue "compositeMapFileName" "composite"; if ($forceFactorySettings || !`optionVar -exists "compositeMapFileOutputType"`) optionVar -stringValue "compositeMapFileOutputType" "tif"; if ($forceFactorySettings || !`optionVar -exists "compositeMapX"`) optionVar -intValue "compositeMapX" 256; if ($forceFactorySettings || !`optionVar -exists "compositeMapY"`) optionVar -intValue "compositeMapY" 256; if ($forceFactorySettings || !`optionVar -exists "compositeStart"`) optionVar -floatValue "compositeStart" 1; if ($forceFactorySettings || !`optionVar -exists "compositeEnd"`) optionVar -floatValue "compositeEnd" 10; if ($forceFactorySettings || !`optionVar -exists "compositeBy"`) optionVar -floatValue "compositeBy" 1; if ($forceFactorySettings || !`optionVar -exists "compositePadding"`) optionVar -intValue "compositePadding" 4; if ($forceFactorySettings || !`optionVar -exists "compositeFcheck"`) optionVar -intValue "compositeFcheck" 1; } global proc compositeSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; textField -edit -text `optionVar -query compositeMapFileName` compositeMapFileName; string $value = compositeMapFileOutputType_melToUI(`optionVar -query compositeMapFileOutputType`); optionMenuGrp -edit -value $value compositeMapFileOutputType; intSliderGrp -edit -value `optionVar -query compositeMapX` compositeMapX; intSliderGrp -edit -value `optionVar -query compositeMapY` compositeMapY; floatSliderGrp -edit -value `optionVar -query compositeStart` compositeStart; floatSliderGrp -edit -value `optionVar -query compositeEnd` compositeEnd; floatSliderGrp -edit -value `optionVar -query compositeBy` compositeBy; intSliderGrp -edit -value `optionVar -query compositePadding` compositePadding; checkBoxGrp -edit -value1 `optionVar -query compositeFcheck` compositeFcheck; } global proc compositeCallback (string $parent, int $doIt) { setParent $parent; optionVar -stringValue "compositeMapFileName" `textField -query -text compositeMapFileName`; string $value = compositeMapFileOutputType_UITomel(`optionMenuGrp -query -value compositeMapFileOutputType`); optionVar -stringValue "compositeMapFileOutputType" $value; optionVar -intValue "compositeMapX" `intSliderGrp -query -value compositeMapX`; optionVar -intValue "compositeMapY" `intSliderGrp -query -value compositeMapY`; optionVar -intValue "compositeStart" `floatSliderGrp -query -value compositeStart`; optionVar -intValue "compositeEnd" `floatSliderGrp -query -value compositeEnd`; optionVar -intValue "compositeBy" `floatSliderGrp -query -value compositeBy`; optionVar -intValue "compositePadding" `intSliderGrp -query -value compositePadding`; optionVar -intValue "compositeFcheck" `checkBoxGrp -query -value1 compositeFcheck`; if ($doIt) { performComposite 0; string $tmpCmd = "performComposite 0 "; addToRecentCommandQueue $tmpCmd "Test Range"; } } proc compositeOptions () { string $commandName = "composite"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // STEP 1: Get the option box. // ============================ // string $layout = getOptionBox(); setParent $layout; // STEP 2: Pass the command name to the option box. // ================================================= // setOptionBoxCommandName($commandName); // STEP 3: Activate the default UI template. // ========================================== // setUITemplate -pushTemplate DefaultTemplate; // STEP 4: Create option box contents. // =================================== // waitCursor -state 1; string $parent = `columnLayout -adjustableColumn 1`; frameLayout -label (uiRes("m_performComposite.kImage")) -collapsable 0; columnLayout; rowLayout -numberOfColumns 3 -columnWidth 2 212 -columnWidth 3 25; text -label (uiRes("m_performComposite.kImageName")) ; textField compositeMapFileName; setParent ..; optionMenuGrp -label (uiRes("m_performComposite.kFileFmt")) compositeMapFileOutputType; if (`about -mac`) { menuItem -label (uiRes("m_performComposite.kBmp")); menuItem -label (uiRes("m_performComposite.kIff")); menuItem -label (uiRes("m_performComposite.kJpg")); menuItem -label (uiRes("m_performComposite.kSgi")); menuItem -label (uiRes("m_performComposite.kTga")); menuItem -label (uiRes("m_performComposite.kTif")); } else { menuItem -label (uiRes("m_performComposite.kBmp")); menuItem -label (uiRes("m_performComposite.kCin")); menuItem -label (uiRes("m_performComposite.kEps")); menuItem -label (uiRes("m_performComposite.kGif")); menuItem -label (uiRes("m_performComposite.kIff")); menuItem -label (uiRes("m_performComposite.kJpg")); menuItem -label (uiRes("m_performComposite.kPix")); menuItem -label (uiRes("m_performComposite.kRla")); menuItem -label (uiRes("m_performComposite.kSgi")); menuItem -label (uiRes("m_performComposite.kSi")); menuItem -label (uiRes("m_performComposite.kTga")); menuItem -label (uiRes("m_performComposite.kTif")); menuItem -label (uiRes("m_performComposite.kYuv")); } intSliderGrp -field on -label (uiRes("m_performComposite.kXResolution")) -minValue 1 -maxValue 1024 -fieldMinValue 1 -fieldMaxValue 4096 -value 256 compositeMapX; intSliderGrp -field on -label (uiRes("m_performComposite.kYResolution")) -minValue 1 -maxValue 1024 -fieldMinValue 1 -fieldMaxValue 4096 -value 256 compositeMapY; setParent ..; setParent ..; frameLayout -label (uiRes("m_performComposite.kRange")) -collapsable 0; columnLayout; floatSliderGrp -field on -label (uiRes("m_performComposite.kStartFrame")) -minValue 0 -maxValue 1024 -value 1 compositeStart; floatSliderGrp -field on -label (uiRes("m_performComposite.kEndFrame")) -minValue 0 -maxValue 1024 -value 1 compositeEnd; floatSliderGrp -field on -label (uiRes("m_performComposite.kByFrame")) -minValue 0.1 -maxValue 10 -value 1 compositeBy; intSliderGrp -label (uiRes("m_performComposite.kPadding")) -value 4 -minValue 0 -maxValue 10 compositePadding; checkBoxGrp -numberOfCheckBoxes 1 -label1 (uiRes("m_performComposite.kAutoLoadRangeInImageViewer")) -value1 1 compositeFcheck; setParent ..; setParent ..; //copyAttrib setParent -menu ..; waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: Customize the buttons. // ============================== // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performComposite.kApply")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $applyAndCloseBtn = getOptionBoxApplyAndCloseBtn(); button -edit -label (uiRes("m_performComposite.kRenderTextureRange")) $applyAndCloseBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + " " +"; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Step 7: Set the option box title. // ================================= // setOptionBoxTitle (uiRes("m_performComposite.kRenderTextureRangeOptions")); setOptionBoxHelpTag( "HypershadeRenderTextureRange" ); // Step 8: Customize the 'Help' menu item text. // ============================================ // eval (($setup + " " + $parent + " " + 0)); // Step 9: Show the option box. // ============================= // showOptionBox(); } proc string assembleCmd() { setOptionVars (false); int $doHistory = `constructionHistory -q -toggle`; string $cmd = "composite "; $cmd += `optionVar -query "compositeMapX"`; $cmd += " "; $cmd += `optionVar -query "compositeMapY"`; $cmd += " \""; $cmd += `optionVar -query "compositeMapFileName"`; $cmd += "\" "; $cmd += `optionVar -query "compositeMapFileOutputType"`; $cmd += " images "; $cmd += `optionVar -query "compositeStart"`; $cmd += " "; $cmd += `optionVar -query "compositeEnd"`; $cmd += " "; $cmd += `optionVar -query "compositeBy"`; $cmd += " "; $cmd += `optionVar -query "compositePadding"`; $cmd += " "; $cmd += `optionVar -query "compositeFcheck"`; return $cmd; } global proc string performComposite (int $option) { string $cmd=""; switch ($option) { case 0: $cmd = `assembleCmd`; evalEcho($cmd); break; case 1: compositeOptions; break; case 2: $cmd = `assembleCmd`; break; } return $cmd; }