// =========================================================================== // 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: 2003 // // Description: // Option box for makeCurvesDynamic menu. // // Procedure Name: // setOptionVars // // Description: // Initialize the option values. // // Input Arguments: // Whether to set the options to default values. // // proc setOptionVars(int $forceFactorySettings) { if($forceFactorySettings || !`optionVar -exists makeCurvesDynamicAttachToSurface`) { optionVar -intValue makeCurvesDynamicAttachToSurface 1; } if($forceFactorySettings || !`optionVar -exists makeCurvesDynamicSurfaceSnap`) { optionVar -intValue makeCurvesDynamicSurfaceSnap 0; } if($forceFactorySettings || !`optionVar -exists makeCurvesDynamicExactMatch`) { optionVar -intValue makeCurvesDynamicExactMatch 1; } if($forceFactorySettings || !`optionVar -exists makeCurvesDynamicOutput`) { optionVar -intValue makeCurvesDynamicOutput 2; } if($forceFactorySettings || !`optionVar -exists makeCurvesDynamicCollideWithMesh`) { optionVar -intValue makeCurvesDynamicCollideWithMesh 0; } } // // Procedure Name: // performMakeCurvesDynamicSetup // // Description: // Update the state of the option box UI to reflect the option values. // // Input Arguments: // parent - Top level parent layout of the option box UI. // Required so that UI object names can be // successfully resolved. // // forceFactorySettings - Whether the option values should be set to // default values. // // Return Value: // None. // global proc performMakeCurvesDynamicSetup(string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars($forceFactorySettings); setParent $parent; checkBoxGrp -edit -value1 `optionVar -q makeCurvesDynamicAttachToSurface` makeCurvesDynamicAttachToSurface; checkBoxGrp -edit -value1 `optionVar -q makeCurvesDynamicSurfaceSnap` makeCurvesDynamicSurfaceSnap; checkBoxGrp -edit -value1 `optionVar -q makeCurvesDynamicExactMatch` makeCurvesDynamicExactMatch; optionMenuGrp -edit -sl `optionVar -query makeCurvesDynamicOutput` makeCurvesDynamicOutput; checkBoxGrp -edit -value1 `optionVar -q makeCurvesDynamicCollideWithMesh` makeCurvesDynamicCollideWithMesh; } // // Procedure Name: // performMakeCurvesDynamicCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc performMakeCurvesDynamicCallback(string $parent, int $doIt) { setParent $parent; optionVar -intValue makeCurvesDynamicAttachToSurface `checkBoxGrp -query -value1 makeCurvesDynamicAttachToSurface`; optionVar -intValue makeCurvesDynamicSurfaceSnap `checkBoxGrp -query -value1 makeCurvesDynamicSurfaceSnap`; optionVar -intValue makeCurvesDynamicExactMatch `checkBoxGrp -query -value1 makeCurvesDynamicExactMatch`; optionVar -intValue makeCurvesDynamicOutput `optionMenuGrp -query -sl makeCurvesDynamicOutput`; optionVar -intValue makeCurvesDynamicCollideWithMesh `checkBoxGrp -query -value1 makeCurvesDynamicCollideWithMesh`; if( $doIt ) { performMakeCurvesDynamic 0; } } global proc attachToSurfaceDimControl() { int $enabled = `checkBoxGrp -query -value1 makeCurvesDynamicAttachToSurface`; checkBoxGrp -edit -enable $enabled makeCurvesDynamicSurfaceSnap; checkBoxGrp -edit -enable $enabled makeCurvesDynamicCollideWithMesh; } // // Procedure Name: // makeCurvesDynamicOptions // // Description: // Construct the option box UI. Involves accessing the standard option // box and customizing the UI accordingly. // // Input Arguments: // None. // // Return Value: // None. // global proc makeCurvesDynamicOptions() { // Name of the command for this option box. // string $commandName = "performMakeCurvesDynamic"; // Build the option box actions. // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; tabLayout -tv false -scr true; string $parent = `columnLayout -adjustableColumn 1`; optionMenuGrp -label (uiRes("m_performMakeCurvesDynamic.kOutput")) -cw 2 243 makeCurvesDynamicOutput; menuItem -label (uiRes("m_performMakeCurvesDynamic.kPaintEffects")); menuItem -label (uiRes("m_performMakeCurvesDynamic.kNURBSCurves")); menuItem -label (uiRes("m_performMakeCurvesDynamic.kPaintAndNURBS")); checkBoxGrp -ncb 1 -cw 1 50 -label1 (uiRes("m_performMakeCurvesDynamic.kAttachCurvesToSelectedSurface")) -cc attachToSurfaceDimControl makeCurvesDynamicAttachToSurface; checkBoxGrp -ncb 1 -cw 1 50 -label1 (uiRes("m_performMakeCurvesDynamic.kSnapCurveBaseToSurface")) makeCurvesDynamicSurfaceSnap; checkBoxGrp -ncb 1 -cw 1 50 -label1 (uiRes("m_performMakeCurvesDynamic.kCollideWithMesh")) makeCurvesDynamicCollideWithMesh; checkBoxGrp -ncb 1 -cw 1 50 -label1 (uiRes("m_performMakeCurvesDynamic.kExactShapeMatch")) makeCurvesDynamicExactMatch; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performMakeCurvesDynamic.kMakeCurvesDynamic")) -command ($callback + " " + $parent + " " + 1) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Set the option box title. // setOptionBoxTitle (uiRes("m_performMakeCurvesDynamic.kMakeCurvesDynamicOptions")); setOptionBoxCommandName($commandName); setOptionBoxHelpTag( "MakeCurvesDynamic" ); // Pop the UI template // setUITemplate -popTemplate; // Set the current values of the option box. // eval( $setup + " " + $parent + " " + 0 ); attachToSurfaceDimControl(); // Show the option box. // showOptionBox(); } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { setOptionVars(false); string $cmd; int $outputMode = `optionVar -query makeCurvesDynamicOutput`; int $pfxOut = $outputMode != 2; int $curveOut = $outputMode != 1; $cmd = ("doMakeCurvesNDynamic 2 { " + "\"" + `optionVar -query makeCurvesDynamicAttachToSurface` + "\", " + "\"" + `optionVar -query makeCurvesDynamicSurfaceSnap` + "\", " + "\"" + `optionVar -query makeCurvesDynamicExactMatch` + "\", " + "\"" + $curveOut + "\", " + "\"" + $pfxOut + "\" " +" } " ); return $cmd; } // // Procedure Name: // performMakeCurvesDynamic // // Description: // Perform the command using the corresponding // option values. This procedure will also show the option box // window if necessary as well as construct the command string // that will invoke the command with the current // option box values. // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performMakeCurvesDynamic(int $action) { string $cmd = ""; switch ($action) { // Execute the command from option settings. // case 0: setOptionVars(false); $cmd = `assembleCmd`; eval($cmd); break; // Show the option box. // case 1: makeCurvesDynamicOptions(); break; // Return the command string. // case 2: setOptionVars (false); $cmd = `assembleCmd`; break; } return $cmd; }