// =========================================================================== // 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. // =========================================================================== // Description: This procedure is called to set the hyper graph open // mode to the one user specified. // global proc setHyperGraphOpenMode(string $parent, string $type) { setParent $parent; if (`radioButtonGrp -query -select useFirstExistingOneRadio`) { optionVar -intValue ($type+"OpenHyperGraphMode") 0; } else { optionVar -intValue ($type+"OpenHyperGraphMode") 1; } } // Description: This procedure is called to reset the hyper graph // open mode to its default mode. // global proc resetHyperGraphOpenMode (string $parent, string $type) { string $oldParent = `setParent -query`; setParent $parent; initializeOpenHyperGraphMode($type); int $mode = `optionVar -query ($type+"OpenHyperGraphMode")`; if ($mode == 0) { radioButtonGrp -edit -select 1 useFirstExistingOneRadio; } else if ($mode = 1) { radioButtonGrp -edit -select 1 createNewHyperGraphRadio; } setParent $oldParent; } // Description: This procedure lets the user select what they want // the "Hyper graph ..." menuItem's default behavior to be. // // Mode 0: default mode, use the first existing hyper graph // panel of the given type. // Mode 1: create a new hyper graph panel of the given type. // global proc hyperGraphOptions(string $type) { string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; string $parent = `columnLayout -adjustableColumn 1`; radioButtonGrp -numberOfRadioButtons 1 -label (uiRes("m_hyperGraphOptions.kHyperGraphOption")) -label1 (uiRes("m_hyperGraphOptions.kCreateNew")) -changeCommand ("setHyperGraphOpenMode "+$parent+" "+$type) createNewHyperGraphRadio; radioButtonGrp -numberOfRadioButtons 1 -label1 (uiRes("m_hyperGraphOptions.kFirstExistingOne")) -shareCollection createNewHyperGraphRadio -changeCommand ("setHyperGraphOpenMode "+$parent+" "+$type) useFirstExistingOneRadio; // Set the radio button when open the option box. // int $mode = 0; if (!`optionVar -exists ($type+"OpenHyperGraphMode")`) { initializeOpenHyperGraphMode($type); } $mode = `optionVar -query ($type+"OpenHyperGraphMode")`; switch ($mode) { case 1: radioButtonGrp -edit -select 1 createNewHyperGraphRadio; break; default: radioButtonGrp -edit -select 1 useFirstExistingOneRadio; break; } setUITemplate -popTemplate; // Specify the standard buttons in the option box. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -command("setHyperGraphOpenMode "+$parent+" "+$type+"; hyperGraphWindow \"\" "+$type) $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command("setHyperGraphOpenMode "+$parent+" "+$type) $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ("resetHyperGraphOpenMode "+$parent+" "+$type) $resetBtn; string $title = (uiRes("m_hyperGraphOptions.kOptions")); setOptionBoxTitle `format -s $type $title`; setOptionBoxHelpTag("HyperGraphOptions"); showOptionBox(); }