// =========================================================================== // 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: Sept 1996 // // Description: // This script defines various HUD-related procedures. // //Object Details Procedures // //Backfaces //Smoothness (Nurbs and Subdivs only) //Instance //Display Layer //Command scripts // //Note: Due to the behaviour of the filterExpand command, code has been added // to circumvent "N/A" return value when an intermediate node is selected // in a given hierarchy. (ie. Parent nodes) The filterExpand command filters // out only the leaf nodes of the hierarchy, thus returning only the shapes // of any parent nodes, followed by the children of the node, in that order. // It is to be noted that filterExpand returns the shape of the currently // selected parent node in the string array, so a check is made to // ensure the main selection objects refer to the same object. // // This relates to both objectDetailsBackfaces() and objectDetailsSmoothness(). // global proc string objectDetailsBackfaces() { string $result; int $hasResult = false; global int $gSelectMeshesBit; global int $gSelectNurbsSurfacesBit; string $selectedObjects[] = `ls -sl -o`; string $mainObject; string $mainShape; int $aSelectedObjectExists = 0; int $hasChildren = 0; int $isValid = 0; if (size($selectedObjects) > 0) { $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ]; $aSelectedObjectExists = 1; //Check if this node has any children (ie. it is a parent node) string $children[] = `listRelatives -c $mainObject`; string $shapes[] = `listRelatives -s $mainObject`; $mainShape = $shapes[0]; if (size($children) > 1) { $hasChildren = 1; } else if (size($children) == 1) { if ($mainShape != $children[0]) { $hasChildren = 1; } } } string $surface; string $meshSurfaces[] = `filterExpand -sm $gSelectMeshesBit $selectedObjects`; int $aSelectedMeshSurfaceExists = 0; if (size($meshSurfaces) > 0) { if ($hasChildren) { for ($surface in $meshSurfaces) { if ($mainShape == $surface) { $isValid = 1; break; } } } else if ($meshSurfaces[ (size($meshSurfaces) - 1) ] == $mainObject) { $isValid = 1; } $aSelectedMeshSurfaceExists = 1; } string $nurbsSurfaces[] = `filterExpand -sm $gSelectNurbsSurfacesBit $selectedObjects`; int $aSelectedNurbsSurfaceExists = 0; if (size($nurbsSurfaces) > 0) { if ($hasChildren) { for ($surface in $nurbsSurfaces) { if ($mainShape == $surface) { $isValid = 1; break; } } } else if ($nurbsSurfaces[ (size($nurbsSurfaces) - 1) ] == $mainObject) { $isValid = 1; } $aSelectedNurbsSurfaceExists = 1; } if ($aSelectedObjectExists) { string $on = (uiRes("m_initHUDScripts.kHUDBackfaceOn")); string $off = (uiRes("m_initHUDScripts.kHUDBackfaceOff")); if ($aSelectedMeshSurfaceExists && $isValid) { int $backfaces[] = `polyOptions -q -bc $mainObject`; if ($backfaces[0]) { $result = $on; } else { $result = $off; } $hasResult = true; } else if ($aSelectedNurbsSurfaceExists && $isValid) { if (!`displayCull -q -bfc $mainObject`) { $result = $on; } else { $result = $off; } $hasResult = true; } } if (!$hasResult) { //No selected objects or no selected objects of valid type $result = (uiRes("m_initHUDScripts.kHUDBackfaceNA")); } return $result; } global proc string objectDetailsSmoothness() { string $result; int $hasResult = false; global int $gSelectNurbsSurfacesBit; global int $gSelectSubdivSurface; string $selectedObjects[] = `ls -sl -o`; string $mainObject; string $mainShape; int $aSelectedObjectExists = 0; int $hasChildren = 0; int $isValid = 0; if (size($selectedObjects) > 0) { $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ]; $aSelectedObjectExists = 1; //Check if this node has any children (ie. it is a parent node) string $children[] = `listRelatives -c $mainObject`; string $shapes[] = `listRelatives -s $mainObject`; $mainShape = $shapes[0]; if (size($children) > 1) { $hasChildren = 1; } else if (size($children) == 1) { if ($mainShape != $children[0]) { $hasChildren = 1; } } } string $surface; string $nurbsSurfaces[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit $selectedObjects`; int $aSelectedNurbsSurfaceExists = 0; if (size($nurbsSurfaces) > 0) { if ($hasChildren) { for ($surface in $nurbsSurfaces) { if ($mainShape == $surface) { $isValid = 1; break; } } } else if ($nurbsSurfaces[ (size($nurbsSurfaces) - 1) ] == $mainObject) { $isValid = 1; } $aSelectedNurbsSurfaceExists = 1; } string $subdivSurfaces[] = `filterExpand -ex true -sm $gSelectSubdivSurface $selectedObjects`; int $aSelectedSubdivSurfaceExists = 0; if (size($subdivSurfaces) > 0) { if ($hasChildren) { for ($surface in $subdivSurfaces) { if ($mainShape == $surface) { $isValid = 1; break; } } } else if ($subdivSurfaces[ (size($subdivSurfaces) - 1) ] == $mainObject) { $isValid = 1; } $aSelectedSubdivSurfaceExists = 1; } string $na = (uiRes("m_initHUDScripts.kHUDSmoothnessNA")); string $hull = (uiRes("m_initHUDScripts.kHUDSmoothnessHull")); string $rough = (uiRes("m_initHUDScripts.kHUDSmoothnessRough")); string $medium = (uiRes("m_initHUDScripts.kHUDSmoothnessMedium")); string $fine = (uiRes("m_initHUDScripts.kHUDSmoothnessFine")); string $custom = (uiRes("m_initHUDScripts.kHUDSmoothnessCustom")); if ($aSelectedObjectExists) { if ($aSelectedNurbsSurfaceExists && $isValid) { // NURBS Surface // //"Hull" displaySmoothness -hull; //"Rough" displaySmoothness -du 0 -dv 0 -pw 4 -ps 1; //"Medium" displaySmoothness -du 1 -dv 1 -pw 8 -ps 2; //"Fine" displaySmoothness -du 2 -dv 2 -pw 16 -ps 4; int $smoothness[] = `displaySmoothness -q -du -dv -pw -ps $mainObject`; int $isFull[] = `displaySmoothness -q -full $mainObject`; int $isHull[] = `displaySmoothness -q -hull $mainObject`; if (size($smoothness) == 0) { //Is not a Nurbs/Subdiv surface $result = $na; } else if ($isHull[0]) { //Is Hull $result = $hull; } else if ($smoothness[0] == 0 && $smoothness[1] == 0 && $smoothness[2] == 4 && $smoothness[3] == 1 && $isFull[0]) { //Is Rough $result = $rough; } else if ($smoothness[0] == 1 && $smoothness[1] == 1 && $smoothness[2] == 8 && $smoothness[3] == 2 && $isFull[0]) { //Is Medium $result = $medium; } else if ($smoothness[0] == 2 && $smoothness[1] == 2 && $smoothness[2] == 16 && $smoothness[3] == 4 && $isFull[0]) { //Is Fine $result = $fine; } else { //Is Custom $result = $custom; } $hasResult = true; } else if ($aSelectedSubdivSurfaceExists && $isValid) { //Subdiv Surface // //"Hull" subdivDisplaySmoothness -s 0; //"Rough" subdivDisplaySmoothness -s 1; //"Medium" subdivDisplaySmoothness -s 2; //"Fine" subdivDisplaySmoothness -s 3; int $smoothness[] = `subdivDisplaySmoothness -q $mainObject`; switch ($smoothness[0]) { case 0: $result = $hull; case 1: $result = $rough; case 2: $result = $medium; case 3: $result = $fine; default: $result = $custom; } $hasResult = true; } } if (!$hasResult) { //No selected objects or no selected objects of valid type $result = $na; } return $result; } global proc string objectDetailsInstance() { string $result; int $hasResult = false; string $selectedObjects[] = `ls -sl`; string $mainObject; int $aSelectedObjectExists = 0; if (size($selectedObjects) > 0) { $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ]; $aSelectedObjectExists = 1; } string $yes = (uiRes("m_initHUDScripts.kHUDInstanceYes")); string $no = (uiRes("m_initHUDScripts.kHUDInstanceNo")); string $na = (uiRes("m_initHUDScripts.kHUDInstanceNA")); if ($aSelectedObjectExists) { string $mainShape[] = `listRelatives -fullPath -s $mainObject`; if (size($mainShape)) { string $mainShapeParents[] = `listRelatives -ap $mainShape[0]`; if (size($mainShapeParents) > 1) { $result = $yes; } else { $result = $no; } $hasResult = true; } } if (!$hasResult) { //No selected objects $result = $na; } return $result; } global proc string objectDetailsDisplayLayer() { string $result; int $hasResult = false; string $selectedObjects[] = `ls -sl -o`; string $mainObject; int $aSelectedObjectExists = 0; if (size($selectedObjects) > 0) { $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ]; $aSelectedObjectExists = 1; } if ($aSelectedObjectExists) { if (`objExists ($mainObject + ".drawOverride")`) { string $layerDrawInfo = `connectionInfo -sfd ($mainObject + ".drawOverride")`; //Now tokenize the layerDrawInfo string string $layerStringArray[]; int $numTokens = `tokenize $layerDrawInfo "." $layerStringArray`; if (`objExists $layerStringArray[0]`) { $result = $layerStringArray[0]; } else { $result = (uiRes("m_initHUDScripts.kHUDLayerDefault")); } $hasResult = true; } } if (!$hasResult) { $result = (uiRes("m_initHUDScripts.kHUDLayerNA")); } return $result; } global proc int objectDetailsNumberOfSelectedObjects() { string $selectedObjects[] = `ls -sl -o`; int $nSelectedObjects = size($selectedObjects); return $nSelectedObjects; } proc int numberOfParticles () { int $numParticles = 0; string $allParticleNodes[] = `ls -type "particle"`; // do not include nCloth or nRigid verts in the count for ($node in $allParticleNodes) { if (`nodeType $node` == "nParticle" ||`nodeType $node` == "particle" ) $numParticles += `getAttr ($node + ".count")`; } return $numParticles; } proc int numberOfCurrentParticles (){ int $numParticles = 0; string $selection[] = `ls -sl -o`; for ($sel in $selection){ string $childNodes[] = `listRelatives -ad -type "particle" $sel`; for ($child in $childNodes){ if (`nodeType $child` == "nParticle" ||`nodeType $child` == "particle" ) $numParticles += `getAttr ($child + ".count")`; } } return $numParticles; } global proc string getParticleCount() { return (numberOfParticles () + " " + numberOfCurrentParticles ()); } global proc string subdDetailsCurrentLevel() { global int $gSelectSubdivSurface; string $selectedObjects[] = `ls -sl -o`; int $nSelectedObjects = size($selectedObjects); string $subdivSurfaces[] = `filterExpand -ex true -sm $gSelectSubdivSurface $selectedObjects`; if (size($subdivSurfaces) > 0) { // take last item on selection list string $subd = $subdivSurfaces[ (size($subdivSurfaces) - 1)]; // check for proxy mode. If it is, don't display current level int $proxy = `subdiv -q -proxyMode $subd`; if($proxy != 1) { string $level = `subdiv -q -currentSubdLevel $subd`; return $level; } } // no subd selected return (uiRes("m_initHUDScripts.kHUDLevelNA")); } global proc string subdDetailsCurrentMode() { global int $gSelectSubdivSurface; string $selectedObjects[] = `ls -sl -o`; int $nSelectedObjects = size($selectedObjects); string $subdivSurfaces[] = `filterExpand -ex true -sm $gSelectSubdivSurface $selectedObjects`; if (size($subdivSurfaces) > 0) { // take last item on selection list string $subd = $subdivSurfaces[ (size($subdivSurfaces) - 1)]; int $proxy = `subdiv -q -proxyMode $subd`; if(1 == $proxy) { return (uiRes("m_initHUDScripts.kHUDModePolyProx")); } else { return (uiRes("m_initHUDScripts.kHUDModeStandard")); } } // no subd selected return (uiRes("m_initHUDScripts.kHUDModeNA")); } //Toggle methods // global proc setObjectDetailsVisibility(int $visibility) { if (`headsUpDisplay -ex HUDObjDetBackfaces`) { headsUpDisplay -e -vis $visibility HUDObjDetBackfaces; } if (`headsUpDisplay -ex HUDObjDetSmoothness`) { headsUpDisplay -e -vis $visibility HUDObjDetSmoothness; } if (`headsUpDisplay -ex HUDObjDetInstance`) { headsUpDisplay -e -vis $visibility HUDObjDetInstance; } if (`headsUpDisplay -ex HUDObjDetDispLayer`) { headsUpDisplay -e -vis $visibility HUDObjDetDispLayer; } if (`headsUpDisplay -ex HUDObjDetDistFromCam`) { headsUpDisplay -e -vis $visibility HUDObjDetDistFromCam; } if (`headsUpDisplay -ex HUDObjDetNumSelObjs`) { headsUpDisplay -e -vis $visibility HUDObjDetNumSelObjs; } //Update the respective menu item and optionVar menuItem -e -cb $visibility objectDetailsItem; optionVar -iv "objectDetailsVisibility" $visibility; } global proc setPolyCountVisibility(int $visibility) { if (`headsUpDisplay -ex HUDPolyCountVerts`) { headsUpDisplay -e -vis $visibility HUDPolyCountVerts; } if (`headsUpDisplay -ex HUDPolyCountEdges`) { headsUpDisplay -e -vis $visibility HUDPolyCountEdges; } if (`headsUpDisplay -ex HUDPolyCountFaces`) { headsUpDisplay -e -vis $visibility HUDPolyCountFaces; } if (`headsUpDisplay -ex HUDPolyCountTriangles`) { headsUpDisplay -e -vis $visibility HUDPolyCountTriangles; } if (`headsUpDisplay -ex HUDPolyCountUVs`) { headsUpDisplay -e -vis $visibility HUDPolyCountUVs; } //Update the respective menu item and optionVar menuItem -e -cb $visibility polyCountItem; optionVar -iv "polyCountVisibility" $visibility; } global proc setParticleCountVisibility(int $visibility) { if (`headsUpDisplay -ex HUDParticleCount`) { headsUpDisplay -e -vis $visibility HUDParticleCount; } if (`headsUpDisplay -ex HUDParticleCount`) { headsUpDisplay -e -vis $visibility HUDParticleCount; } //Update the respective menu item and optionVar menuItem -e -cb $visibility particleCountItem; optionVar -iv "particleCountVisibility" $visibility; } global proc setSubdDetailsVisibility(int $visibility) { if (`headsUpDisplay -ex HUDSubdLevel`) { headsUpDisplay -e -vis $visibility HUDSubdLevel; } if (`headsUpDisplay -ex HUDSubdMode`) { headsUpDisplay -e -vis $visibility HUDSubdMode; } //Update the respective menu item and optionVar menuItem -e -cb $visibility subdDetailsItem; optionVar -iv "subdDetailsVisibility" $visibility; } global proc setViewportRendererVisibility(int $visibility) { if (`headsUpDisplay -ex HUDViewportRenderer`) { headsUpDisplay -e -vis $visibility HUDViewportRenderer; } //Update the respective menu item and optionVar menuItem -e -cb $visibility viewportRendererItem; optionVar -iv "viewportRendererVisibility" $visibility; } global proc setSymmetryVisibility(int $visibility) { if (`headsUpDisplay -ex HUDSymmetry`) { headsUpDisplay -e -vis $visibility HUDSymmetry; } //Update the respective menu item and optionVar menuItem -e -cb $visibility symmetryItem; optionVar -iv "symmetryVisibility" $visibility; } global proc setCapsLockVisibility(int $visibility) { if (`headsUpDisplay -ex HUDCapsLock`) { headsUpDisplay -e -vis $visibility HUDCapsLock; } //Update the respective menu item and optionVar menuItem -e -cb $visibility capsLockItem; optionVar -iv "capsLockVisibility" $visibility; } global proc setCameraNamesVisibility(int $visibility) { if (`headsUpDisplay -ex HUDCameraNames`) { headsUpDisplay -e -vis $visibility HUDCameraNames; } //Update the respective menu item and optionVar menuItem -e -cb $visibility cameraNamesItem; optionVar -iv "cameraNamesVisibility" $visibility; } global proc setFocalLengthVisibility(int $visibility) { if (`headsUpDisplay -ex HUDFocalLength`) { headsUpDisplay -e -vis $visibility HUDFocalLength; } //Update the respective menu item and optionVar menuItem -e -cb $visibility focalLengthItem; optionVar -iv "focalLengthVisibility" $visibility; } global proc setFrameRateVisibility(int $visibility) { if (`headsUpDisplay -ex HUDFrameRate`) { headsUpDisplay -e -vis $visibility HUDFrameRate; } //Update the respective menu item and optionVar menuItem -e -cb $visibility frameRateItem; optionVar -iv "frameRateVisibility" $visibility; } global proc ToggleMaterialLoadingDetailsHUDVisibility(int $visibility) { if (`headsUpDisplay -ex HUDLoadingMaterials`) { headsUpDisplay -e -vis $visibility HUDLoadingMaterials; } if (`headsUpDisplay -ex HUDLoadingTextures`) { headsUpDisplay -e -vis $visibility HUDLoadingTextures; } //Update the respective menu item and optionVar menuItem -e -cb $visibility materialLoadingDetailsItem; optionVar -iv "materialLoadingDetailsVisibility" $visibility; } global proc setCurrentFrameVisibility(int $visibility) { if (`headsUpDisplay -ex HUDCurrentFrame`) { headsUpDisplay -e -vis $visibility HUDCurrentFrame; } //Update the respective menu item and optionVar menuItem -e -cb $visibility currentFrameItem; optionVar -iv "currentFrameVisibility" $visibility; } global proc setSceneTimecodeVisibility(int $visibility) { if (`headsUpDisplay -ex HUDSceneTimecode`) { headsUpDisplay -e -vis $visibility HUDSceneTimecode; } //Update the respective menu item and optionVar menuItem -e -cb $visibility sceneTimecodeItem; optionVar -iv "sceneTimecodeVisibility" $visibility; } global proc setCurrentContainerVisibility(int $visibility) { if (`headsUpDisplay -ex HUDCurrentContainer`) { headsUpDisplay -e -vis $visibility HUDCurrentContainer; } //Update the respective menu item and optionVar menuItem -e -cb $visibility currentContainerItem; optionVar -iv "currentContainerVisibility" $visibility; } global proc setViewAxisVisibility(int $visibility) { if (`headsUpDisplay -ex HUDViewAxis`) { headsUpDisplay -e -vis $visibility HUDViewAxis; } //Update the respective menu item and optionVar menuItem -e -cb $visibility viewAxisItem; optionVar -iv "viewAxisVisibility" $visibility; } global proc setHikDetailsVisibility(int $visibility) { if (`headsUpDisplay -ex HUDHikKeyingMode`) { headsUpDisplay -e -vis $visibility HUDHikKeyingMode; } optionVar -iv "hikDetailsVisibility" $visibility; } global proc setSelectDetailsVisibility(int $visibility) { if (`headsUpDisplay -ex HUDSoftSelectState`) { headsUpDisplay -e -vis $visibility HUDSoftSelectState; } optionVar -iv "selectDetailsVisibility" $visibility; if (`menuItem -q -exists selectDetailsItem`) menuItem -e -cb $visibility selectDetailsItem; } global proc setAnimationDetailsVisibility(int $visibility) { if (`headsUpDisplay -ex HUDIKSolverState`) { headsUpDisplay -e -vis $visibility HUDIKSolverState; } if (`headsUpDisplay -ex HUDCurrentCharacter`) { headsUpDisplay -e -vis $visibility HUDCurrentCharacter; } if (`headsUpDisplay -ex HUDPlaybackSpeed`) { headsUpDisplay -e -vis $visibility HUDPlaybackSpeed; } // Begin scriptJob to force update of animated ikSolver states. // global int $gHUDupdateIKScriptJobExists = 0; global int $gHUDupdateIKScriptJob = 0; if( $visibility ) { if( !$gHUDupdateIKScriptJobExists ) { if( `headsUpDisplay -exists HUDIKSolverState` ) { $gHUDupdateIKScriptJob = `scriptJob -event timeChanged "headsUpDisplay -refresh HUDIKSolverState"`; $gHUDupdateIKScriptJobExists = 1; } } } else { if( $gHUDupdateIKScriptJobExists ) { catch( `scriptJob -kill $gHUDupdateIKScriptJob` ); } $gHUDupdateIKScriptJob = 0; $gHUDupdateIKScriptJobExists = 0; } // // End scriptJob to force update of animated ikSolver states. //Update the respective menu item and optionVar menuItem -e -cb $visibility animationDetailsItem; optionVar -iv "animationDetailsVisibility" $visibility; } global proc setToolMessageVisibility(int $visibility) { // Update the respective menu item and optionVar if( `menuItem -exists toggleToolMessageVisibility` ){ menuItem -edit -checkBox $visibility toggleToolMessageVisibility; } optionVar -intValue "toolMessageVisible" $visibility; } global proc string animationDetailsIKFK() // // Description: // Returns a string describing the solver enable state of the // selected joint chains. // // There are five different returned strings: // "None Selected" : No joints or ikHandles are selected. // "On" : The selected items have their solver enabled. // "Off" : The selected items have their solver disabled. // "No Solver" : No solver on the selcted joints. // "Mixed" : Some of the selected items have their solvers // enabled and others have their solvers disabled. // { int $lastMenuSwitchState = `optionVar -q ikFKSwitchState`; // There are five different returned values from ikFKSolverState() // 0 : No joints or ikHandles are selected. // 1 : The selected items have their solver enabled. // 2 : The selected items have their solver disabled. // 3 : No solver on the selcted joints. // 4 : Some of the selected items have their solvers // enabled and others have their solvers disabled. // int $solverState = ikFKSolverState(`ls -sl`); string $mixed = (uiRes("m_initHUDScripts.kHUDIkFkMixed")); string $off = (uiRes("m_initHUDScripts.kHUDIkFkOff")); string $noSolver = (uiRes("m_initHUDScripts.kHUDIkFkNoSolver")); string $result; switch ($solverState) { case 1: float $blendValue = ikFkBlendValue(`ls -sl`); if ($blendValue > 0.0) { $result = $blendValue; } else { $result = $mixed; } if (on != $lastMenuSwitchState && `exists updateIKFKCheckBox`) { updateIKFKCheckBox(on); } break; case 2: $result = $off; if (off != $lastMenuSwitchState && `exists updateIKFKCheckBox`) { updateIKFKCheckBox(off); } break; case 3: $result = $noSolver; break; case 4: $result = $mixed; if (!$lastMenuSwitchState && `exists updateIKFKCheckBox`) { updateIKFKCheckBox(on); } break; case 0: default: $result = $noSolver; break; } return $result; } global proc string animationDetailsCurrentCharacter() { string $text = (uiRes("m_initHUDScripts.kHUDNoCharacter")); string $currentCharacters[] = currentCharacters(); int $size = size( $currentCharacters ); if ( $size > 0 ) { if ( $size == 1 ) { $text = $currentCharacters[0]; } else { $text = (uiRes("m_initHUDScripts.kHUDMultipleCharacter")); } } return $text; } global proc string fbikDetailsKeyType() { string $keyTypeSimple = (uiRes("m_initHUDScripts.kHUDFbikKeyTypeSimple")); string $keyTypeIK = (uiRes("m_initHUDScripts.kHUDFbikKeyTypeIK")); string $keyTypeFK = (uiRes("m_initHUDScripts.kHUDFbikKeyTypeFK")); if (!`optionVar -exists fbikKeyOption`) { //3 == simple key optionVar -intValue fbikKeyOption 3; } if(`optionVar -q fbikKeyOption` == 1) { return $keyTypeIK; } else if(`optionVar -q fbikKeyOption` == 2) { return $keyTypeFK; } else { return $keyTypeSimple; } } global proc string hikDetailsKeyingMode() { string $keyModeAll = (uiRes("m_initHUDScripts.kHUDHikKeyModeFullBody")); string $keyModeBodyPart = (uiRes("m_initHUDScripts.kHUDHikKeyModeBodyPart")); string $keyModeSelected = (uiRes("m_initHUDScripts.kHUDHikKeyModeSelected")); if (!`optionVar -exists keyFullBody`) { optionVar -intValue keyFullBody 1; } if (`optionVar -query keyFullBody` == 1) { return $keyModeAll; } else if(`optionVar -query keyFullBody` == 2) { return $keyModeBodyPart; } else { return $keyModeSelected; } } global proc string animationDetailsPlaybackSpeed() { string $text = (uiRes("m_initHUDScripts.kHUDSpeedNA")); float $speed = `playbackOptions -q -playbackSpeed`; string $unit = `currentUnit -q -time`; float $fps = 0; if( $unit == "game" ) { $fps = 15; } else if( $unit == "film" ) { $fps = 24; } else if( $unit == "pal" ) { $fps = 25; } else if( $unit == "ntsc" ) { $fps = 30; } else if( $unit == "show" ) { $fps = 48; } else if( $unit == "palf" ) { $fps = 50; } else if( $unit == "ntscf" ) { $fps = 60; } if (equivalent($speed,0.0)) { $text = (uiRes("m_initHUDScripts.kHUDSpeedEvery")); $text += " "; } else if (equivalent($speed,0.5)) { $text = (uiRes("m_initHUDScripts.kHUDSpeedHalf")); $text += " "; } else if (equivalent($speed,1.0)) { $text = (uiRes("m_initHUDScripts.kHUDSpeedReal")); } else if (equivalent($speed,2.0)) { $text = (uiRes("m_initHUDScripts.kHUDSpeedTwice")); $text += " "; } else { $text = (uiRes("m_initHUDScripts.kHUDSpeedOther")); $text += " "; } string $fpsStr = (uiRes("m_initHUDScripts.kHUDSpeedFPS")); float $rate = $fps * $speed; if (!equivalent($rate, 0.0)) { $text += ( " [" + ($rate) + " " + $fpsStr + "]" ); } return $text; } global proc updateCurrentCharacterHUD() // // Description: // The global proc to update the current character HUD. // { // This will update the display for the character field. // if (`headsUpDisplay -ex HUDCurrentCharacter`) { headsUpDisplay -refresh HUDCurrentCharacter; } } global proc updatePlaybackSpeedHUD() { if (`headsUpDisplay -ex HUDPlaybackSpeed`) { headsUpDisplay -refresh HUDPlaybackSpeed; } } global proc updateSubdHUD() { if (`headsUpDisplay -ex HUDSubdMode`) { headsUpDisplay -refresh HUDSubdMode; } if (`headsUpDisplay -ex HUDSubdLevel`) { headsUpDisplay -refresh HUDSubdLevel; } } global proc updateParticleHUD() { if (`headsUpDisplay -ex HUDParticleCount`) { headsUpDisplay -refresh HUDParticleCount; } } // //Poly Display Settings procs // global proc setPolyDisplayLimitedToSelected(){ int $value = `optionVar -q polyDisplayLimitedToSelectedOV`; optionVar -iv "polyDisplayLimitedToSelectedOV" (!$value); $value = !$value; } global proc setPolyDisplayBackCulling(int $type){ int $value; if ($type == 1){ $value = `optionVar -q polyDisplayVertexBackfaceCulling`; optionVar -iv "polyDisplayVertexBackfaceCulling" (!$value); toggleSurfaceBackfaceCulling(); }else if ($type == 2){ $value = `optionVar -q polyDisplayWireBackfaceCulling`; optionVar -iv "polyDisplayWireBackfaceCulling" (!$value); if (!$value){ optionVar -iv "polyDisplayHardEdgeBackfaceCulling" ($value); } updateCullingOptions(); toggleSurfaceBackfaceCulling(); }else{ $value = `optionVar -q polyDisplayHardEdgeBackfaceCulling`; optionVar -iv "polyDisplayHardEdgeBackfaceCulling" (!$value); if (!$value){ optionVar -iv "polyDisplayWireBackfaceCulling" ($value); } updateCullingOptions(); toggleSurfaceBackfaceCulling(); } } global proc updateCullingOptions(){ if (`menuItem -exists toggleKeepWireBackCullingItem`){ menuItem -edit -checkBox `optionVar -q polyDisplayWireBackfaceCulling` toggleKeepWireBackCullingItem; } if (`menuItem -exists toggleKeepHardEdgesCullingItem`){ menuItem -edit -checkBox `optionVar -q polyDisplayHardEdgeBackfaceCulling` toggleKeepHardEdgesCullingItem; } } global proc setPolygonDisplaySettings(string $option){ //Get what is selected at time of call string $oldSelection[] = `ls -sl`; //Get the affects constraint int $constraintValue = `optionVar -q polyDisplayLimitedToSelectedOV`; if(!$constraintValue){ //if it is global, select all polys select -cl; select `ls -type "mesh"`; } //Main process block, checks what display option is to be toggled //and execute the corresponding command if ($option == "vertexCulling"){ setPolyDisplayBackCulling(1); } else if ($option == "keepWire"){ setPolyDisplayBackCulling(2); } else if ($option == "keepHardEdge"){ setPolyDisplayBackCulling(3); } else if ($option == "culling"){ toggleSurfaceBackfaceCulling(); } else if ($option == "fNormal"){ toggleNormalDisplay("face"); } else if ($option == "vNormal"){ toggleNormalDisplay("vertex"); } else if ($option == "vertexSize"){ dispWindow("VertSz"); } else if ($option == "uvSize"){ dispWindow("UVSz"); } else if ($option == "normalSize"){ dispWindow("NormSz"); } else if ($option == "tangent"){ toggleTangentDisplay(); } else if ($option == "dispEdge"){ polyOptions -allEdges -activeObjects; } else if ($option == "dispSoftEdge"){ polyOptions -softEdge -activeObjects; } else if ($option == "dispHardEdge"){ polyOptions -hardEdge -activeObjects; } else if ($option == "dispHardEdgeColor"){ polyOptions -hardEdgeColor -activeObjects; } else if ($option == "reset"){ polyOptions -activeObjects -allEdges -sizeBorder 3 -displayBorder 0 -displayCreaseEdge 0 -displayCreaseVertex 0 -displayTangent 0 -displayMapBorder 0 -displayVertex 0 -displayNormal 0 -facet -displayCenter 0 -displayTriangle 0 -displayWarp 0 -displayInvisibleFaces 1 -displayItemNumbers 0 0 0 0 -sizeNormal 0.4 -sizeVertex 3.0 -sizeUV 4.0 -backCulling -displayUVs 0 -displayUVTopology 0 -colorShadedDisplay 0 -colorMaterialChannel diffuse -backCullVertex 1; } else if ($option == "verts"){ polyOptions -r -activeObjects -dv true; } else if ($option == "borderEdge"){ polyOptions -r -activeObjects -db true; } else if ($option == "creaseEdge"){ polyOptions -r -dce 1 -activeObjects; } else if ($option == "creaseVertex"){ polyOptions -r -dcv 1 -activeObjects; } else if ($option == "textBorderEdge"){ polyOptions -r -dmb 1 -activeObjects; } else if ($option == "edgeWidth"){ dispWindow("EdgeSz"); } else if ($option == "faceCenter"){ polyOptions -r -dc true -activeObjects; } else if ($option == "faceTriangles"){ polyOptions -r -dt 1 -activeObjects; } else if ($option == "nonPlanar"){ polyNonPlanarFaceDisplay; } else if ($option == "invisibleFaces"){ polyOptions -r -dif 1 -activeObjects; } else if ($option == "UVs"){ polyOptions -activeObjects -r -duv true; } else if ($option == "unsharedUVs"){ polyOptions -r -uvt true -activeObjects; } else if ($option == "vertIDs"){ polyOptions -r -din 1 0 0 0 -activeObjects; } else if ($option == "edgeIDs"){ polyOptions -r -din 0 1 0 0 -activeObjects; } else if ($option == "faceIDs"){ polyOptions -r -din 0 0 1 0 -activeObjects; } else if ($option == "compIDs"){ polyOptions -r -din 0 0 0 1 -activeObjects; } else if ($option == "vertMetadata"){ polyOptions -r -dmt 1 0 0 -activeObjects; } else if ($option == "edgeMetadata"){ polyOptions -r -dmt 0 1 0 -activeObjects; } else if ($option == "faceMetadata"){ polyOptions -r -dmt 0 0 1 -activeObjects; } //If selected call put selection back to what it was before if(!$constraintValue){ //put back the old selection select -clear; select $oldSelection; } } //Need seperate proc for getting the optionVar at each point in the change of the slider global proc setVertexSize(){ int $constraintValue = `optionVar -q polyDisplayLimitedToSelectedOV`; if ($constraintValue){ polyOptions -activeObjects -sizeVertex `floatSliderGrp -query -value vertexSizeSlider`; } else { polyOptions -global -sizeVertex `floatSliderGrp -query -value vertexSizeSlider`; } } //Need seperate proc for getting the optionVar at each point in the change of the slider global proc setUVSize(){ int $constraintValue = `optionVar -q polyDisplayLimitedToSelectedOV`; if ($constraintValue){ polyOptions -activeObjects -sizeUV `floatSliderGrp -query -value uvSizeSlider`; } else { polyOptions -global -sizeUV `floatSliderGrp -query -value uvSizeSlider`; } } //Need seperate proc for getting the optionVar at each point in the change of the slider global proc setNormalSize(){ int $constraintValue = `optionVar -q polyDisplayLimitedToSelectedOV`; if ($constraintValue){ polyOptions -activeObjects -sizeNormal `floatSliderGrp -query -value normalsSizeSlider`; } else { polyOptions -global -sizeNormal `floatSliderGrp -query -value normalsSizeSlider`; } } //Need seperate proc for getting the optionVar at each point in the change of the slider global proc setEdgeWidth(){ int $constraintValue = `optionVar -q polyDisplayLimitedToSelectedOV`; if ($constraintValue){ polyOptions -activeObjects -sizeBorder `floatSliderGrp -query -value edgeSizeSlider`; } else { polyOptions -global -sizeBorder `floatSliderGrp -query -value edgeSizeSlider`; } } global proc setWalkModeVisibility(int $walkModeHudState) { if (`headsUpDisplay -ex HUDWalkMode`) { if( $walkModeHudState == 0 ) headsUpDisplay -e -vis 0 HUDWalkMode; else if($walkModeHudState == 1) headsUpDisplay -e -vis 1 -label (uiRes("m_initHUDScripts.kHUDWalkModeLabel")) HUDWalkMode; else if($walkModeHudState == 2) headsUpDisplay -e -vis 1 -label (uiRes("m_initHUDScripts.kHUDWalkCrouchModeLabel")) HUDWalkMode; } } global proc setHUDBlendShapeEdit(int $visible, string $name) { if (`headsUpDisplay -ex HUDActiveSculptMesh`) { if( $visible == 0 ) { headsUpDisplay -e -vis 0 HUDBlendShapeEdit; } else { string $hudLabel = (uiRes("m_initHUDScripts.kBlendShapeEdit")); $hudLabel += $name; headsUpDisplay -e -vis 1 -label $hudLabel HUDBlendShapeEdit; } } } global proc setHUDActiveSculptMesh(int $visible, string $name) { if (`headsUpDisplay -ex HUDActiveSculptMesh`) { if( $visible == 0 ) { headsUpDisplay -e -vis 0 HUDActiveSculptMesh; } else { string $hudLabel = (uiRes("m_initHUDScripts.kSculptMeshLabel")); $hudLabel += $name; headsUpDisplay -e -vis 1 -label $hudLabel HUDActiveSculptMesh; } } } global proc setHUD3DCutSewUVActiveMesh(int $visible, string $name) { if (`headsUpDisplay -ex HUD3DCutSewUVActiveMesh`) { if( $visible == 0 ) { headsUpDisplay -e -vis 0 HUD3DCutSewUVActiveMesh; } else { string $hudLabel = (uiRes("m_initHUDScripts.kCutSewMeshLabel")); $hudLabel += $name; headsUpDisplay -e -vis 1 -label $hudLabel HUD3DCutSewUVActiveMesh; } } }