// =========================================================================== // 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: // performSelectNurbsBorder // // Description: // // // Input Arguments: // $option : Whether to set the options to default values. // Return Value: // command string iff $option==2 // proc setIntOptionVars ( string $prefix, int $forceFactorySettings ) { string $varName; string $toggles[] = {"rb", "lb", "tb", "bb"}; for ($i = size($toggles) ; $i-- ; ) { $varName = ($prefix + $toggles[$i]); if ($forceFactorySettings || !`optionVar -exists $varName`) optionVar -intValue $varName 1; } } global proc performSelectNurbsBorderSetup (string $parent, int $forceFactorySettings) { string $prefix = "nurbsSelect"; string $toggles[] = {"rb", "lb", "tb", "bb"}; string $varName; setIntOptionVars($prefix, $forceFactorySettings); setParent $parent; for ($i = size($toggles) ; $i-- ; ) { $varName = ($prefix + $toggles[$i]); checkBoxGrp -e -v1 `optionVar -q $varName` $varName; } } global proc performSelectNurbsBorderCallback (string $parent, int $doIt) { string $prefix = "nurbsSelect"; string $toggles[] = {"rb", "lb", "tb", "bb"}; string $varName; setParent $parent; for ($i = size($toggles) ; $i-- ; ) { $varName = ($prefix + $toggles[$i]); optionVar -intValue $varName `checkBoxGrp -q -v1 $varName`; } if ($doIt) { performSelectNurbsBorder 0; addToRecentCommandQueue "performSelectNurbsBorder 0" "Select Surface Border"; } } proc selectNurbsBorderOptions (string $prefix) { string $commandName = "performSelectNurbsBorder"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $toggles[] = {"rb", "lb", "tb", "bb"}; string $names[]; $names[size($names)] = (uiRes("m_performSelectNurbsBorder.kSelectLastV")); $names[size($names)] = (uiRes("m_performSelectNurbsBorder.kSelectFirstV")); $names[size($names)] = (uiRes("m_performSelectNurbsBorder.kSelectLastU")); $names[size($names)] = (uiRes("m_performSelectNurbsBorder.kSelectFirstU")); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; string $parent = `columnLayout -adjustableColumn 1`; string $varName; for ($i = size($toggles) ; $i-- ; ) { $varName = ($prefix + $toggles[$i]); checkBoxGrp -label1 $names[$i] $varName; } waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performSelectNurbsBorder.kSelect")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; setOptionBoxTitle (uiRes("m_performSelectNurbsBorder.kSelectSurfaceBorderOptions")); setOptionBoxHelpTag( "EditNURBSSelectSurfaceBorder" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc string performSelectNurbsBorder (int $option) { string $prefix = "nurbsSelect"; string $toggles[] = {"rb", "lb", "tb", "bb"}; string $cmd=""; switch ($option) { case 0: string $varName; setIntOptionVars($prefix, false); $cmd = $prefix; for ($i = size($toggles) ; $i-- ; ) { $varName = ($prefix + $toggles[$i]); if (`optionVar -query $varName`) $cmd = $cmd + " -" + $toggles[$i]; } eval($cmd); break; case 1: selectNurbsBorderOptions($prefix); break; case 2: $cmd="performSelectNurbsBorder 0"; break; } return $cmd; }