// =========================================================================== // 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: // performSelContiguousEdges // // 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; $varName = ($prefix + "m2a"); if ($forceFactorySettings || !`optionVar -exists $varName`) optionVar -floatValue $varName 30; $varName = ($prefix + "m3a"); if ($forceFactorySettings || !`optionVar -exists $varName`) optionVar -floatValue $varName 90; $varName = ($prefix + "ec"); if ($forceFactorySettings || !`optionVar -exists $varName`) optionVar -intValue $varName 0; $varName = ($prefix + "ed"); if ($forceFactorySettings || !`optionVar -exists $varName`) optionVar -intValue $varName 10; } global proc performSelContiguousEdgesSetup (string $parent, int $forceFactorySettings) { string $prefix = "selContiguousEdges"; string $varName; setIntOptionVars($prefix, $forceFactorySettings); setParent $parent; $varName = ($prefix + "m2a"); floatSliderGrp -e -v `optionVar -q $varName` $varName; $varName = ($prefix + "m3a"); floatSliderGrp -e -v `optionVar -q $varName` $varName; $varName = ($prefix + "ec"); checkBoxGrp -e -v1 `optionVar -q $varName` $varName; $varName = ($prefix + "ed"); intSliderGrp -e -v `optionVar -q $varName` -en `checkBoxGrp -q -v1 ($prefix + "ec")` $varName; } global proc performSelContiguousEdgesCallback (string $parent, int $doIt) { string $prefix = "selContiguousEdges"; string $varName; setParent $parent; $varName = ($prefix + "m2a"); optionVar -floatValue $varName `floatSliderGrp -q -v $varName`; $varName = ($prefix + "m3a"); optionVar -floatValue $varName `floatSliderGrp -q -v $varName`; $varName = ($prefix + "ec"); optionVar -intValue $varName `checkBoxGrp -q -v1 $varName`; $varName = ($prefix + "ed"); optionVar -intValue $varName `intSliderGrp -q -v $varName`; if ($doIt) { performSelContiguousEdges 0; addToRecentCommandQueue "performSelContiguousEdges 0" "SelContiguousEdges"; } } proc selContiguousEdgesOptions (string $prefix) { // Global template variables for form spacing global int $gOptionBoxTemplateFrameSpacing; string $commandName = "performSelContiguousEdges"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate OptionBoxTemplate; waitCursor -state 1; // Form layout string $parent = `formLayout polySelContiguousEdgesOptions`; // Stopping conditions frame string $stoppingConditionsFrame = `frameLayout -label (uiRes("m_performSelContiguousEdges.kStoppingConditionsFrame"))`; string $varName; columnLayout; $varName = ($prefix + "m2a"); floatSliderGrp -l (uiRes("m_performSelContiguousEdges.kMax2D")) -min 0 -max 180 $varName; $varName = ($prefix + "m3a"); floatSliderGrp -l (uiRes("m_performSelContiguousEdges.kMax3D")) -min 0 -max 180 $varName; $varName = ($prefix + "ec"); string $grayCmd = "intSliderGrp -e -en `checkBoxGrp -q -v1 " + $varName + "` " + $prefix + "ed"; checkBoxGrp -l1 (uiRes("m_performSelContiguousEdges.kLimitNumberEdgesSelected")) -cc $grayCmd $varName; $varName = ($prefix + "ed"); intSliderGrp -l (uiRes("m_performSelContiguousEdges.kEdgesEitherSide")) -min 1 -max 50 -fmx 100000 $varName; setParent ..; // columnLayout setParent $parent; // frameLayout setParent ..; // formLayout // Attach frame to form layout formLayout -e -af $stoppingConditionsFrame "top" $gOptionBoxTemplateFrameSpacing -af $stoppingConditionsFrame "left" $gOptionBoxTemplateFrameSpacing -af $stoppingConditionsFrame "right" $gOptionBoxTemplateFrameSpacing -an $stoppingConditionsFrame "bottom" $parent; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performSelContiguousEdges.kSelectButton")) -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_performSelContiguousEdges.kSelectContiguousEdgesOptions")) ); setOptionBoxHelpTag( "SelectContiguousEdges" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc string performSelContiguousEdges (int $option) { string $prefix = "selContiguousEdges"; string $cmd=""; switch ($option) { case 0: string $varName; setIntOptionVars($prefix, false); // propagate on edge [0x8000] type $cmd = "polySelectConstraint -type 0x8000 -propagate 4 "; $varName = ($prefix + "m2a"); $cmd = $cmd + " -m2a " + `optionVar -query $varName`; $varName = ($prefix + "m3a"); $cmd = $cmd + " -m3a " + `optionVar -query $varName`; $varName = ($prefix + "ec"); if (`optionVar -query $varName`) { $varName = ($prefix + "ed"); $cmd = $cmd + " -ed " + `optionVar -query $varName`; } eval($cmd); break; case 1: selContiguousEdgesOptions($prefix); break; case 2: $cmd="performSelContiguousEdges 0"; break; } return $cmd; }