// =========================================================================== // 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 deltaMushDeform_intializeOptionVars( int $forceFactorySettings ) { // Smoothing iterations // if ($forceFactorySettings || !`optionVar -exists deltaMushSmoothingIterations`) { optionVar -intValue deltaMushSmoothingIterations 10; } // Smoothing step // if ($forceFactorySettings || !`optionVar -exists deltaMushSmoothingStep`) { optionVar -floatValue deltaMushSmoothingStep 0.5; } // Pin border vertices // if ($forceFactorySettings || !`optionVar -exists deltaMushPinBorderVertices`) { optionVar -intValue deltaMushPinBorderVertices 1; } // Envelope // if ($forceFactorySettings || !`optionVar -exists deltaMushEnvelope`) { optionVar -floatValue deltaMushEnvelope 1.0; } } ////////////////////////////////////////////////////////////////////// // Create the controls global proc deltaMushDeform_createControls() { // Smoothing iterations // intSliderGrp -label (uiRes("m_performDeltaMush.kSmoothingIterations")) -fieldMinValue 0 -minValue 0 -maxValue 100 deltaMushSmoothingIterations; // Smoothing step // floatSliderGrp -label (uiRes("m_performDeltaMush.kSmoothingStep")) -minValue 0.0 -maxValue 1.0 -fieldMinValue 0.0 -fieldMaxValue 1.0 deltaMushSmoothingStep; // Pin border vertices // checkBoxGrp -label (uiRes("m_performDeltaMush.kPinBorderVertices")) -label1 "" -annotation (uiRes("m_performDeltaMush.kPinBorderVerticesAnnot")) -numberOfCheckBoxes 1 deltaMushPinBorderVertices; // Envelope // floatSliderGrp -label (uiRes("m_performDeltaMush.kEnvelope")) -minValue 0.0 -maxValue 1.0 -fieldMinValue 0.0 -fieldMaxValue 1.0 deltaMushEnvelope; } ////////////////////////////////////////////////////////////////////// // Query the optionVars and set the values into the controls global proc deltaMushDeform_updateControls() { baseDeform_setControl("intSlider", "deltaMushSmoothingIterations"); baseDeform_setControl("floatSlider", "deltaMushSmoothingStep"); baseDeform_setControl("checkBox", "deltaMushPinBorderVertices"); baseDeform_setControl("floatSlider", "deltaMushEnvelope"); } ////////////////////////////////////////////////////////////////////// // Query the controls and set the values into the optionVars global proc deltaMushDeform_updateOptionVars() { baseDeform_setOptionVar("intSlider", "deltaMushSmoothingIterations"); baseDeform_setOptionVar("floatSlider", "deltaMushSmoothingStep"); baseDeform_setOptionVar("checkBox", "deltaMushPinBorderVertices"); baseDeform_setOptionVar("floatSlider", "deltaMushEnvelope"); } ////////////////////////////////////////////////////////////////////// // Return the name of the command global proc string deltaMushDeform_commandName() { return "deltaMush"; } ////////////////////////////////////////////////////////////////////// // Add the options to the main command global proc string deltaMushDeform_assembleCmdOptions() { string $opt = ""; $opt += " -smoothingIterations " + `optionVar -query deltaMushSmoothingIterations`; $opt += " -smoothingStep " + `optionVar -query deltaMushSmoothingStep`; $opt += " -pinBorderVertices " + `optionVar -query deltaMushPinBorderVertices`; $opt += " -envelope " + `optionVar -query deltaMushEnvelope`; return $opt; } ////////////////////////////////////////////////////////////////////// // Return the prefix used by the option vars global proc string deltaMushDeform_optionVarPrefix() { return "deltaMush"; } ////////////////////////////////////////////////////////////////////// // Return the title for the option box global proc string deltaMushDeform_optionBoxTitle() { return (uiRes("m_performDeltaMush.kCreateDeltaMushDeformerOptions")); } ////////////////////////////////////////////////////////////////////// // Return the help tag for the command global proc string deltaMushDeform_helpTag() { return "DeltaMush"; } ////////////////////////////////////////////////////////////////////// // Execute the command global proc deltaMushDeform_doIt() { performDeltaMush 0; addToRecentCommandQueue "performDeltaMush 0" "DeltaMush"; } ////////////////////////////////////////////////////////////////////// // Description: // Return a short description about this command. // // Input Arguments: // None. // // Return Value: // string. // proc string deltaMushHelp() { return " Command: deltaMush - creates a deltaMush deformer\n" + "Selection: Deformable geometry."; } // // Procedure Name: // performDeltaMush // // Description: // Perform the deltaMush 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 deltaMush 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 performDeltaMush(int $action) { return performBaseDeform("deltaMushDeform", $action); }