// Copyright (C) 1997-2004 Alias Systems Corp. // // The information in this file is provided for the exclusive use of the // licensees of Alias. Such users have the right to use, modify, // and incorporate this code into other products for purposes authorized // by the Alias license agreement, without fee. // // ALIAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO // EVENT SHALL ALIAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. // // // // ALIAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // EVENT SHALL ALIAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR // // // Alias Script File // MODIFY THIS AT YOUR OWN RISK // // // Description: // This script is defines the option box for the bevel plus // surface menu item. // // Input Arguments: // int action // 0 - show the option box dialog // 1 - just execute the bevel plus operation // // Return Value: // None. // global proc bevelPlusVisibility() // Description: // Dim/show any bevel options as required by the output surface type // { int $surfType; if ( `radioButtonGrp -exists outputPolyRadioButtonGrp` ) { $surfType = `radioButtonGrp -q -select outputPolyRadioButtonGrp`; } else { $surfType = `optionVar -q bevelPlusOutputPolygons`; } // only enable attach and tolerance if in nurbs/bezier mode if(2 == $surfType) { // 2 == Poly if(`checkBoxGrp -exists bevelPlusJoinSrfBox`) { checkBoxGrp -e -en 0 bevelPlusJoinSrfBox; } if( `radioButtonGrp -exists useGlobalTol` ) { radioButtonGrp -e -en 0 useGlobalTol; tabLayout -e -en 0 useGlobalTolTab; } } else { // Nurbs, enable attach option and the tolerance if(`checkBoxGrp -exists bevelPlusJoinSrfBox`) { checkBoxGrp -e -en 1 bevelPlusJoinSrfBox; } if( `radioButtonGrp -exists useGlobalTol` ) { radioButtonGrp -e -en 1 useGlobalTol; tabLayout -e -en 1 useGlobalTolTab; } } } proc setOptionVars (int $forceFactorySettings) { bevelPlusSetOptionVars( $forceFactorySettings ); } proc updateBevelSideEnableState() { //setParent NewBevelOptionBox2; int $bevelSideAtStart, $bevelSideAtEnd; int $bevelCapAtStart, $bevelCapAtEnd; int $sameAsOuterStyle, $enable, $enableInnerStyle; // Get the bevel side selection. // $bevelSideAtStart = `checkBoxGrp -q -v1 BevelSideCheckBoxGroup`; $bevelSideAtEnd = `checkBoxGrp -q -v2 BevelSideCheckBoxGroup`; // Get the bevel cap selection. // $bevelCapAtStart = `checkBoxGrp -q -v1 BevelCapCheckBoxGroup`; $bevelCapAtEnd = `checkBoxGrp -q -v2 BevelCapCheckBoxGroup`; $sameAsOuterStyle = `checkBoxGrp -query -value1 BevelInnerStyleCheckBoxGroup`; $enable = true; if ($sameAsOuterStyle) { $enableInnerStyle = false; } else { $enableInnerStyle = true; } floatSliderGrp -edit -enable $enable BevelWidthSliderGroup; floatSliderGrp -edit -enable $enable BevelDepthSliderGroup; textScrollList -edit -enable $enable BevelOuterStyleTextScrollList; checkBoxGrp -edit -enable $enable BevelInnerStyleCheckBoxGroup; textScrollList -edit -enable $enableInnerStyle BevelInnerStyleTextScrollList; } global proc BevelSideCheckBoxChange() { updateBevelSideEnableState(); } proc updateInnerStyleEnableState() { int $sameAsOuterStyle, $enable; $sameAsOuterStyle = `checkBoxGrp -query -value1 BevelInnerStyleCheckBoxGroup`; if ($sameAsOuterStyle) { $enable = false; } else { $enable = true; } textScrollList -edit -enable $enable BevelInnerStyleTextScrollList; } global proc BevelInnerStyleCheckBoxChange() { updateInnerStyleEnableState(); } global proc createBevelBasicOptions() // // Description : // Bevel plus operation options // { // OK, this is a problem. We'd like to get this mapping // directly from the attributes on styleCurve node, but // there is currently no MEL way of doing that. string $BSstyleCurveStrings[] = { "Straight Out", "Straight In", "Convex Out", "Convex In", "Concave Out", "Concave In", "Straight Side Edge", "Straight Front Edge", "Straight Corner", "Convex Side Edge", "Convex Front Edge", "Convex Corner", "Concave Side Edge", "Concave Front Edge", "Convex Crease" }; // Create Bevel // checkBoxGrp -numberOfCheckBoxes 2 -label "Create Bevel" -labelArray2 "At Start" "At End" -cc1 ("BevelSideCheckBoxChange") -cc2 ("BevelSideCheckBoxChange") BevelSideCheckBoxGroup; // Sliders // floatSliderGrp -l "Bevel Width" -min 0.00001 -max 0.25 -fmn -10000.0 -fmx 10000.0 BevelWidthSliderGroup; floatSliderGrp -l "Bevel Depth" -min 0.00001 -max 0.25 -fmn -10000.0 -fmx 10000.0 BevelDepthSliderGroup; floatSliderGrp -l "Extrude Distance" -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0 extrudeDepthFloatField; // Caps // checkBoxGrp -numberOfCheckBoxes 2 -label "Create Cap" -labelArray2 "At Start" "At End" -cc1 ("BevelSideCheckBoxChange") -cc2 ("BevelSideCheckBoxChange") BevelCapCheckBoxGroup; // Style curve scroll lists // separator; rowLayout -numberOfColumns 2; text -label "Outer Bevel Style"; textScrollList -numberOfRows 8 BevelOuterStyleTextScrollList; setParent ..; rowLayout -numberOfColumns 2; text -label "Inner Bevel Style"; textScrollList -numberOfRows 8 BevelInnerStyleTextScrollList; setParent ..; string $str; for ($str in $BSstyleCurveStrings) { textScrollList -e -append $str BevelOuterStyleTextScrollList; textScrollList -e -append $str BevelInnerStyleTextScrollList; } checkBoxGrp -numberOfCheckBoxes 1 -label "" -label1 "Same as Outer Style" -value1 true -changeCommand ("BevelInnerStyleCheckBoxChange") BevelInnerStyleCheckBoxGroup; } proc string createBevelOptions(string $parent) // // Description : // Bevel plus operation options // { setParent $parent ; string $column = `columnLayout/* -rowSpacing 2 -adjustableColumn true*/`; checkBoxGrp -ncb 1 -l "" -l1 "Attach Surfaces" -v1 on bevelPlusJoinSrfBox; createBevelBasicOptions(); separator; // Misc. options // radioButtonGrp -nrb 2 -l "Use Tolerance" -l1 "Global" -l2 "Local" -on1 "tabLayout -e -selectTab noSlider useGlobalTolTab" -on2 "tabLayout -e -selectTab showSlider useGlobalTolTab" useGlobalTol; tabLayout -tabsVisible false useGlobalTolTab; columnLayout showSlider; floatSliderGrp -l "Tolerance" -min 0.00001 -max 0.1 -fmn 0.00001 -fmx 1000.0 bevelPlusToleranceFloatField; setParent ..; columnLayout noSlider; setParent ..; setParent ..; bevelPlusVisibility(); updateBevelSideEnableState(); updateInnerStyleEnableState(); return $column; } global proc bevelPlusPolySetup( string $parent, string $goToTool) { // polygon output. // int $polygons = `optionVar -q bevelPlusOutputPolygons`; if( !`isTrue "SurfaceUIExists"` ) { $polygons = 1; } else if ( `radioButtonGrp -exists outputPolyRadioButtonGrp` ) { switch( $polygons ) { case 0: radioButtonGrp -edit -select 1 outputPolyRadioButtonGrp; break; case 1: radioButtonGrp -edit -select 2 outputPolyRadioButtonGrp; break; case 2: warning("Invalid choice"); break; case 3: radioButtonGrp -edit -select 3 outputPolyRadioButtonGrp; break; default: break; } } bevelPlusVisibility(); switch( $polygons ) { case 0: default: tabLayout -e -st bevelPlusPolyOptionsNo bevelPlusPolyOptions; break; case 1: tabLayout -e -st bevelPlusPolyOptionsOK bevelPlusPolyOptions; break; } if( "" != $goToTool ) { checkBoxGrp -e -v1 `scriptCtx -q -euc $goToTool` scriptToolExtraWidget; checkBoxGrp -e -v2 `scriptCtx -q -lac $goToTool` scriptToolExtraWidget; } // Now the polygon options: int $formatValue; int $localIntValue; float $localFloatValue; $formatValue = `optionVar -q bevelPlusPolyFormat`; switch( $formatValue ) { case 0: radioButtonGrp -e -sl 1 format; break; case 2: radioButtonGrp -e -sl 2 format; break; default: break; } $localIntValue = `optionVar -q bevelPlusPolyCount`; intSliderGrp -e -v $localIntValue count; $localIntValue = `optionVar -q bevelPlusPolyTypeU`; optionMenuGrp -e -sl ($localIntValue-1) uType; $localIntValue = `optionVar -q bevelPlusPolyNumberU`; intSliderGrp -e -v $localIntValue uNumber; $localIntValue = `optionVar -q bevelPlusPolyTypeV`; optionMenuGrp -e -sl ($localIntValue-1) vType; $localIntValue = `optionVar -q bevelPlusPolyNumberV`; intSliderGrp -e -v $localIntValue vNumber; bevelPlusPolyVisibility $parent $formatValue; } global proc bevelPlusPolyVisibility( string $parent, int $format ) { setParent $parent; switch( $format ) { case 0: default: tabLayout -e -selectTab tabCount formatTabs; break; case 2: tabLayout -e -selectTab tabGeneral formatTabs; break; } } proc bevelPlusPolyAddOptions( string $parent ) { setParent $parent; string $radioBtnGrp1 =`radioButtonGrp -nrb 2 -label "Tessellation Method" -l1 "Count" -l2 "Sampling" -cc1 ("bevelPlusPolyVisibility " + $parent + " 0") -cc2 ("bevelPlusPolyVisibility " + $parent + " 2") format`; separator -w 1000; tabLayout -tabsVisible false formatTabs; columnLayout tabGeneral; text -l " Sampling Controls"; optionMenuGrp -l "Along Extrusion" uType; menuItem -l "Complete"; menuItem -l "Section"; intSliderGrp -label "Samples" -min 1 -max 32 -fmx 10000 uNumber; optionMenuGrp -l "Along Curve" vType; menuItem -l "Complete"; menuItem -l "Span"; intSliderGrp -label "Samples" -min 1 -max 32 -fmx 10000 vNumber; setParent ..; columnLayout tabCount; intSliderGrp -label "Face Count" -min 1 -max 1000 -fmx 1000000 count; setParent ..; columnLayout tabNothing; setParent ..; setParent ..; } global proc string createBevelOutputOptions(string $parent, int $inTheTool, string $goToTool) { string $form, $column, $outputTabs; setParent $parent; $form = `formLayout`; $column = `columnLayout/* -rowSpacing 2*/`; if( `isTrue "SurfaceUIExists"` ) { radioButtonGrp -nrb 2 -label "Output Geometry" -label1 "Nurbs" -da1 0 -label2 "Polygons" -da2 1 -select 1 -cc1 "bevelPlusVisibility(); tabLayout -e -st bevelPlusPolyOptionsNo bevelPlusPolyOptions" -cc2 "bevelPlusVisibility(); tabLayout -e -st bevelPlusPolyOptionsOK bevelPlusPolyOptions" outputPolyRadioButtonGrp; } separator; tabLayout -tabsVisible false bevelPlusPolyOptions; string $par = `columnLayout bevelPlusPolyOptionsOK`; bevelPlusPolyAddOptions($par); setParent ..; columnLayout bevelPlusPolyOptionsNo; setParent ..; setParent ..; if( $inTheTool ) { separator; checkBoxGrp -ncb 2 -l "Tool Behavior" -l1 "Exit on Completion" -v1 off -on1 ("scriptCtx -e -euc true " + $goToTool) -of1 ("scriptCtx -e -euc false " + $goToTool) -l2 "Auto Completion" -v2 on -on2 ("scriptCtx -e -lac true " + $goToTool) -of2 ("scriptCtx -e -lac false " + $goToTool) scriptToolExtraWidget; } return $form; } proc string assembleCmd() // // Description : // To assemble style bevel proc. // { setOptionVars(false); string $cmd = "bevelPlusPreset" ; $cmd = $cmd + "(" ; int $history = `constructionHistory -q -tgl`; $cmd = $cmd + $history ; $cmd = $cmd + "," ; int $polygons = `optionVar -q bevelPlusOutputPolygons` ; if( $polygons > 2 ) { $polygons = 1; } if( !`isTrue "SurfaceUIExists"` ) $polygons = 1; $cmd = $cmd + $polygons ; $cmd = $cmd + "," ; int $bevelJoin = `optionVar -q bevelPlusAttachSurfaces` ; $cmd = $cmd + $bevelJoin ; $cmd = $cmd + "," ; float $tol = `optionVar -q bevelPlusTolerance` ; if( `optionVar -q bevelPlusUseGlobalTol` ) { $tol = `optionVar -q positionalTolerance`; } $cmd = $cmd + $tol ; $cmd = $cmd + "," ; int $bevelPlusSides = `optionVar -q bevelPlusNSides` ; $cmd = $cmd + $bevelPlusSides ; $cmd = $cmd + "," ; float $bevelPlusWidth = `optionVar -q bevelPlusWidth` ; $cmd = $cmd + $bevelPlusWidth ; $cmd = $cmd + "," ; float $bevelPlusDepth = `optionVar -q bevelPlusDepth` ; $cmd = $cmd + $bevelPlusDepth ; $cmd = $cmd + "," ; float $bevelPlusExtrudeHt = `optionVar -q bevelPlusExtrudeHeight` ; $cmd = $cmd + $bevelPlusExtrudeHt ; $cmd = $cmd + "," ; int $bevelPlusCaps = `optionVar -q bevelPlusCaps` ; $cmd = $cmd + $bevelPlusCaps ; $cmd = $cmd + "," ; int $outerBevelCurve = `optionVar -q outerStyleBevelCurve`; $cmd = $cmd + $outerBevelCurve; $cmd = $cmd + "," ; int $sameAsOuter = `optionVar -q innerStyleSameAsOuter`; if( $sameAsOuter ) { $cmd = $cmd + $outerBevelCurve ; } else { int $innerBevelCurve = `optionVar -q innerStyleBevelCurve`; $cmd = $cmd + $innerBevelCurve ; } $cmd = $cmd + ","; int $pFormat = `optionVar -q bevelPlusPolyFormat`; $cmd = $cmd + $pFormat; $cmd = $cmd + ","; int $pCount = `optionVar -q bevelPlusPolyCount`; $cmd = $cmd + $pCount; $cmd = $cmd + ","; int $pTypeU = `optionVar -q bevelPlusPolyTypeU`; $cmd = $cmd + $pTypeU; $cmd = $cmd + ","; int $pNumberU = `optionVar -q bevelPlusPolyNumberU`; $cmd = $cmd + $pNumberU; $cmd = $cmd + ","; int $pTypeV = `optionVar -q bevelPlusPolyTypeV`; $cmd = $cmd + $pTypeV; $cmd = $cmd + ","; int $pNumberV = `optionVar -q bevelPlusPolyNumberV`; $cmd = $cmd + $pNumberV; $cmd = $cmd + ")" ; // centre the pivot point $cmd = $cmd + "; CenterPivot"; //do a planar projection on the cap if outputting polys if (`optionVar -q bevelPlusOutputPolygons` == 1){ $cmd = $cmd + ";"; //must check to see if bevel has succeeded //$bevelSuccess will be >0 if successful and command //may continue string $errorCheck = " int $intArr[] = `polyEvaluate -v`; "; $errorCheck += "int $numVerts = 0; "; $errorCheck += "if (size($intArr) > 0) $numVerts = $intArr[0]; "; $errorCheck += "if ($numVerts > 0) { "; $cmd = $cmd + $errorCheck; //select all faces with 0 map area and more than 4 sides - these //will be the caps //see polyCleanupArgList.mel for a complete list of the arguments $cmd = $cmd + "polyCleanupArgList 3 { \"0\",\"2\",\"1\",\"0\","; $cmd = $cmd + "\"1\",\"0\",\"0\",\"0\",\"0\",\"1e-005\",\"0\",\""; $cmd = $cmd + "1e-005\",\"1\",\"0\",\"0\",\"-1\",\"0\" };"; $cmd = $cmd + "polyProjection -ch 1 -type Planar -ibd off -icx 0.5 "; $cmd = $cmd + "-icy 0.5 -ra 0 -isu 1 -isv 1 -md z ;"; $cmd = $cmd + "select -r `listConnections -t \"shape\"`;"; $cmd = $cmd + "} else {"; $cmd = $cmd + " error \"bevelPlus failed - open script editor for details\";"; $cmd = $cmd + "}"; //and switch back to object mode $cmd = $cmd + "changeSelectMode -object;"; } return $cmd ; } proc bevelPlusOptions( int $inTheTool, string $goToTool ) { // Name of the command for this option box. // string $commandName = "bevelPlus"; // Build the option box actions. // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); global string $gOptionBoxActionToolItem; $gOptionBoxActionToolItem = "modelWithToolBevelPlus"; global string $gOptionBoxActionToolItemCB; $gOptionBoxActionToolItemCB = "bevelPlusToolScript 3"; // Turn on the wait cursor. // waitCursor -state 1; // Step 1: Get the option box. // ============================ string $layout = getOptionBox(); setParent $layout; // Step 2: Pass the command name to the option box. // ================================================= setOptionBoxCommandName($commandName); // Step 3: Activate the default UI template. // ========================================== setUITemplate -pushTemplate DefaultTemplate; // Step 4: Create option box contents. // =================================== string $bevelOptionsLayout; string $outputOptionsLayout; string $parent = `tabLayout -scrollable true`; $bevelOptionsLayout = createBevelOptions($parent); $outputOptionsLayout = createBevelOutputOptions($parent, $inTheTool, $goToTool ); tabLayout -edit -tabLabel $bevelOptionsLayout "Bevel" -tabLabel $outputOptionsLayout "Output Options" $parent; // Turn off the wait cursor. // waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: Customize the buttons. // ============================== // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); if( $inTheTool ) { button -edit -l "Bevel Tool" -command ($callback + " " + $parent + " 3 \"" + $goToTool + "\"") $applyBtn; } else { button -edit -l "Bevel" -command ($callback + " " + $parent + " 1 \"" + $goToTool + "\"") $applyBtn; } // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " 0 \"" + $goToTool + "\"; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " 1 \"" + $goToTool + "\"") $resetBtn; // Step 7: Set the option box title. // ================================= // if( $inTheTool ) { setOptionBoxTitle("Bevel Plus Tool Options"); } else { setOptionBoxTitle("Bevel Plus Options"); } // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag( "BevelPlus" ); // Step 9: Set the current values of the option box. // ================================================= // eval ($setup + " " + $parent + " 0 \"" + $goToTool + "\""); // Step 10: Show the option box. // ============================= // showOptionBox(); } proc string bevelPlusHelp() { string $cmdHelp = "Command: Bevel Plus - creates a styled beveled surface. \n " ; string $selectHelp = "Selection: Select a curve or surface isoparm or curve on surface to bevel " ; return $cmdHelp+$selectHelp ; } global proc bevelPlusBasicSetup( string $parent, int $forceFactorySettings, string $goToTool) { // retrieve option settings. // setOptionVars($forceFactorySettings); bevelPlusToolSetup( $forceFactorySettings, $goToTool ); setParent $parent; // query and set controls for all the option vars. // float $bwidth = `optionVar -q bevelPlusWidth` ; floatSliderGrp -e -v $bwidth BevelWidthSliderGroup ; if( $forceFactorySettings ) { floatSliderGrp -e -min 0.00001 -max 0.25 -fmn -10000.0 -fmx 10000.0 BevelWidthSliderGroup ; } // bevel depth. // float $bdepth = `optionVar -q bevelPlusDepth` ; floatSliderGrp -e -v $bdepth BevelDepthSliderGroup ; if( $forceFactorySettings ) { floatSliderGrp -e -min 0.00001 -max 0.25 -fmn -10000.0 -fmx 10000.0 BevelDepthSliderGroup; } // extrude height. // float $edepth = `optionVar -q bevelPlusExtrudeHeight` ; floatSliderGrp -e -v $edepth extrudeDepthFloatField ; if( $forceFactorySettings ) { floatSliderGrp -e -min 0.00001 -max 1.0 -fmn -10000.0 -fmx 10000.0 extrudeDepthFloatField; } // global vs. local tolerance. if ( `radioButtonGrp -exists useGlobalTol` ) { int $useGlobalTol = `optionVar -q bevelPlusUseGlobalTol`; radioButtonGrp -e -select (2 - $useGlobalTol) useGlobalTol; // bevel tolerance. // float $tol = `optionVar -q bevelPlusTolerance` ; floatSliderGrp -e -v $tol bevelPlusToleranceFloatField ; if( $forceFactorySettings ) { floatSliderGrp -e -min 0.00001 -max 0.1 -fmn 0.00001 -fmx 1000.0 bevelPlusToleranceFloatField; } if( $useGlobalTol == 1 ) { tabLayout -e -selectTab noSlider useGlobalTolTab; } else { tabLayout -e -selectTab showSlider useGlobalTolTab; } } if(`checkBoxGrp -exists bevelPlusJoinSrfBox`) { // attach the surfaces. // int $attach = `optionVar -q bevelPlusAttachSurfaces` ; if( $attach == 1 ) { checkBoxGrp -edit -v1 true bevelPlusJoinSrfBox ; } else { checkBoxGrp -edit -v1 false bevelPlusJoinSrfBox ; } } // Outer Bevel Curve Name // int $styleCurve = `optionVar -q outerStyleBevelCurve` ; textScrollList -edit -sii ($styleCurve+1) BevelOuterStyleTextScrollList; // Inner Bevel Curve Name // $styleCurve = `optionVar -q innerStyleBevelCurve` ; textScrollList -edit -sii ($styleCurve+1) BevelInnerStyleTextScrollList; // Inner bevel same as outer bevel // int $sameAsOuterStyle = `optionVar -q innerStyleSameAsOuter` ; checkBoxGrp -edit -v1 $sameAsOuterStyle BevelInnerStyleCheckBoxGroup; int $nedges = `optionVar -q bevelPlusNSides` ; if( $nedges == 1 ) { //None checkBoxGrp -e -v1 0 BevelSideCheckBoxGroup; checkBoxGrp -e -v2 0 BevelSideCheckBoxGroup; } else if( $nedges == 4 ) { //At Start and End checkBoxGrp -e -v1 1 BevelSideCheckBoxGroup; checkBoxGrp -e -v2 1 BevelSideCheckBoxGroup; } else if( $nedges == 3 ) { //At End checkBoxGrp -e -v1 0 BevelSideCheckBoxGroup; checkBoxGrp -e -v2 1 BevelSideCheckBoxGroup; } else if( $nedges == 2 ) { //At Start checkBoxGrp -e -v1 1 BevelSideCheckBoxGroup; checkBoxGrp -e -v2 0 BevelSideCheckBoxGroup; } int $ncaps = `optionVar -q bevelPlusCaps` ; if( $ncaps == 1 ) { //None checkBoxGrp -e -v1 0 BevelCapCheckBoxGroup; checkBoxGrp -e -v2 0 BevelCapCheckBoxGroup; } else if( $ncaps == 4 ) { //At Start and End checkBoxGrp -e -v1 1 BevelCapCheckBoxGroup; checkBoxGrp -e -v2 1 BevelCapCheckBoxGroup; } else if( $ncaps == 3 ) { //At End checkBoxGrp -e -v1 0 BevelCapCheckBoxGroup; checkBoxGrp -e -v2 1 BevelCapCheckBoxGroup; } else if( $ncaps == 2 ) { //At Start checkBoxGrp -e -v1 1 BevelCapCheckBoxGroup; checkBoxGrp -e -v2 0 BevelCapCheckBoxGroup; } // dim/show any options as required // BevelSideCheckBoxChange(); } global proc bevelPlusSetup( string $parent, int $forceFactorySettings, string $goToTool) { bevelPlusBasicSetup($parent, $forceFactorySettings, $goToTool); bevelPlusPolySetup($parent, $goToTool); } global proc bevelPlusCallback( string $parent, int $doIt, string $goToTool ) { if( "" != $goToTool ) { optionVar -iv bevelPlusEuc `scriptCtx -q -euc $goToTool`; optionVar -iv bevelPlusLac `scriptCtx -q -lac $goToTool`; } setParent $parent ; // get Values from controls. // if( `isTrue "SurfaceUIExists"` && `radioButtonGrp -exists outputPolyRadioButtonGrp` ) { int $polys = `radioButtonGrp -q -select outputPolyRadioButtonGrp`; if( 3 == $polys ) { $polys = 4; } optionVar -intValue bevelPlusOutputPolygons ($polys-1) ; } // global vs. local if ( `radioButtonGrp -exists useGlobalTol` ) { if( `optionVar -q bevelPlusUseGlobalTol` ) { int $useGlobalTol = 2 - `radioButtonGrp -q -select useGlobalTol`; optionVar -intValue bevelPlusUseGlobalTol $useGlobalTol; } float $fValue = `floatSliderGrp -q -v bevelPlusToleranceFloatField` ; optionVar -floatValue bevelPlusTolerance $fValue ; } $fValue = `floatSliderGrp -q -v BevelWidthSliderGroup` ; optionVar -floatValue bevelPlusWidth $fValue ; $fValue = `floatSliderGrp -q -v BevelDepthSliderGroup` ; optionVar -floatValue bevelPlusDepth $fValue ; $fValue = `floatSliderGrp -q -v extrudeDepthFloatField` ; optionVar -floatValue bevelPlusExtrudeHeight $fValue; // attach surfaces or not. // if(`checkBoxGrp -exists bevelPlusJoinSrfBox`) { int $val = `checkBoxGrp -q -v1 bevelPlusJoinSrfBox` ; optionVar -intValue bevelPlusAttachSurfaces $val ; } // bevel number of edges. // int $ne; int $atStart = `checkBoxGrp -q -v1 BevelSideCheckBoxGroup`; int $atEnd = `checkBoxGrp -q -v2 BevelSideCheckBoxGroup`; if( !$atStart && !$atEnd ) { //None $ne = 1; } else if( $atStart && !$atEnd ) { //At Start $ne = 2; } else if( !$atStart && $atEnd ) { //At End $ne = 3; } else if( $atStart && $atEnd ) { //At Start and End $ne = 4; } optionVar -intValue bevelPlusNSides $ne ; // bevel number of caps. // int $nCaps; $atStart = `checkBoxGrp -q -v1 BevelCapCheckBoxGroup`; $atEnd = `checkBoxGrp -q -v2 BevelCapCheckBoxGroup`; if( !$atStart && !$atEnd ) { //None $nCaps = 1; } else if( $atStart && !$atEnd ) { //At Start $nCaps = 2; } else if( !$atStart && $atEnd ) { //At End $nCaps = 3; } else if( $atStart && $atEnd ) { //At Start and End $nCaps = 4; } optionVar -intValue bevelPlusCaps $nCaps; // Outer bevel Curve // int $styleCurve[] = `textScrollList -q -sii BevelOuterStyleTextScrollList`; optionVar -intValue outerStyleBevelCurve ($styleCurve[0]-1); // Inner bevel Curve // $styleCurve = `textScrollList -q -sii BevelInnerStyleTextScrollList`; optionVar -intValue innerStyleBevelCurve ($styleCurve[0]-1); // Inner Bevel Same as Outer // int $sameAsOuterStyle = `checkBoxGrp -q -v1 BevelInnerStyleCheckBoxGroup`; optionVar -intValue innerStyleSameAsOuter $sameAsOuterStyle; // Output options // int $formatValue = `radioButtonGrp -q -sl format`; switch( $formatValue ) { case 1: $formatValue = 0; break; case 2: $formatValue = 2; break; default: break; } optionVar -iv bevelPlusPolyFormat $formatValue; optionVar -iv bevelPlusPolyCount (`intSliderGrp -q -v count`); optionVar -iv bevelPlusPolyTypeU (`optionMenuGrp -q -sl uType` + 1); optionVar -iv bevelPlusPolyNumberU (`intSliderGrp -q -v uNumber`); optionVar -iv bevelPlusPolyTypeV (`optionMenuGrp -q -sl vType` + 1); optionVar -iv bevelPlusPolyNumberV (`intSliderGrp -q -v vNumber`); if( 1 == $doIt ) { performBevelPlus(0, $goToTool); string $tmpCmd = "performBevelPlus(0, \"" + $goToTool + "\")"; addToRecentCommandQueue $tmpCmd "BevelPlus"; } else if( $doIt ) { setToolTo $goToTool; } } global proc string performBevelPlus( int $action, string $goToTool ) // // Description : // $action = 0 ==> do the command. // $action = 1 ==>show option box. // $action = 2 ==>drag to shelf. // $action = 3 ==>Show the tool option box { int $inTheTool = false; if( 3 == $action ) { $action = 1; $inTheTool = true; } string $cmd = "" ; switch( $action ) { case 0: $cmd = `assembleCmd` ; //Turn on the wait cursor // if( catch(eval($cmd)) ){ } break ; case 1: bevelPlusOptions( $inTheTool, $goToTool ); break ; case 2: default: $cmd = `assembleCmd` ; break ; } return $cmd ; }