// =========================================================================== // 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. // =========================================================================== ////////////////////////////////////////////////////////////////////// // Initialize the option values. global proc tensionDeform_intializeOptionVars( int $forceFactorySettings ) { // Smoothing iterations // if ($forceFactorySettings || !`optionVar -exists tensionSmoothingIterations`) { optionVar -intValue tensionSmoothingIterations 10; } // Smoothing step // if ($forceFactorySettings || !`optionVar -exists tensionSmoothingStep`) { optionVar -floatValue tensionSmoothingStep 1.0; } // Pin border vertices // if ($forceFactorySettings || !`optionVar -exists tensionPinBorderVertices`) { optionVar -intValue tensionPinBorderVertices 1; } // Envelope // if ($forceFactorySettings || !`optionVar -exists tensionEnvelope`) { optionVar -floatValue tensionEnvelope 1.0; } } ////////////////////////////////////////////////////////////////////// // Create the controls global proc tensionDeform_createControls() { // Smoothing iterations // intSliderGrp -label (uiRes("m_performTension.kSmoothingIterations")) -fieldMinValue 0 -minValue 0 -maxValue 100 tensionSmoothingIterations; // Smoothing step // floatSliderGrp -label (uiRes("m_performTension.kSmoothingStep")) -minValue 0.0 -maxValue 1.0 -fieldMinValue 0.0 -fieldMaxValue 1.0 tensionSmoothingStep; // Pin border vertices // checkBoxGrp -label (uiRes("m_performTension.kPinBorderVertices")) -label1 "" -annotation (uiRes("m_performTension.kPinBorderVerticesAnnot")) -numberOfCheckBoxes 1 tensionPinBorderVertices; // Envelope // floatSliderGrp -label (uiRes("m_performTension.kEnvelope")) -minValue 0.0 -maxValue 1.0 -fieldMinValue 0.0 -fieldMaxValue 1.0 tensionEnvelope; } ////////////////////////////////////////////////////////////////////// // Query the optionVars and set the values into the controls global proc tensionDeform_updateControls() { baseDeform_setControl("intSlider", "tensionSmoothingIterations"); baseDeform_setControl("floatSlider", "tensionSmoothingStep"); baseDeform_setControl("checkBox", "tensionPinBorderVertices"); baseDeform_setControl("floatSlider", "tensionEnvelope"); } ////////////////////////////////////////////////////////////////////// // Query the controls and set the values into the optionVars global proc tensionDeform_updateOptionVars() { baseDeform_setOptionVar("intSlider", "tensionSmoothingIterations"); baseDeform_setOptionVar("floatSlider", "tensionSmoothingStep"); baseDeform_setOptionVar("checkBox", "tensionPinBorderVertices"); baseDeform_setOptionVar("floatSlider", "tensionEnvelope"); } ////////////////////////////////////////////////////////////////////// // Return the name of the command global proc string tensionDeform_commandName() { return "tension"; } ////////////////////////////////////////////////////////////////////// // Add the options to the main command global proc string tensionDeform_assembleCmdOptions() { string $opt = ""; $opt += " -smoothingIterations " + `optionVar -query tensionSmoothingIterations`; $opt += " -smoothingStep " + `optionVar -query tensionSmoothingStep`; $opt += " -pinBorderVertices " + `optionVar -query tensionPinBorderVertices`; $opt += " -envelope " + `optionVar -query tensionEnvelope`; return $opt; } ////////////////////////////////////////////////////////////////////// // Return the prefix used by the option vars global proc string tensionDeform_optionVarPrefix() { return "tension"; } ////////////////////////////////////////////////////////////////////// // Return the title for the option box global proc string tensionDeform_optionBoxTitle() { return (uiRes("m_performTension.kCreateTensionDeformerOptions")); } ////////////////////////////////////////////////////////////////////// // Return the help tag for the command global proc string tensionDeform_helpTag() { return "Tension"; } ////////////////////////////////////////////////////////////////////// // Execute the command global proc tensionDeform_doIt() { performTension 0; addToRecentCommandQueue "performTension 0" "Tension"; } ////////////////////////////////////////////////////////////////////// // Description: // Return a short description about this command. // // Input Arguments: // None. // // Return Value: // string. // proc string tensionHelp() { return " Command: tension - creates a tension deformer\n" + "Selection: Deformable geometry."; } // // Procedure Name: // performTension // // Description: // Perform the tension 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 tension command with the current // option box values. // // Input Arguments: // $cmdPfx : the prefix for the above commands to be called. // $action: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // The command string. // global proc string performTension(int $action) { return performBaseDeform("tensionDeform", $action); }