// =========================================================================== // 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. // =========================================================================== // // Creation Date: Nov 9, 2002 // // Procedure Name: // performPolyMirrorCut // // Input Arguments: // $forceFactorySettings : Whether to set the options to default values. // Return Value: // None // proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists "polyMirrorCutAxis"`) optionVar -intValue "polyMirrorCutAxis" 1; if ($forceFactorySettings || !`optionVar -exists "polyMirrorCutCombine"`) optionVar -intValue "polyMirrorCutCombine" 1; if ($forceFactorySettings || !`optionVar -exists "polyMirrorCutMergeVertexTolerance"`) optionVar -floatValue "polyMirrorCutMergeVertexTolerance" 0.001; } global proc polyMirrorCutSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; radioButtonGrp -edit -select `optionVar -query polyMirrorCutAxis` polyMirrorCutAxis; checkBoxGrp -edit -value1 `optionVar -query polyMirrorCutCombine` polyMirrorCutCombine; floatSliderGrp -edit -value `optionVar -query polyMirrorCutMergeVertexTolerance` polyMirrorCutMergeVertexTolerance; } global proc polyMirrorCutCallback (string $parent, int $doIt) { setParent $parent; optionVar -intValue "polyMirrorCutAxis" `radioButtonGrp -query -select polyMirrorCutAxis`; optionVar -intValue "polyMirrorCutCombine" `checkBoxGrp -query -value1 polyMirrorCutCombine`; optionVar -floatValue "polyMirrorCutMergeVertexTolerance" `floatSliderGrp -query -value polyMirrorCutMergeVertexTolerance`; if ($doIt) { performPolyMirrorCut 0; string $tmpCmd = "performPolyMirrorCut 0 "; addToRecentCommandQueue $tmpCmd (uiRes("m_performPolyMirrorCut.kRecentCommandMirrorCut")); } } proc polyMirrorCutOptions () { // Global template variables for form spacing global int $gOptionBoxTemplateFrameSpacing; string $commandName = "polyMirrorCut"; 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 option box UI template. // ========================================== // setUITemplate -pushTemplate OptionBoxTemplate; // STEP 4: Create option box contents. // =================================== // waitCursor -state 1; // Form layout string $parent = `formLayout polyMirrorCutOptions`; // Settings frame string $settingsFrame = `frameLayout -label (uiRes("m_performPolyMirrorCut.kSettingsFrame"))`; columnLayout; radioButtonGrp -numberOfRadioButtons 3 -label (uiRes("m_performPolyMirrorCut.kCutAlong")) -labelArray3 (uiRes("m_performPolyMirrorCut.kYZPlane")) (uiRes("m_performPolyMirrorCut.kXZPlane")) (uiRes("m_performPolyMirrorCut.kXYPlane")) -select 3 -vertical polyMirrorCutAxis; checkBoxGrp -label1 (uiRes("m_performPolyMirrorCut.kCombineMeshes")) -value1 `optionVar -query polyMirrorCutCombine` -onCommand "floatSliderGrp -e -enable true polyMirrorCutMergeVertexTolerance" -offCommand "floatSliderGrp -e -enable false polyMirrorCutMergeVertexTolerance" polyMirrorCutCombine; floatSliderGrp -field true -minValue 0.0 -maxValue 10.0 -value `optionVar -query polyMirrorCutMergeVertexTolerance` -fieldMinValue 0.0 -fieldMaxValue 100.0 -label (uiRes("m_performPolyMirrorCut.kMergeVertexTol")) -enable `optionVar -query polyMirrorCutCombine` polyMirrorCutMergeVertexTolerance; setParent ..; // columnLayout setParent $parent; // frameLayout setParent ..; // formLayout // Attach Description/Settings frames to form layout formLayout -e -af $settingsFrame "top" $gOptionBoxTemplateFrameSpacing -af $settingsFrame "left" $gOptionBoxTemplateFrameSpacing -af $settingsFrame "right" $gOptionBoxTemplateFrameSpacing -an $settingsFrame "bottom" $parent; 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_performPolyMirrorCut.kApplyButton")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $applyAndCloseBtn = getOptionBoxApplyAndCloseBtn(); button -edit -label (uiRes("m_performPolyMirrorCut.kMirrorCutButton")) $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_performPolyMirrorCut.kMirrorCutOptions")) ); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag("MirrorCut"); // Step 9: Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0)); // Step 10: Show the option box. // ============================= // showOptionBox(); } proc string assembleCmd() { setOptionVars (false); int $doHistory = `constructionHistory -q -toggle`; string $cmd = "polyMirrorCut "; $cmd += `optionVar -query "polyMirrorCutAxis"`; $cmd += " "; $cmd += `optionVar -query "polyMirrorCutCombine"`; $cmd += " "; $cmd += `optionVar -query "polyMirrorCutMergeVertexTolerance"`; return $cmd; } global proc string performPolyMirrorCut (int $option) { string $cmd=""; switch ($option) { case 0: $cmd = `assembleCmd`; eval($cmd); break; case 1: polyMirrorCutOptions; break; case 2: $cmd = `assembleCmd`; break; } return $cmd; }