// =========================================================================== // 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 script performs the PolyEditEdgeFlow command. // proc setOptionVars(int $forceFactorySettings) { // -adjustEdgeFlow if ($forceFactorySettings || !`optionVar -exists polyEditEdgeFlowAdjustEdgeFlow`) { optionVar -floatValue polyEditEdgeFlowAdjustEdgeFlow 1.0; } } global proc performPolyEditEdgeFlowSetup(string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; // Query the optionVar and set the values into the controls // floatSliderGrp -e -value `optionVar -q polyEditEdgeFlowAdjustEdgeFlow` adjustEdgeFlow; } global proc performPolyEditEdgeFlowCallback(string $parent, int $doIt) { setParent $parent; // Set the optionVar from the control value, and then perform the command // optionVar -floatValue polyEditEdgeFlowAdjustEdgeFlow `floatSliderGrp -q -value adjustEdgeFlow`; if ($doIt) { performPolyEditEdgeFlow 0; addToRecentCommandQueue "performPolyEditEdgeFlow 0" "PolyEditEdgeFlow"; } } proc performPolyEditEdgeFlowOptions() { string $commandName = "performPolyEditEdgeFlow"; // Build the option box actions. // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // STEP 1: Get the option box. // ============================ // // The value returned is the name of the layout to be used as // the parent for the option box UI. // string $layout = getOptionBox(); setParent $layout; // STEP 2: Pass the command name to the option box. // ================================================= // // Any default option box behaviour based on the command name is set // up with this call. For example, updating the 'Help' menu item with // the name of the command. // setOptionBoxCommandName($commandName); // STEP 3: Create option box contents. // ==================================== // // Activate the default UI template so that the layout of this // option box is consistent with the layout of the rest of the // application. // setUITemplate -pushTemplate DefaultTemplate; // Turn on the wait cursor. // waitCursor -state 1; // Create option box or file options contents. // string $parent = `scrollLayout -childResizable 1`; columnLayout -adjustableColumn true; // Settings tab frameLayout -label (uiRes("m_performPolyEditEdgeFlow.kSettingsFrame")) -collapse 0; columnLayout; floatSliderGrp -field true -label (uiRes("m_performPolyEditEdgeFlow.kAdjustEdgeFlow")) -min 0.0 -max 1.0 -fieldMinValue -1000000 -fieldMaxValue 1000000 adjustEdgeFlow; setParent ..; setParent ..; setParent ..; setParent ..; // Turn off the wait cursor. // waitCursor -state 0; // Deactivate the default UI template // setUITemplate -popTemplate; // STEP 4: Customize the buttons. // =============================== // // Provide more descriptive labels for the buttons. // Disable those buttons that are not applicable to the option box. // Attach actions to those buttons that are applicable to the option box. // 'Edit' button // string $applyBtn = getOptionBoxApplyBtn(); button -e -label (uiRes("m_performPolyEditEdgeFlow.kEdit")) -command ($callback + " " + $parent + " 1") $applyBtn; // 'Apply' button // string $saveBtn = getOptionBoxSaveBtn(); button -e -command ($callback + " " + $parent + " 0; hideOptionBox") $saveBtn; // 'Reset' button // string $resetBtn = getOptionBoxResetBtn(); button -e -command ($setup + " " + $parent + " 1") $resetBtn; // STEP 5: Set the option box title. // ================================== // setOptionBoxTitle((uiRes("m_performPolyEditEdgeFlow.kEditEdgeFlowOptions"))); // STEP 6: Customize the 'Help' menu item text. // ============================================= // setOptionBoxHelpTag("Edit_Edge_Flow"); // Set the current values of the option box. // ========================================= // eval ($setup + " " + $parent + " 0"); // Show the option box. // ==================== // showOptionBox(); } proc string assembleCmd() { string $cmd = "polyEditEdgeFlow"; setOptionVars(0); // history flag int $doHistory = `constructionHistory -q -toggle`; $cmd = ($cmd + " -constructionHistory " + $doHistory); // adjustEdgeFlow flag $cmd = ($cmd + " -adjustEdgeFlow " + `optionVar -q polyEditEdgeFlowAdjustEdgeFlow`); return $cmd; } global proc string performPolyEditEdgeFlow(int $option) { string $cmd; switch ($option) { // Execute the command. // case 0: // Get the command. // $cmd = assembleCmd(); // Execute the command with option settings. // evalEcho($cmd); // make sure node is selected when there is history if ( 0 != size(`ls -sl`) || (0 != size(`ls -hl`)) ) { string $tmp[] = `listHistory`; string $totalSel[]; for ($opNode in $tmp) { if (`nodeType $opNode` == "polyEditEdgeFlow") { $totalSel[size($totalSel)] = $opNode; } } if (size($totalSel) > 0) select -add $totalSel[0]; } setToolTo ShowManips; break; // Show the option box. // case 1: performPolyEditEdgeFlowOptions(); break; // Return the command string. // case 2: // Get the command. // $cmd = assembleCmd(); break; } return $cmd; }