// =========================================================================== // 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: 20 March 2017 // // Description: // This script defines the option box for the Polygon super shape menu item. // // // Procedure Name: // setOptionVars // // Description: // Initialize the option values. // // Input Arguments: // forceFactorySettings Whether to set the options to default values // // Return Value: // None. // proc setOptionVars(int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists polySuperShapeRadius`) { optionVar -floatValue polySuperShapeRadius 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeShape`) { optionVar -intValue polySuperShapeShape 1; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeHDiv`) { optionVar -intValue polySuperShapeHDiv 16; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeVDiv`) { optionVar -intValue polySuperShapeVDiv 16; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeUVMode`) { optionVar -intValue polySuperShapeUVMode 2; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeMergeVerts`) { optionVar -intValue polySuperShapeMergeVerts 1; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeHRev`) { optionVar -floatValue polySuperShapeHRev 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeVRev`) { optionVar -floatValue polySuperShapeVRev 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeVertOff`) { optionVar -floatValue polySuperShapeVertOff 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeIntRad`) { optionVar -floatValue polySuperShapeIntRad 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeXOff`) { optionVar -floatValue polySuperShapeXOff 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeZOff`) { optionVar -floatValue polySuperShapeZOff 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeE0`) { optionVar -floatValue polySuperShapeE0 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeE1`) { optionVar -floatValue polySuperShapeE1 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeEMirror`) { optionVar -floatValue polySuperShapeEMirror 1; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH0`) { optionVar -floatValue polySuperShapeH0 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH1`) { optionVar -floatValue polySuperShapeH1 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH2`) { optionVar -floatValue polySuperShapeH2 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH3`) { optionVar -floatValue polySuperShapeH3 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH4`) { optionVar -floatValue polySuperShapeH4 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH5`) { optionVar -floatValue polySuperShapeH5 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH6`) { optionVar -floatValue polySuperShapeH6 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeH7`) { optionVar -floatValue polySuperShapeH7 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU0`) { optionVar -floatValue polySuperShapeU0 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU1`) { optionVar -floatValue polySuperShapeU1 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU2`) { optionVar -floatValue polySuperShapeU2 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU3`) { optionVar -floatValue polySuperShapeU3 0.5; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU4`) { optionVar -floatValue polySuperShapeU4 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU5`) { optionVar -floatValue polySuperShapeU5 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU6`) { optionVar -floatValue polySuperShapeU6 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU7`) { optionVar -floatValue polySuperShapeU7 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU8`) { optionVar -floatValue polySuperShapeU8 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU9`) { optionVar -floatValue polySuperShapeU9 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU10`) { optionVar -floatValue polySuperShapeU10 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU11`) { optionVar -floatValue polySuperShapeU11 0.5; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU12`) { optionVar -floatValue polySuperShapeU12 0.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU13`) { optionVar -floatValue polySuperShapeU13 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU14`) { optionVar -floatValue polySuperShapeU14 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeU15`) { optionVar -floatValue polySuperShapeU15 1.0; } if ($forceFactorySettings || !`optionVar -exists polySuperShapeUMirror`) { optionVar -floatValue polySuperShapeUMirror 0; } } // // Procedure Name: // polySuperShapeUpdateEnable // // Description: // Update the enable/disable 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 polySuperShapeUpdateEnable(string $parent) { setParent $parent; int $ev = `optionVar -q polySuperShapeShape` == 1; int $evv = $ev && `optionVar -q polySuperShapeEMirror` == 0; int $sv = `optionVar -q polySuperShapeShape` == 2; int $uv = `optionVar -q polySuperShapeShape` == 3; int $uvv = $uv && `optionVar -q polySuperShapeUMirror` == 0; int $merge = `optionVar -q polySuperShapeMergeVerts` == 0; floatSliderGrp -edit -en $ev polySuperShapeE0; floatSliderGrp -edit -en $evv polySuperShapeE1; checkBoxGrp -edit -en $ev polySuperShapeEMirror; floatSliderGrp -edit -en $sv polySuperShapeH0; floatSliderGrp -edit -en $sv polySuperShapeH1; floatSliderGrp -edit -en $sv polySuperShapeH2; floatSliderGrp -edit -en $sv polySuperShapeH3; floatSliderGrp -edit -en $sv polySuperShapeH4; floatSliderGrp -edit -en $sv polySuperShapeH5; floatSliderGrp -edit -en $sv polySuperShapeH6; floatSliderGrp -edit -en $sv polySuperShapeH7; floatSliderGrp -edit -en $uv polySuperShapeU0; floatSliderGrp -edit -en $uv polySuperShapeU1; floatSliderGrp -edit -en $uv polySuperShapeU2; floatSliderGrp -edit -en $uv polySuperShapeU3; floatSliderGrp -edit -en $uv polySuperShapeU4; floatSliderGrp -edit -en $uv polySuperShapeU5; floatSliderGrp -edit -en $uv polySuperShapeU6; floatSliderGrp -edit -en $uv polySuperShapeU7; floatSliderGrp -edit -en $uvv polySuperShapeU8; floatSliderGrp -edit -en $uvv polySuperShapeU9; floatSliderGrp -edit -en $uvv polySuperShapeU10; floatSliderGrp -edit -en $uvv polySuperShapeU11; floatSliderGrp -edit -en $uvv polySuperShapeU12; floatSliderGrp -edit -en $uvv polySuperShapeU13; floatSliderGrp -edit -en $uvv polySuperShapeU14; floatSliderGrp -edit -en $uvv polySuperShapeU15; checkBoxGrp -edit -en $uv polySuperShapeUMirror; floatSliderGrp -edit -en $merge polySuperShapeHRev; floatSliderGrp -edit -en $merge polySuperShapeVRev; floatSliderGrp -edit -en $merge polySuperShapeVOff; floatSliderGrp -edit -en $merge polySuperShapeIntRad; floatSliderGrp -edit -en $merge polySuperShapeXOff; floatSliderGrp -edit -en $merge polySuperShapeZOff; } // // Procedure Name: // polySuperShapeSetup // // 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 polySuperShapeSetup(string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars($forceFactorySettings); setParent $parent; polySuperShapeUpdateEnable($parent); // Query the optionVar's and set the values into the controls. optionMenuGrp -edit -select `optionVar -q polySuperShapeShape` polySuperShapeShape; floatSliderGrp -edit -value `optionVar -q polySuperShapeRadius` polySuperShapeRadius; intSliderGrp -edit -value `optionVar -q polySuperShapeHDiv` polySuperShapeHDiv; intSliderGrp -edit -value `optionVar -q polySuperShapeVDiv` polySuperShapeVDiv; optionMenuGrp -edit -select (`optionVar -q polySuperShapeUVMode`+1) polySuperShapeUVMode; checkBoxGrp -edit -value1 `optionVar -q polySuperShapeMergeVerts` polySuperShapeMergeVerts; floatSliderGrp -edit -value `optionVar -q polySuperShapeHRev` polySuperShapeHRev; floatSliderGrp -edit -value `optionVar -q polySuperShapeVRev` polySuperShapeVRev; floatSliderGrp -edit -value `optionVar -q polySuperShapeVertOff` polySuperShapeVOff; floatSliderGrp -edit -value `optionVar -q polySuperShapeIntRad` polySuperShapeIntRad; floatSliderGrp -edit -value `optionVar -q polySuperShapeXOff` polySuperShapeXOff; floatSliderGrp -edit -value `optionVar -q polySuperShapeZOff` polySuperShapeZOff; floatSliderGrp -edit -value `optionVar -q polySuperShapeE0` polySuperShapeE0; floatSliderGrp -edit -value `optionVar -q polySuperShapeE1` polySuperShapeE1; checkBoxGrp -edit -value1 `optionVar -q polySuperShapeEMirror` polySuperShapeEMirror; floatSliderGrp -edit -value `optionVar -q polySuperShapeH0` polySuperShapeH0; floatSliderGrp -edit -value `optionVar -q polySuperShapeH1` polySuperShapeH1; floatSliderGrp -edit -value `optionVar -q polySuperShapeH2` polySuperShapeH2; floatSliderGrp -edit -value `optionVar -q polySuperShapeH3` polySuperShapeH3; floatSliderGrp -edit -value `optionVar -q polySuperShapeH4` polySuperShapeH4; floatSliderGrp -edit -value `optionVar -q polySuperShapeH5` polySuperShapeH5; floatSliderGrp -edit -value `optionVar -q polySuperShapeH6` polySuperShapeH6; floatSliderGrp -edit -value `optionVar -q polySuperShapeH7` polySuperShapeH7; floatSliderGrp -edit -value `optionVar -q polySuperShapeU0` polySuperShapeU0; floatSliderGrp -edit -value `optionVar -q polySuperShapeU1` polySuperShapeU1; floatSliderGrp -edit -value `optionVar -q polySuperShapeU2` polySuperShapeU2; floatSliderGrp -edit -value `optionVar -q polySuperShapeU3` polySuperShapeU3; floatSliderGrp -edit -value `optionVar -q polySuperShapeU4` polySuperShapeU4; floatSliderGrp -edit -value `optionVar -q polySuperShapeU5` polySuperShapeU5; floatSliderGrp -edit -value `optionVar -q polySuperShapeU6` polySuperShapeU6; floatSliderGrp -edit -value `optionVar -q polySuperShapeU7` polySuperShapeU7; floatSliderGrp -edit -value `optionVar -q polySuperShapeU8` polySuperShapeU8; floatSliderGrp -edit -value `optionVar -q polySuperShapeU9` polySuperShapeU9; floatSliderGrp -edit -value `optionVar -q polySuperShapeU10` polySuperShapeU10; floatSliderGrp -edit -value `optionVar -q polySuperShapeU11` polySuperShapeU11; floatSliderGrp -edit -value `optionVar -q polySuperShapeU12` polySuperShapeU12; floatSliderGrp -edit -value `optionVar -q polySuperShapeU13` polySuperShapeU13; floatSliderGrp -edit -value `optionVar -q polySuperShapeU14` polySuperShapeU14; floatSliderGrp -edit -value `optionVar -q polySuperShapeU15` polySuperShapeU15; checkBoxGrp -edit -value1 `optionVar -q polySuperShapeUMirror` polySuperShapeUMirror; } // // Procedure Name: // polySuperShapeCallback // // 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. // // sdoIt - Whether the command should execute. // // Return Value: // None. // global proc polySuperShapeCallback(string $parent, int $doIt) { setParent $parent; // Set the optionVar's from the control values, and then // perform the command. int $shape = `optionMenuGrp -q -select polySuperShapeShape`; optionVar -intValue polySuperShapeShape $shape; optionVar -floatValue polySuperShapeRadius `floatSliderGrp -q -value polySuperShapeRadius`; optionVar -intValue polySuperShapeHDiv `intSliderGrp -q -value polySuperShapeHDiv`; optionVar -intValue polySuperShapeVDiv `intSliderGrp -q -value polySuperShapeVDiv`; optionVar -intValue polySuperShapeUVMode (`optionMenuGrp -q -select polySuperShapeUVMode`-1); optionVar -intValue polySuperShapeMergeVerts (`checkBoxGrp -q -value1 polySuperShapeMergeVerts`); optionVar -floatValue polySuperShapeHRev `floatSliderGrp -q -value polySuperShapeHRev`; optionVar -floatValue polySuperShapeVRev `floatSliderGrp -q -value polySuperShapeVRev`; optionVar -floatValue polySuperShapeVertOff `floatSliderGrp -q -value polySuperShapeVOff`; optionVar -floatValue polySuperShapeIntRad `floatSliderGrp -q -value polySuperShapeIntRad`; optionVar -floatValue polySuperShapeXOff `floatSliderGrp -q -value polySuperShapeXOff`; optionVar -floatValue polySuperShapeZOff `floatSliderGrp -q -value polySuperShapeZOff`; optionVar -floatValue polySuperShapeE0 `floatSliderGrp -q -value polySuperShapeE0`; optionVar -floatValue polySuperShapeE1 `floatSliderGrp -q -value polySuperShapeE1`; optionVar -intValue polySuperShapeEMirror (`checkBoxGrp -q -value1 polySuperShapeEMirror`); optionVar -floatValue polySuperShapeH0 `floatSliderGrp -q -value polySuperShapeH0`; optionVar -floatValue polySuperShapeH1 `floatSliderGrp -q -value polySuperShapeH1`; optionVar -floatValue polySuperShapeH2 `floatSliderGrp -q -value polySuperShapeH2`; optionVar -floatValue polySuperShapeH3 `floatSliderGrp -q -value polySuperShapeH3`; optionVar -floatValue polySuperShapeH4 `floatSliderGrp -q -value polySuperShapeH4`; optionVar -floatValue polySuperShapeH5 `floatSliderGrp -q -value polySuperShapeH5`; optionVar -floatValue polySuperShapeH6 `floatSliderGrp -q -value polySuperShapeH6`; optionVar -floatValue polySuperShapeH7 `floatSliderGrp -q -value polySuperShapeH7`; optionVar -floatValue polySuperShapeU0 `floatSliderGrp -q -value polySuperShapeU0`; optionVar -floatValue polySuperShapeU1 `floatSliderGrp -q -value polySuperShapeU1`; optionVar -floatValue polySuperShapeU2 `floatSliderGrp -q -value polySuperShapeU2`; optionVar -floatValue polySuperShapeU3 `floatSliderGrp -q -value polySuperShapeU3`; optionVar -floatValue polySuperShapeU4 `floatSliderGrp -q -value polySuperShapeU4`; optionVar -floatValue polySuperShapeU5 `floatSliderGrp -q -value polySuperShapeU5`; optionVar -floatValue polySuperShapeU6 `floatSliderGrp -q -value polySuperShapeU6`; optionVar -floatValue polySuperShapeU7 `floatSliderGrp -q -value polySuperShapeU7`; optionVar -floatValue polySuperShapeU8 `floatSliderGrp -q -value polySuperShapeU8`; optionVar -floatValue polySuperShapeU9 `floatSliderGrp -q -value polySuperShapeU9`; optionVar -floatValue polySuperShapeU10 `floatSliderGrp -q -value polySuperShapeU10`; optionVar -floatValue polySuperShapeU11 `floatSliderGrp -q -value polySuperShapeU11`; optionVar -floatValue polySuperShapeU12 `floatSliderGrp -q -value polySuperShapeU12`; optionVar -floatValue polySuperShapeU13 `floatSliderGrp -q -value polySuperShapeU13`; optionVar -floatValue polySuperShapeU14 `floatSliderGrp -q -value polySuperShapeU14`; optionVar -floatValue polySuperShapeU15 `floatSliderGrp -q -value polySuperShapeU15`; optionVar -intValue polySuperShapeUMirror `checkBoxGrp -q -value1 polySuperShapeUMirror`; polySuperShapeUpdateEnable($parent); if ($doIt) { string $type = "SuperEllipse"; if ( $shape == 2 ) $type = "SphericalHarmonics"; if ( $shape == 3 ) $type = "UltraShape"; performPolySuperShape $type 0; addToRecentCommandQueue "performPolySuperShape $type 0" "Polygon Super Shape"; } } // // Procedure Name: // polySuperShapeOptions // // Description: // Construct the option box UI. Involves accessing the standard option // box and customizing the UI accordingly. // // Input Arguments: // type - type of the node, this can be either "SuperEllipse", "SphericalHarmonic" or "UltraShape" // // Return Value: // None. // proc polySuperShapeOptions(string $type) { int $ellipseCollapsed = 1; int $shCollapsed = 1; int $ultraCollapsed = 1; if ( $type == "SuperEllipse") { $ellipseCollapsed = 0; optionVar -intValue polySuperShapeShape 1; } if ( $type == "SphericalHarmonics") { $shCollapsed = 0; optionVar -intValue polySuperShapeShape 2; } if ( $type == "UltraShape") { $ultraCollapsed = 0; optionVar -intValue polySuperShapeShape 3; } // Name of the command for this option box. // string $commandName = "polySuperShape"; // Build the option box actions. // string $callback = "polySuperShapeCallback"; string $setup = "polySuperShapeSetup"; // 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: Activate the default UI template. // ========================================== // // 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; // STEP 4: Create option box contents. // =================================== // tabLayout -tabsVisible 0 -scrollable 1; string $parent = `columnLayout -adjustableColumn 1`; frameLayout -label (getPluginResource("modelingToolkit", "kSuperShapeGeneralFrame")) -collapse 0; optionMenuGrp -label (getPluginResource("modelingToolkit", "kSuperShapeShape")) -cc ($callback + " " + $parent + " 0") polySuperShapeShape; menuItem -label (getPluginResource("modelingToolkit", "kShapeSuperEllipse")); menuItem -label (getPluginResource("modelingToolkit", "kShapeSphericalHarmonics")); menuItem -label (getPluginResource("modelingToolkit", "kShapeUltraShape")); setParent -menu ..; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeRadius")) -min 0.001 -max 100 -fieldMinValue 0.001 -cc ($callback + " " + $parent + " 0") polySuperShapeRadius; intSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeHDiv")) -min 1 -max 100 -cc ($callback + " " + $parent + " 0") polySuperShapeHDiv; intSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeVDiv")) -min 1 -max 100 -cc ($callback + " " + $parent + " 0") polySuperShapeVDiv; optionMenuGrp -label (getPluginResource("modelingToolkit", "kSuperShapeUVMode")) -cc ($callback + " " + $parent + " 0") polySuperShapeUVMode; menuItem -label (getPluginResource("modelingToolkit", "kShapeSuperUVModeNone")); menuItem -label (getPluginResource("modelingToolkit", "kShapeSuperUVModePinched")); menuItem -label (getPluginResource("modelingToolkit", "kShapeSuperUVModeSawtooth")); setParent -menu ..; setParent ..; frameLayout -label (getPluginResource("modelingToolkit", "kHelixFrame")) -collapse 1; checkBoxGrp -label (getPluginResource("modelingToolkit", "kHelixMergeVertices")) -cc ($callback + " " + $parent + " 0") polySuperShapeMergeVerts; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeHRev")) -cc ($callback + " " + $parent + " 0") polySuperShapeHRev; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeVRev")) -cc ($callback + " " + $parent + " 0") polySuperShapeVRev; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeVOff")) -cc ($callback + " " + $parent + " 0") polySuperShapeVOff; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeIntRad")) -cc ($callback + " " + $parent + " 0") polySuperShapeIntRad; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeXOff")) -cc ($callback + " " + $parent + " 0") polySuperShapeXOff; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSuperShapeZOff")) -cc ($callback + " " + $parent + " 0") polySuperShapeZOff; setParent ..; frameLayout -label (getPluginResource("modelingToolkit", "kEllipseFrame")) -collapse $ellipseCollapsed; floatSliderGrp -label (getPluginResource("modelingToolkit", "kEllipseVExponent")) -min 0.0 -max 5.0 -cc ($callback + " " + $parent + " 0") polySuperShapeE0; floatSliderGrp -label (getPluginResource("modelingToolkit", "kEllipseHExponent")) -min 0.0 -max 5.0 -cc ($callback + " " + $parent + " 0") polySuperShapeE1; checkBoxGrp -label (getPluginResource("modelingToolkit", "kEllipseMirror")) -cc ($callback + " " + $parent + " 0") polySuperShapeEMirror; setParent ..; frameLayout -label (getPluginResource("modelingToolkit", "kSHFrame")) -collapse $shCollapsed; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHVmult1")) -min -20.0 -max 20.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH0; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHVexp1")) -min 0.0 -max 5.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH1; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHVmult2")) -min -20.0 -max 20.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH2; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHVexp2")) -min 0.0 -max 5.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH3; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHHmult1")) -min -20.0 -max 20.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH4; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHHexp1")) -min 0.0 -max 5.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH5; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHHmult2")) -min -20.0 -max 20.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH6; floatSliderGrp -label (getPluginResource("modelingToolkit", "kSHHexp2")) -min 0.0 -max 5.0 -cc ($callback + " " + $parent + " 0") polySuperShapeH7; setParent ..; frameLayout -label (getPluginResource("modelingToolkit", "kUltraFrame")) -collapse $ultraCollapsed; frameLayout -label (getPluginResource("modelingToolkit", "kUltraHorizontalFrame")) -collapse 0; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHmult1")) -min -30.0 -max 30.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU0; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHexp1")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU1; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHexp2")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU2; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHMixer")) -min 0.0 -max 1.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU3; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHmult2")) -min -30.0 -max 30.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU4; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHexp3")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU5; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHexp4")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU6; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUHexp5")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU7; setParent ..; frameLayout -label (getPluginResource("modelingToolkit", "kUltraVerticalFrame")) -collapse 0; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVmult1")) -min -30.0 -max 30.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU8; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVexp1")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU9; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVexp2")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU10; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVMixer")) -min 0.0 -max 1.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU11; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVmult2")) -min -30.0 -max 30.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU12; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVexp3")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU13; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVexp4")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU14; floatSliderGrp -label (getPluginResource("modelingToolkit", "kUVexp5")) -min 0.0 -max 4.0 -cc ($callback + " " + $parent + " 0") polySuperShapeU15; setParent ..; checkBoxGrp -label (getPluginResource("modelingToolkit", "kUltraMirror")) -cc ($callback + " " + $parent + " 0") polySuperShapeUMirror; setParent ..; // Turn off the wait cursor. // waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: 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. // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (getPluginResource("modelingToolkit", "kCreateButton")) -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; // Step 7: Set the option box title. // ================================= // setOptionBoxTitle (getPluginResource("modelingToolkit", "kPolygonSuperShapeOptions")); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag("PolygonSuperShape"); // Set the current values of the option box. // ========================================= // eval (($setup + " " + $parent + " " + 0)); // Show the option box. // ==================== // showOptionBox(); } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // type - type of the node, this can be either "SuperEllipse", "SphericalHarmonic" or "UltraShape" // proc string assembleCmd(string $type) { string $cmd; setOptionVars(false); $cmd = "polySuperShape" + " -radius " + string(`optionVar -q polySuperShapeRadius`) + " -shape \"" + $type + "\"" + " -horizontalDivisions " + string(`optionVar -q polySuperShapeHDiv`) + " -verticalDivisions " + string(`optionVar -q polySuperShapeVDiv`) + " -createUV " + string(`optionVar -q polySuperShapeUVMode`) + " -mergeVertices " + string(`optionVar -q polySuperShapeMergeVerts`) + " -horizontalRevolutions " + string(`optionVar -q polySuperShapeHRev`) + " -verticalRevolutions " + string(`optionVar -q polySuperShapeVRev`) + " -verticalOffset " + string(`optionVar -q polySuperShapeVertOff`) + " -internalRadius " + string(`optionVar -q polySuperShapeIntRad`) + " -xOffset " + string(`optionVar -q polySuperShapeXOff`) + " -zOffset " + string(`optionVar -q polySuperShapeZOff`) + " -ve " + string(`optionVar -q polySuperShapeE0`) + " -he " + string(`optionVar -q polySuperShapeE1`) + " -em " + string(`optionVar -q polySuperShapeEMirror`) + " -vm1 " + string(`optionVar -q polySuperShapeH0`) + " -ve1 " + string(`optionVar -q polySuperShapeH1`) + " -vm2 " + string(`optionVar -q polySuperShapeH2`) + " -ve2 " + string(`optionVar -q polySuperShapeH3`) + " -hm1 " + string(`optionVar -q polySuperShapeH4`) + " -he1 " + string(`optionVar -q polySuperShapeH5`) + " -hm2 " + string(`optionVar -q polySuperShapeH6`) + " -he2 " + string(`optionVar -q polySuperShapeH7`) + " -u0 " + string(`optionVar -q polySuperShapeU0`) + " -u1 " + string(`optionVar -q polySuperShapeU1`) + " -u2 " + string(`optionVar -q polySuperShapeU2`) + " -u3 " + string(`optionVar -q polySuperShapeU3`) + " -u4 " + string(`optionVar -q polySuperShapeU4`) + " -u5 " + string(`optionVar -q polySuperShapeU5`) + " -u6 " + string(`optionVar -q polySuperShapeU6`) + " -u7 " + string(`optionVar -q polySuperShapeU7`) + " -u8 " + string(`optionVar -q polySuperShapeU8`) + " -u9 " + string(`optionVar -q polySuperShapeU9`) + " -u10 " + string(`optionVar -q polySuperShapeU10`) + " -u11 " + string(`optionVar -q polySuperShapeU11`) + " -u12 " + string(`optionVar -q polySuperShapeU12`) + " -u13 " + string(`optionVar -q polySuperShapeU13`) + " -u14 " + string(`optionVar -q polySuperShapeU14`) + " -u15 " + string(`optionVar -q polySuperShapeU15`) + " -um " + string(`optionVar -q polySuperShapeUMirror`) + ";"; return $cmd; } // // Procedure Name: // performPolySuperShape // // Description: // Perform the polySuperShape 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 sphere 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 performPolySuperShape(string $type, int $action) { string $cmd; switch ($action) { // Execute the command. // case 0: // Get the command. // $cmd = assembleCmd($type); // Execute the command with the option settings. // evalEcho($cmd); break; // Show the option box. // case 1: polySuperShapeOptions($type); break; // Return the command string. // case 2: // Get the command. // $cmd = assembleCmd($type); break; } return $cmd; }