// =========================================================================== // 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. // =========================================================================== global proc showRendRelPanelMenu(int $show, string $menuBarLayout) { if ($show) { menuBarLayout -e -h 25 $menuBarLayout; } else { menuBarLayout -e -h 1 $menuBarLayout; } optionVar -intValue showRendRelPanelMenu $show; } global proc buildRRPeditMenu (string $editorName, string $parentMenu) { setParent -menu $parentMenu; // These should be unique enough names for the widgets for this // instance of the rendering rel. editor string $addItem = ($editorName + "addItem"); string $removeItem = ($editorName + "removeItem"); string $createSGitem = ($editorName + "createSGitem"); // Check to see if we have to build the menu items if (`menu -query -numberOfItems $parentMenu` == 0) { menuItem -label (uiRes("m_rendRelPanel.kAddItems")) -command ("lightListEditor -edit -add " + $editorName) $addItem; menuItem -label (uiRes("m_rendRelPanel.kRemoveItems")) -command ("lightListEditor -edit -remove " + $editorName) $removeItem; menuItem -divider true; menuItem -label (uiRes("m_rendRelPanel.kCreateShadingGroup")) -command ("sets -renderable 1 -empty") $createSGitem; } } global proc buildRRPmodeMenu (string $editorName, string $parentMenu) { setParent -menu $parentMenu; // These should be unique enough names for the widgets for this // instance of the rendering rel. editor string $lightListsItem = ($editorName + "lightListsItem"); string $shadingListsItem = ($editorName + "shadingListsItem"); // Check to see if we have to build the menu items if (`menu -query -numberOfItems $parentMenu` == 0) { radioMenuItemCollection; menuItem -label (uiRes("m_rendRelPanel.kLightsLists")) -radioButton true -command ("lightListEditor -edit -mode lightLists " + $editorName) $lightListsItem; menuItem -label (uiRes("m_rendRelPanel.kShadingLists")) -radioButton true -command ("lightListEditor -edit -mode shadingLists " + $editorName) $shadingListsItem; } // Update radio button checks for operating mode string $operatingMode = `lightListEditor -query -mode $editorName`; menuItem -edit -radioButton ($operatingMode == "lightLists") $lightListsItem; menuItem -edit -radioButton ($operatingMode == "shadingLists") $shadingListsItem; } global proc buildRRPlistMenu (string $editorName, string $parentMenu) { setParent -menu $parentMenu; // These should be unique enough names for the widgets for this // instance of the rendering rel. editor string $singleSelectionItem = ($editorName + "singleSelectionItem"); string $multiSelectionItem = ($editorName + "multiSelectionItem"); string $allShadingGroupsItem= ($editorName + "allShadingGroupsItem"); // Check to see if we have to build the menu items if (`menu -query -numberOfItems $parentMenu` == 0) { radioMenuItemCollection; menuItem -label (uiRes("m_rendRelPanel.kSingleSelection")) -radioButton true -command ("lightListEditor -edit -singleSelection " + $editorName) $singleSelectionItem; menuItem -label (uiRes("m_rendRelPanel.kMultipleSelection")) -radioButton true -command ("lightListEditor -edit -multipleSelection " + $editorName) $multiSelectionItem; menuItem -divider true; menuItem -label (uiRes("m_rendRelPanel.kAllShadingGroups")) -checkBox true -command ("lightListEditor -edit -allShadingGroups " + $editorName) $allShadingGroupsItem; } // Update radio button checks for operating mode int $singleSelection = `lightListEditor -query -singleSelection $editorName`; int $multiSelection = ! $singleSelection; menuItem -edit -radioButton $singleSelection $singleSelectionItem; menuItem -edit -radioButton $multiSelection $multiSelectionItem; int $allShadingGroups = `lightListEditor -query -allShadingGroups $editorName`; menuItem -edit -checkBox $allShadingGroups $allShadingGroupsItem; } global proc makeRendRelPanelMenu(string $editorName, string $menuBarLayoutName) { setParent $menuBarLayoutName; // These should be unique enough names for the widgets for this // instance of the set editor string $modeMenu = ($editorName + "modeMenu"); string $editMenu = ($editorName + "editMenu"); string $listMenu = ($editorName + "listMenu"); menu -label (uiRes("m_rendRelPanel.kMode")) -tearOff true -aob true $modeMenu; menu -edit -postMenuCommand ("buildRRPmodeMenu " + $editorName + " " + $modeMenu) $modeMenu; setParent -menu ..; menu -label (uiRes("m_rendRelPanel.kEdit")) -tearOff true $editMenu; menu -edit -postMenuCommand ("buildRRPeditMenu " + $editorName + " " + $editMenu) $editMenu; setParent -menu ..; menu -label (uiRes("m_rendRelPanel.kList")) -tearOff true $listMenu; menu -edit -postMenuCommand ("buildRRPlistMenu " + $editorName + " " + $listMenu) $listMenu; setParent -menu ..; } global proc makeRendRelPanelPopupMenu(string $editorName) { string $menuPopup = ($editorName + "menuPopup"); popupMenu -ctrlModifier false -button 3 -aob false -parent $editorName $menuPopup; // These should be unique enough names for the widgets for this // instance of the set editor string $modeMenu = ($editorName + "modePopupMenu"); string $editMenu = ($editorName + "editPopupMenu"); string $listMenu = ($editorName + "listPopupMenu"); menuItem -label (uiRes("m_rendRelPanel.kMode2")) -tearOff true -subMenu true $modeMenu; menuItem -edit -postMenuCommand ("buildRRPmodeMenu " + $editorName + " " + $modeMenu) $modeMenu; setParent -menu ..; menuItem -label (uiRes("m_rendRelPanel.kEdit2")) -tearOff true -subMenu true -aob true $editMenu; menuItem -edit -postMenuCommand ("buildRRPeditMenu " + $editorName + " " + $editMenu) $editMenu; setParent -menu ..; menuItem -label (uiRes("m_rendRelPanel.kList2")) -tearOff true -subMenu true $listMenu; menuItem -edit -postMenuCommand ("buildRRPlistMenu " + $editorName + " " + $listMenu) $listMenu; setParent -menu ..; } global proc rendRelPanel(string $panelName) { global string $gMainPane; // instantiate a new rendRelPanel setParent $gMainPane; scriptedPanel -unParent -type rendRelPanel -l $panelName $panelName; } global proc createRendRelPanel (string $whichPanel) // // Description: // Define the editors that are used in this panel. No // controls (widgets) are created at this point. // { // create unique names for editors based on panel name // string $rendRelEd = ($whichPanel + "RendRelEd"); string $outlineEd = ($whichPanel + "OutlineEd"); lightListEditor -unParent $rendRelEd; outlinerEditor -unParent -mainListConnection worldList -selectionConnection modelList $outlineEd; } global proc addRendRelPanel (string $whichPanel) // // Description: // Add the panel to a layout. // Parent the editors to that layout and create any other // controls (widgets) required. // { string $rendRelEd = ($whichPanel + "RendRelEd"); string $outlineEd = ($whichPanel + "OutlineEd"); waitCursor -state on; string $fl = `frameLayout -bv 0 -lv 0 rreFrameLayout`; string $pl = `paneLayout -configuration "vertical2" -ps 1 35 100 rrePaneLayout`; // Parent the editors to the editor layout // outlinerEditor -edit -parent $pl $outlineEd; lightListEditor -edit -parent $pl $rendRelEd; // Make the menus string $menuBarLayoutName = `scriptedPanel -q -control $whichPanel`; string $formLayoutName = `formLayout`; if (`optionVar -exists showRendRelPanelMenu`) { showRendRelPanelMenu (`optionVar -query showRendRelPanelMenu`) $menuBarLayoutName; } // Attach the menus to the menu form makeRendRelPanelMenu $rendRelEd $menuBarLayoutName; // Attach the popup menu to the editor makeRendRelPanelPopupMenu $rendRelEd; setParent -top; waitCursor -state off; } global proc removeRendRelPanel (string $whichPanel) // // Description: // Remove the panel from a layout. // Delete controls. // { string $rendRelEd = ($whichPanel + "RendRelEd"); string $outlineEd = ($whichPanel + "OutlineEd"); if (`outlinerEditor -exists $outlineEd`) { outlinerEditor -edit -unParent $outlineEd; } if (`lightListEditor -exists $rendRelEd`) { lightListEditor -edit -unParent $rendRelEd; } } global proc deleteRendRelPanel (string $whichPanel) // // Description: // This proc will delete the contents of the panel, but not // the panel itself. // // Note: // We only need to delete editors here. Other UI will be taken care of // by the remove proc. // { string $rendRelEd = ($whichPanel + "RendRelEd"); string $outlineEd = ($whichPanel + "OutlineEd"); if (`lightListEditor -exists $rendRelEd`) { deleteUI -editor $rendRelEd; } if (`outlinerEditor -exists $outlineEd`) { deleteUI -editor $outlineEd; } } global proc string saveStateRendRelPanel (string $whichPanel) // // Description: // This proc returns a string that when executed will restore the // current state of the panel elements. // { string $indent = "\n\t\t\t"; string $rendRelEd = ($whichPanel + "RendRelEd"); string $outlineEd = ($whichPanel + "OutlineEd"); return ( $indent + "$editorName = ($panelName+\"OutlineEd\");\n" + `outlinerEditor -query -stateString $outlineEd` + ";\n" + $indent + "$editorName = ($panelName+\"RendRelEd\");\n" + `lightListEditor -query -stateString $rendRelEd` ); } global proc addToRREpanel(string $whichPanel) { frameLayout -bv 0 -lv 0 rreFrameLayout; paneLayout -configuration "vertical2" -ps 1 35 100 rrePaneLayout; outlinerEditor -mainListConnection worldList -selectionConnection modelList outEd; lightListEditor renderingRelEditor; }