// =========================================================================== // 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: June 17, 1997 // // Description: // Performance options window // // These are the global presets used in the resolution menus // The settings correspond to resolutions of Full, High, Medium, and Low // global float $performanceSettingsClusterResPresets[] = { 0.0, 1.0, 5.0, 10.0 }; global float $performanceSettingsLatticeResPresets[] = { 0.0, 0.01, 0.05, 0.1 }; // // Procedure Name: // updateRadio // // Description: // helper function for updating a radio button from the current settings in // the application // // Input Arguments: // $flag - the flag from performanceOptions // $widget - the radio button group to set // // Return Value: // None. // proc updateRadio( string $flag, string $widget ) { if (`radioButtonGrp -exists $widget`) { string $state = `performanceOptions -query $flag`; switch ( $state ) { case "0": radioButtonGrp -edit -select 1 $widget; break; case "1": radioButtonGrp -edit -select 2 $widget; break; case "interactive": radioButtonGrp -edit -select 3 $widget; } } } global proc performanceSettingsRadioCallback( string $widget, string $flag ) { global string $performanceSettingsWinParent; setParent $performanceSettingsWinParent; int $state = `radioButtonGrp -query -select $widget`; string $value; switch ( $state ) { case 1: performanceOptions $flag off; $value = "0"; break; case 2: performanceOptions $flag on; $value = "1"; break; case 3: performanceOptions $flag interactive; $value = "interactive"; } // Update the option var so that the values get saved to the // user's prefs. // switch ($flag) { case "-disableStitch": optionVar -stringValue performanceSettingStitchSurfaces $value; break; case "-disableTrimDisplay": optionVar -stringValue performanceSettingTrimDisplay $value; break; case "-passThroughLattice": optionVar -stringValue performanceSettingLattices $value; break; case "-useLatticeResolution": optionVar -stringValue performanceSettingLatticeResolution $value; break; case "-passThroughBlendShape": optionVar -stringValue performanceSettingBlendShapes $value; break; case "-passThroughFlexors": optionVar -stringValue performanceSettingFlexors $value; break; case "-passThroughBindSkinAndFlexors": optionVar -stringValue performanceSettingBindSkinAndFlexors $value; break; case "-passThroughSculpt": optionVar -stringValue performanceSettingSculpts $value; break; case "-passThroughWire": optionVar -stringValue performanceSettingWires $value; break; case "-passThroughDeltaMush": optionVar -stringValue performanceSettingDeltaMushes $value; break; case "-passThroughCluster": optionVar -stringValue performanceSettingClusters $value; break; case "-useClusterResolution": optionVar -stringValue performanceSettingClusterResolution $value; break; case "-passThroughPaintEffects": optionVar -stringValue performanceSettingPaintEffects $value; break; } } global proc performanceSettingsMenuCallback( string $widget, string $flag ) { global float $performanceSettingsClusterResPresets[]; global float $performanceSettingsLatticeResPresets[]; float $setting = 0.0; int $index = `optionMenuGrp -query -select $widget` - 1; if ( $flag == "-clusterResolution" ) { $setting = $performanceSettingsClusterResPresets[$index]; } else { $setting = $performanceSettingsLatticeResPresets[$index]; } performanceOptions $flag $setting; // Update the option var so that the values get saved to the // user's prefs. // switch ($flag) { case "-latticeResolution": optionVar -floatValue performanceSettingGlobalLatticeResolution $setting; break; case "-clusterResolution": optionVar -floatValue performanceSettingGlobalClusterResolution $setting; break; } } // // Procedure Name: // equiv // // Description: // helper function for checking if two floating point numbers are equivalent // // Input Arguments: // $val1 - the first value // $val2 - the second value // // Return Value: // true if they are within 0.001 of each other // proc int equiv( float $val1, float $val2 ) { return abs( $val1 - $val2 ) < 0.001; } // // Procedure Name: // performanceSettingsWinUpdate // // Description: // update the window to the current settings of the application // // Input Arguments: // None. // // Return Value: // None. // global proc performanceSettingsWinUpdate( string $parent ) { global float $performanceSettingsClusterResPresets[]; global float $performanceSettingsLatticeResPresets[]; global int $psCompleteLicense; setParent $parent; updateRadio( "-disableStitch", "stitchGroup" ); updateRadio( "-disableTrimDisplay", "trimGroup" ); if ($psCompleteLicense) { updateRadio( "-passThroughFlexors", "flexorGroup" ); updateRadio( "-passThroughBindSkinAndFlexors", "bindSkinGroup" ); updateRadio( "-passThroughSculpt", "sculptGroup" ); } updateRadio( "-passThroughLattice", "latticeGroup" ); if ($psCompleteLicense) { updateRadio( "-passThroughBlendShape", "blendShapeGroup" ); updateRadio( "-passThroughWire", "wireGroup" ); updateRadio( "-passThroughDeltaMush", "deltaMushGroup" ); updateRadio( "-passThroughCluster", "clusterGroup" ); updateRadio( "-useClusterResolution", "clusterResGroup" ); } updateRadio( "-useLatticeResolution", "latticeResGroup" ); if(`isTrue MayaCreatorExists`) { updateRadio( "-passThroughPaintEffects", "paintEffectsGroup" ); } if ($psCompleteLicense) { float $clusterRes = `performanceOptions -query -clusterResolution`; for ( $i = 0; $i < 4; $i++ ) { if ( equiv( $clusterRes, $performanceSettingsClusterResPresets[$i] ) ) { optionMenuGrp -edit -select ( $i + 1 ) clusterResMenuGrp; } } } float $latticeRes = `performanceOptions -query -latticeResolution`; for ( $i = 0; $i < 4; $i++ ) { if ( equiv ( $latticeRes, $performanceSettingsLatticeResPresets[$i] ) ) { optionMenuGrp -edit -select ( $i + 1 ) latticeResMenuGrp; } } if ($psCompleteLicense) { string $clusterState = `performanceOptions -query -useClusterResolution`; if ( $clusterState == "0" ) { optionMenuGrp -edit -en false clusterResMenuGrp; } else { optionMenuGrp -edit -en true clusterResMenuGrp; } } string $latticeState = `performanceOptions -query -useLatticeResolution`; if ( $latticeState == "0" ) { optionMenuGrp -edit -en false latticeResMenuGrp; } else { optionMenuGrp -edit -en true latticeResMenuGrp; } } // // Procedure Name: // performanceSettingsWin // // Description: // display the window for modifying the performance settings // // Input Arguments: // None. // // Return Value: // None. // global proc performanceSettingsWin() { global string $performanceSettingsWinParent; global int $gRefreshMode; global int $psCompleteLicense; $psCompleteLicense = `licenseCheck -m "edit" -typ "complete"`; if (!`window -exists performanceSettingsWin`) { window -title (uiRes("m_performanceSettingsWin.kPerformanceSettings")) -menuBar true -iconName (uiRes("m_performanceSettingsWin.kPerformance")) -rtf true performanceSettingsWin; menu -label (uiRes("m_performanceSettingsWin.kHelp")) -helpMenu true; menuItem -label (uiRes("m_performanceSettingsWin.kHelpOnPerformanceSettings")) -enableCommandRepeat false -command "showHelp PerformanceSettings"; // 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; formLayout performForm; $performanceSettingsWinParent = `columnLayout -adj true perfCol`; frameLayout -label (uiRes("m_performanceSettingsWin.kDependencyGraphEvaluation")) -lv true -cll false -mw 10 -mh 10 globalFrame; columnLayout -adj true surfaceCol; // Determine the correct radio button to select given // the refresh mode. // // Note that the $gRefreshMode values DO NOT match the order // of the radio buttons. // int $select = 1; if (0 /* Drag */ == $gRefreshMode) $select = 1; else if (1 /* Release */ == $gRefreshMode) $select = 3; else if (2 /* Demand */ == $gRefreshMode) $select = 2; string $demand = (uiRes("m_performanceSettingsWin.kDemand")); string $release = (uiRes("m_performanceSettingsWin.kRelease")); radioButtonGrp -numberOfRadioButtons 3 -label (uiRes("m_performanceSettingsWin.kRefreshOn")) -labelArray3 (uiRes("m_performanceSettingsWin.kDrag")) $demand $release -onCommand1 "{global int $gRefreshMode; $gRefreshMode = 0; manipOptions -refreshMode 0; animDisplay -modelUpdate interactive;}" -onCommand2 "{global int $gRefreshMode; $gRefreshMode = 2; manipOptions -refreshMode 2; animDisplay -modelUpdate none;}" -onCommand3 "{global int $gRefreshMode; $gRefreshMode = 1; manipOptions -refreshMode 1; animDisplay -modelUpdate delayed;}" -select $select refreshRBG; setParent ..; setParent ..; frameLayout -label (uiRes("m_performanceSettingsWin.kSurfaces")) -lv true -cll false -mw 10 -mh 10 surfacesFrame; columnLayout -adj true surfaceCol; string $on = (uiRes("m_performanceSettingsWin.kOn")); string $off = (uiRes("m_performanceSettingsWin.kOff")); string $interactive = (uiRes("m_performanceSettingsWin.kInteractive")); string $perNode = (uiRes("m_performanceSettingsWin.kPerNode")); string $global = (uiRes("m_performanceSettingsWin.kGlobal")); radioButtonGrp -label (uiRes("m_performanceSettingsWin.kStitchSurfaces")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback(\"stitchGroup\",\"-disableStitch\")" ) -select 1 stitchGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kTrimDisplay")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"trimGroup\",\"-disableTrimDisplay\")" ) -select 1 trimGroup; setParent ..; setParent ..; if( `isTrue MayaCreatorExists`) { frameLayout -label (uiRes("m_performanceSettingsWin.kPaintEffectsTitle")) -lv true -cll false -mw 10 -mh 10 paintEffectsFrame; columnLayout -adj true paintEffectsCol; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kPaintEffects")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback(\"paintEffectsGroup\",\"-passThroughPaintEffects\")" ) -select 1 paintEffectsGroup; setParent ..; setParent ..; } frameLayout -label (uiRes("m_performanceSettingsWin.kDeformers")) -lv true -cll false -mw 10 -mh 10 deformerFrame; columnLayout -adj true deformCol; if ($psCompleteLicense) { radioButtonGrp -label (uiRes("m_performanceSettingsWin.kFlexors")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"flexorGroup\",\"-passThroughFlexors\")" ) -select 1 flexorGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kBindSkinsAndFlexors")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"bindSkinGroup\"," + "\"-passThroughBindSkinAndFlexors\")" ) -select 1 bindSkinGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kSculpts")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"sculptGroup\",\"-passThroughSculpt\")" ) -select 1 sculptGroup; } radioButtonGrp -label (uiRes("m_performanceSettingsWin.kLattices")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"latticeGroup\",\"-passThroughLattice\")" ) -select 1 latticeGroup; if ($psCompleteLicense) { radioButtonGrp -label (uiRes("m_performanceSettingsWin.kWires")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"wireGroup\",\"-passThroughWire\")" ) -select 1 wireGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kBlendShapes")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"blendShapeGroup\",\"-passThroughBlendShape\")" ) -select 1 blendShapeGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kClusters")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"clusterGroup\",\"-passThroughCluster\")" ) -select 1 clusterGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kDeltaMushes")) -numberOfRadioButtons 3 -label1 $on -label2 $off -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"deltaMushGroup\",\"-passThroughDeltaMush\")" ) -select 1 deltaMushGroup; radioButtonGrp -label (uiRes("m_performanceSettingsWin.kClusterResolution")) -numberOfRadioButtons 3 -label1 $perNode -label2 $global -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"clusterResGroup\",\"-useClusterResolution\");"+ "performanceSettingsWinUpdate( \"" + $performanceSettingsWinParent + "\")" ) -select 1 clusterResGroup; } radioButtonGrp -label (uiRes("m_performanceSettingsWin.kLatticeResolution")) -numberOfRadioButtons 3 -label1 $perNode -label2 $global -label3 $interactive -onCommand ( "performanceSettingsRadioCallback("+ "\"latticeResGroup\",\"-useLatticeResolution\");"+ "performanceSettingsWinUpdate( \"" + $performanceSettingsWinParent + "\")" ) -select 1 latticeResGroup; string $full = (uiRes("m_performanceSettingsWin.kFull")); string $high = (uiRes("m_performanceSettingsWin.kHigh")); string $medium = (uiRes("m_performanceSettingsWin.kMedium")); string $low = (uiRes("m_performanceSettingsWin.kLow")); if ($psCompleteLicense) { optionMenuGrp -label (uiRes("m_performanceSettingsWin.kGlobalClusterResolution")) -cc ( "performanceSettingsMenuCallback("+ "\"clusterResMenuGrp\",\"-clusterResolution\")" ) clusterResMenuGrp; menuItem -label $full fullMenuItem; menuItem -label $high highMenuItem; menuItem -label $medium mediumMenuItem; menuItem -label $low lowMenuItem; } optionMenuGrp -label (uiRes("m_performanceSettingsWin.kGlobalLatticeResolution")) -cc ( "performanceSettingsMenuCallback("+ "\"latticeResMenuGrp\",\"-latticeResolution\")" ) latticeResMenuGrp; menuItem -label $full fullMenuItem; menuItem -label $high highMenuItem; menuItem -label $medium mediumMenuItem; menuItem -label $low lowMenuItem; setParent ..; setParent ..; setParent ..; button -label (uiRes("m_performanceSettingsWin.kClose")) -c "evalDeferred( \"deleteUI -window performanceSettingsWin\" )" performCloseButton; formLayout -edit -af perfCol "top" 5 -af perfCol "left" 5 -af perfCol "right" 5 -ac perfCol "bottom" 5 performCloseButton -af performCloseButton "left" 5 -af performCloseButton "right" 5 -af performCloseButton "bottom" 5 performForm; setUITemplate -popTemplate; } performanceSettingsWinUpdate( $performanceSettingsWinParent ); showWindow performanceSettingsWin; }