// =========================================================================== // 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: Mar 20, 1997 // // Description: // This script defines option box for the pointCurveConstraint menu item. // // Input Arguments: // int action // 0 - just execute the command. // 1 - show option box dialog. // 2 - return the drag command. // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { pointCurveConstraintSetOptionVars( $forceFactorySettings ); } proc createPointCurveConstraintUI( string $parent ) { setParent $parent ; columnLayout pointCurveConstraintOptionsColumnLayout; // // cos for the first or both surfaces ? // checkBoxGrp -ncb 1 -label "" -label1 (uiRes("m_performPointCurveConstraint.kKeepOriginal")) constraintKeepOriginalBoxGrp ; floatSliderGrp -field true -min 0.1 -max 10.0 -label (uiRes("m_performPointCurveConstraint.kPointWeight")) constraintWtSlider; setParent .. ; } proc string assembleCmd() { string $cmd ; setOptionVars(false) ; // query the settings for cmd(s). // int $doHistory = `constructionHistory -q -tgl`; int $keepOriginal = `optionVar -q pointCurveConstraintKeepOriginal` ; float $wt = `optionVar -q pointCurveConstraintWt` ; $cmd = "pointCurveConstraintPreset" ; $cmd = $cmd + "( " + $doHistory + " ," + $keepOriginal + " , " + $wt + ")"; return $cmd ; } proc pointCurveConstraintOptions() { string $commandName = "pointCurveConstraint" ; string $optionBoxTitle = (uiRes("m_performPointCurveConstraint.kPointonCurveOptions")) ; string $applyTitle = (uiRes("m_performPointCurveConstraint.kCreate")); // build option box methods. // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setOptionBoxCommandName($commandName); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -tabsVisible false -scr true; string $parent = `columnLayout -adjustableColumn 1`; createPointCurveConstraintUI($parent); waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label $applyTitle -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($optionBoxTitle); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "PointOnCurve" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc pointCurveConstraintSetup( string $parent, int $forceFactorySettings) { // retrieve option settings. // setOptionVars($forceFactorySettings); setParent $parent; // query all the option vars and set the controls. // int $keepOriginal = `optionVar -q pointCurveConstraintKeepOriginal` ; checkBoxGrp -edit -v1 $keepOriginal constraintKeepOriginalBoxGrp ; float $wt = `optionVar -q pointCurveConstraintWt` ; floatSliderGrp -edit -value $wt constraintWtSlider ; } global proc pointCurveConstraintCallback( string $parent, int $doIt ) { setParent $parent ; // get Values from controls. // int $keepOriginal = `checkBoxGrp -q -v1 constraintKeepOriginalBoxGrp`; float $wt = `floatSliderGrp -q -value constraintWtSlider` ; optionVar -floatValue pointCurveConstraintWt $wt ; optionVar -intValue pointCurveConstraintKeepOriginal $keepOriginal ; if ($doIt) { performPointCurveConstraint(0) ; addToRecentCommandQueue "performPointCurveConstraint 0" "PointCurve Constraint"; } } global proc string performPointCurveConstraint(int $action ) // // Description : // 0 - do the command. // 1 - show the option box. // 2 - return the drag command. // { string $cmd = "" ; switch( $action ) { case 0 : // do the cmd. // setOptionVars(false) ; $cmd = `assembleCmd` ; eval($cmd) ; break ; case 1 : // option Box. // pointCurveConstraintOptions ; break ; case 2 : // return the drag string with the set options // on to shelf // $cmd = `assembleCmd` ; break ; } return $cmd ; }