// =========================================================================== // 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. // =========================================================================== source hyperViewer; source containerOperations.mel; // Enable/Disable the HG horiz/vert layout Controls, only valid with // hierarchical layout style global proc enableHGOrientationControls (string $editor, int $enable) { if (`menuItem -exists ($editor + "MenuOrientCascade")`) { menuItem -edit -enable ( $enable ) ($editor + "MenuOrientCascade"); } if (`menuItem -exists ($editor + "PopupOrientCascade")`) { menuItem -edit -enable ( $enable ) ($editor + "PopupOrientCascade"); } } // // Options // // Executing the actual commands for the chosen options as well as // all checking to keep the option menus and the buttons in sync // global proc checkUpdateSubMenu(string $value, string $collectionName, string $editor) { int $cbState; if ($collectionName == "Menu") { switch ($value) { case "selection": $cbState = `menuItem -q -cb MenuUpdateSelectionItem`; hyperGraph -edit -updateSelection $cbState $editor; if (`menuItem -exists PopupUpdateSelectionItem`) { menuItem -e -cb $cbState PopupUpdateSelectionItem; } optionVar -intValue hypergraphUpdateSelection $cbState; break; case "node": $cbState = `menuItem -q -cb MenuUpdateNodeAddedItem`; hyperGraph -edit -updateNodeAdded $cbState $editor; if (`menuItem -exists PopupUpdateNodeAddedItem`) { menuItem -e -cb $cbState PopupUpdateNodeAddedItem; } optionVar -intValue hypergraphUpdateNodeAdded $cbState; break; } } else if ($collectionName == "Popup") { switch ($value) { case "selection": $cbState = `menuItem -q -cb PopupUpdateSelectionItem`; hyperGraph -edit -updateSelection $cbState $editor; if (`menuItem -exists MenuUpdateSelectionItem`) { menuItem -e -cb $cbState MenuUpdateSelectionItem; } optionVar -intValue hypergraphUpdateSelection $cbState; break; case "node": $cbState = `menuItem -q -cb PopupUpdateNodeAddedItem`; hyperGraph -edit -updateNodeAdded $cbState $editor; if (`menuItem -exists MenuUpdateNodeAddedItem`) { menuItem -e -cb $cbState MenuUpdateNodeAddedItem; } optionVar -intValue hypergraphUpdateNodeAdded $cbState; break; } } } // // Options // // Executing the actual commands for the chosen options as well as // all checking to keep the option menus and the buttons in sync // global proc checkShowSubMenu(string $value, string $collectionName, string $editor) { int $cbState; if ($collectionName == "Menu") { switch ($value) { case "shape": $cbState = `menuItem -q -cb MenuShapeNodesItem`; hyperGraph -edit -showShapes $cbState $editor; if (`menuItem -exists PopupShapeNodesItem`) { menuItem -e -cb $cbState PopupShapeNodesItem; } optionVar -intValue hypergraphDisplayShapeNodes $cbState; break; case "invisible": $cbState = `menuItem -q -cb MenuInvisibleNodesItem`; hyperGraph -edit -showInvisible $cbState $editor; if (`menuItem -exists PopupInvisibleNodesItem`) { menuItem -e -cb $cbState PopupInvisibleNodesItem; } optionVar -intValue hypergraphDisplayInvisibleNodes $cbState; break; case "expressions": $cbState = `menuItem -q -cb MenuExpressionsItem`; hyperGraph -edit -showExpressions $cbState $editor; if (`menuItem -exists PopupExpressionsItem`) { menuItem -e -cb $cbState PopupExpressionsItem; } optionVar -intValue hypergraphDisplayExpressions $cbState; break; case "constraints": $cbState = `menuItem -q -cb MenuConstraintsItem`; hyperGraph -edit -showConstraints $cbState $editor; if (`menuItem -exists PopupConstraintsItem`) { menuItem -e -cb $cbState PopupConstraintsItem; } optionVar -intValue hypergraphDisplayConstraints $cbState; break; case "deformers": $cbState = `menuItem -q -cb MenuDeformersItem`; hyperGraph -edit -showDeformers $cbState $editor; if (`menuItem -exists PopupDeformersItem`) { menuItem -e -cb $cbState PopupDeformersItem; } optionVar -intValue hypergraphDisplayDeformers $cbState; break; case "underworld": $cbState = `menuItem -q -cb MenuUnderworldItem`; hyperGraph -edit -showUnderworld $cbState $editor; if (`menuItem -exists PopupDeformersItem`) { menuItem -e -cb $cbState PopupUnderworldItem; } optionVar -intValue hypergraphDisplayUnderworldNodes $cbState; break; } } if ($collectionName == "Popup") { switch ($value) { case "shape": $cbState = `menuItem -q -cb PopupShapeNodesItem`; hyperGraph -edit -showShapes $cbState $editor; if (`menuItem -exists MenuShapeNodesItem`) { menuItem -e -cb $cbState MenuShapeNodesItem; } optionVar -intValue hypergraphDisplayShapeNodes $cbState; break; case "invisible": $cbState = `menuItem -q -cb PopupInvisibleNodesItem`; hyperGraph -edit -showInvisible $cbState $editor; if (`menuItem -exists MenuInvisibleNodesItem`) { menuItem -e -cb $cbState MenuInvisibleNodesItem; } optionVar -intValue hypergraphDisplayInvisibleNodes $cbState; break; case "expressions": $cbState = `menuItem -q -cb PopupExpressionsItem`; hyperGraph -edit -showExpressions $cbState $editor; if (`menuItem -exists MenuExpressionsItem`) { menuItem -e -cb $cbState MenuExpressionsItem; } optionVar -intValue hypergraphDisplayExpressions $cbState; break; case "constraints": $cbState = `menuItem -q -cb PopupConstraintsItem`; hyperGraph -edit -showConstraints $cbState $editor; if (`menuItem -exists MenuConstraintsItem`) { menuItem -e -cb $cbState MenuConstraintsItem; } optionVar -intValue hypergraphDisplayConstraints $cbState; break; case "deformers": $cbState = `menuItem -q -cb PopupDeformersItem`; hyperGraph -edit -showDeformers $cbState $editor; if (`menuItem -exists MenuDeformersItem`) { menuItem -e -cb $cbState MenuDeformersItem; } optionVar -intValue hypergraphDisplayDeformers $cbState; break; case "underworld": $cbState = `menuItem -q -cb PopupUnderworldItem`; hyperGraph -edit -showUnderworld $cbState $editor; if (`menuItem -exists MenuUnderworldItem`) { menuItem -e -cb $cbState MenuUnderworldItem; } optionVar -intValue hypergraphDisplayUnderworldNodes $cbState; break; } } } // If we are in DAG mode then all three options should be present // If we are in DG mode then only horiz/vert options should be present global proc checkOrientCollection(string $value, string $editor) { // Styles for DG layout. eg. stymmetric, tree, orthoganal, ... string $layoutStyle =`hyperGraph -q -graphLayoutStyle $editor`; // value will be one of, 'vert', 'horiz' or 'schematic' string $orient =`hyperGraph -q -orientation $editor`; // DG or DAG string $graphType = `hyperGraph -query -graphType $editor`; // if DAG style or DG style and in hierachical layout if ( ( $graphType == "DAG" ) || ( ( $graphType == "DG" ) && ( $layoutStyle == "hierarchicalLayout" ) ) ) { if ($value == "horiz") { hyperGraph -edit -orientation horiz $editor; checkFreeformCollection( "On" , $editor); } if ($value == "vert") { hyperGraph -edit -orientation vert $editor; checkFreeformCollection( "On" , $editor); } } // Only if DAG style ... if ( ($graphType == "DAG") && ($value == "schematic") ) { hyperGraph -edit -orientation schematic $editor; checkFreeformCollection( "Off" , $editor); } if (`radioMenuItemCollection -exists ($editor + "OrientMenuCollection")`) { menuItem -edit -rb ( $value == "horiz" ) ($editor+"MenuHorizItem"); menuItem -edit -rb ( $value == "vert" ) ($editor+"MenuVertItem"); if( $graphType == "DG" ) { menuItem -edit -rb 0 ($editor+"MenuSchematicItem"); } else { menuItem -edit -rb ( $value == "schematic" ) ($editor+"MenuSchematicItem"); } } if (`radioMenuItemCollection -exists ($editor + "OrientPopupCollection")`) { menuItem -edit -rb ( $value == "horiz" ) ($editor+"PopupHorizItem"); menuItem -edit -rb ( $value == "vert" ) ($editor+"PopupVertItem"); if( $graphType == "DG" ) { menuItem -edit -rb 0 ($editor+"PopupSchematicItem"); } else { menuItem -edit -rb ( $value == "schematic" ) ($editor+"PopupSchematicItem"); } } } global proc checkFreeformCollection(string $value, string $editor) { if ($value == "On"){ hyperGraph -e -freeform true $editor; iconTextCheckBox -edit -i1 "freeformOn.png" ($editor+"freeformButton"); optionVar -iv hypergraphFreeform 1; enableHGLayoutControls( $editor, 1 ); string $graphType = `hyperGraph -q -graphType $editor`; string $layoutStyle =`hyperGraph -q -graphLayoutStyle $editor`; if ( ( $graphType == "DAG" ) || ( ( $graphType == "DG" ) && ( $layoutStyle == "hierarchicalLayout" ) ) ) { enableHGOrientationControls( $editor, 1 ); } else { enableHGOrientationControls( $editor, 0 ); } } else { hyperGraph -e -freeform false $editor; iconTextCheckBox -edit -i1 "freeformOff.png" ($editor+"freeformButton"); optionVar -iv hypergraphFreeform 0; enableHGLayoutControls( $editor, 0 ); enableHGOrientationControls( $editor, 1 ); } int $freeform = `hyperGraph -q -freeform $editor`; if (`radioMenuItemCollection -exists ($editor + "FreeformMenuCollection")`) { menuItem -edit -rb ( $freeform ) MenuFreeformOnItem; menuItem -edit -rb ( !$freeform ) MenuFreeformOffItem; } if (`radioMenuItemCollection -exists ($editor + "FreeformPopupCollection")`) { menuItem -edit -rb ( $freeform ) PopupFreeformOnItem; menuItem -edit -rb ( !$freeform ) PopupFreeformOffItem; } iconTextCheckBox -edit -value ( $freeform ) ($editor+"freeformButton"); } global proc checkFramesMenuItems ( string $editor ) { menuItem -e -cb (`hyperGraph -q -animateTransition $editor`) animateTransitions; int $at = `hyperGraph -q -animateTransition $editor`; if (`radioMenuItemCollection -exists ($editor + "FramesMenuCollection")`) { menuItem -e -enable ( $at ) MenuFrame5Item; menuItem -e -enable ( $at ) MenuFrame10Item; menuItem -e -enable ( $at ) MenuFrame15Item; menuItem -e -enable ( $at ) MenuFrame20Item; } if (`radioMenuItemCollection -exists ($editor + "FramesPopupCollection")`) { menuItem -e -enable ( $at ) PopupFrame5Item; menuItem -e -enable ( $at ) PopupFrame10Item; menuItem -e -enable ( $at ) PopupFrame15Item; menuItem -e -enable ( $at ) PopupFrame20Item; } } global proc checkAnimateTransitions ( string $editor ) { if (`hyperGraph -q -animateTransition $editor`) { hyperGraph -e -animateTransition false $editor; } else { hyperGraph -e -animateTransition true $editor; } checkFramesMenuItems $editor; } global proc checkFramesCollection (int $value, string $editor ) { hyperGraph -e -transitionFrames $value $editor; int $trans = `hyperGraph -q -transitionFrames $editor`; if (`radioMenuItemCollection -exists ($editor + "FramesMenuCollection")`) { menuItem -e -rb ( $trans == 5) MenuFrame5Item; menuItem -e -rb ( $trans == 10) MenuFrame10Item; menuItem -e -rb ( $trans == 15) MenuFrame15Item; menuItem -e -rb ( $trans == 20) MenuFrame20Item; } if (`radioMenuItemCollection -exists ($editor + "FramesPopupCollection")`) { menuItem -e -rb ( $trans == 5) PopupFrame5Item; menuItem -e -rb ( $trans == 10) PopupFrame10Item; menuItem -e -rb ( $trans == 15) PopupFrame15Item; menuItem -e -rb ( $trans == 20) PopupFrame20Item; } } global proc confirmResetFreeform(string $editor) { string $yes = (uiRes("m_HyperGraphEdMenu.kYesReset")); string $no = (uiRes("m_HyperGraphEdMenu.kNoReset")); string $value = `confirmDialog -title (uiRes("m_HyperGraphEdMenu.kConfirm")) -message (uiRes("m_HyperGraphEdMenu.kConfirmResetMsg")) -messageAlign "center" -button $yes -button $no -cancelButton $no -defaultButton $yes`; if ($value == $yes) { hyperGraph -e -resetFreeform $editor; } } global proc confirmClear(string $editor) { string $noClear = (uiRes("m_HyperGraphEdMenu.kNoClear")); string $yesClear = (uiRes("m_HyperGraphEdMenu.kYesClear")); string $value = `confirmDialog -title (uiRes("m_HyperGraphEdMenu.kConfirmClear")) -message (uiRes("m_HyperGraphEdMenu.kConfirmClearMsg")) -messageAlign "center" -button $yesClear -button $noClear -cancelButton $noClear -defaultButton $yesClear `; if ($value == $yesClear) { hyperGraph -e -clear $editor; } } global proc int loadImageCallback ( string $editor, string $theFile) { // Optional retaining of the new directory. string $currentDir = `workspace -q -dir`; hyperGraph -e -image $theFile $editor; hyperGraph -e -imageEnabled true $editor; adjustImageForView($editor, "fitToHeight"); return 1; } global proc loadImage(string $editor) { string $okButtonCaption = (uiRes("m_HyperGraphEdMenu.kLoadNoDots")); string $windowCaption = (uiRes("m_HyperGraphEdMenu.kLoadImage")); $myWorkspace = `workspace -q -fn`; setWorkingDirectory($myWorkspace, "image", "images"); string $cmd = ("fileDialog2 -caption \"" + $windowCaption + "\""); $cmd += (" -fileMode 1 "); $cmd += (" -okCaption \"" + $okButtonCaption + "\""); $cmd += (" -fileFilter \""); $cmd += buildPixmapFileFilterList(); $cmd += ("\""); string $file[] = `eval $cmd`; if( size($file) > 0 && $file[0] != "" ) { string $path = fromNativePath($file[0]); loadImageCallback($editor,$path); } } // Description: This procedure adjusts position and scale of the hypergraph // background image for the given editor based on current view. // global proc adjustImageForView(string $editor, string $operation) { if($operation == "fitToWidth") { hyperGraph -edit -fitImageToWidth $editor; } else if($operation == "fitToHeight") { hyperGraph -edit -fitImageToHeight $editor; } else { return; } updateImageWindowControls($editor); hyperGraph -edit -forceRefresh $editor; } // Description: This procedure adjusts position of the hypergraph // background image for the given editor. // global proc adjustImagePosition(string $editor, float $pos, string $direction) { float $curPos[] = `hyperGraph -query -imagePosition $editor`; float $posX, $posY; if($direction == "vertical") { $posX = $curPos[0]; $posY = $pos; } else { $posX = $pos; $posY = $curPos[1]; } hyperGraph -edit -imagePosition $posX $posY $editor; hyperGraph -edit -forceRefresh $editor; } // Description: This procedure adjusts the scale of the hypergraph // background image for the given editor. // global proc adjustImageScale(string $editor, float $newScale) { if ($newScale <= 0) { return; } hyperGraph -edit -imageScale $newScale $editor; hyperGraph -edit -forceRefresh $editor; } global proc updateImageWindowControls(string $editor) { string $windowName = $editor+"AdjustImageWindow"; string $imageName = `hyperGraph -query -image $editor`; float $imageScale = `hyperGraph -query -imageScale $editor`; float $imagePos[] = `hyperGraph -query -imagePosition $editor`; int $enable = size($imageName); textFieldButtonGrp -edit -fileName $imageName ($windowName + "imageNameField"); floatSliderGrp -edit -value $imagePos[0] -enable $enable ($windowName + "adjustImageHPositionSlider"); floatSliderGrp -edit -value $imagePos[1] -enable $enable ($windowName + "adjustImageVPositionSlider"); floatSliderGrp -edit -value $imageScale -enable $enable ($windowName + "adjustImageScaleSlider"); button -edit -enable $enable ($windowName + "adjustImageFitToWidthButton"); button -edit -enable $enable ($windowName + "adjustImageFitToHeightButton"); } // Description: This procedure is called to open a window to // adjust the background image's parameters. // global proc adjustImageWindow(string $editor) { string $windowName = $editor+"AdjustImageWindow"; if (`window -exists $windowName`) { showWindow $windowName; return; } // Get the current image name. // string $imageName = `hyperGraph -query -image $editor`; // Get the current position value. // float $imagePosition[] = `hyperGraph -query -imagePosition $editor`; // Get the current $imageScaling value. // float $imageScaling = `hyperGraph -query -imageScale $editor`; // The window does not exist. Create it. // window -resizeToFitChildren true -title (uiRes("m_HyperGraphEdMenu.kAdjustImage")) $windowName; formLayout topFormLayout; columnLayout -rowSpacing 10 topColumnLayout; textFieldButtonGrp -label (uiRes("m_HyperGraphEdMenu.kImageName")) -fileName $imageName -editable false -buttonLabel (uiRes("m_HyperGraphEdMenu.kLoad")) -buttonCommand ("loadImage " + $editor) ($windowName + "imageNameField"); floatSliderGrp -label (uiRes("m_HyperGraphEdMenu.kHorizontalPosition")) -field on -min ($imagePosition[0]- (1000.0 * $imageScaling)) -max ($imagePosition[0]+(1000.0 * $imageScaling)) -precision 2 -value $imagePosition[0] -dragCommand ("adjustImagePosition " + $editor + " #1 " + "horizontal") -changeCommand ("adjustImagePosition " + $editor + " #1 " + "horizontal") ($windowName + "adjustImageHPositionSlider"); floatSliderGrp -label (uiRes("m_HyperGraphEdMenu.kVerticalPosition")) -field on -min ($imagePosition[1] -1000.0 * $imageScaling) -max ($imagePosition[1] + 1000.0 * $imageScaling) -precision 2 -value $imagePosition[1] -dragCommand ("adjustImagePosition " + $editor + " #1 " + "vertical") -changeCommand ("adjustImagePosition " + $editor + " #1 " + "vertical") ($windowName + "adjustImageVPositionSlider"); floatSliderGrp -label (uiRes("m_HyperGraphEdMenu.kScale")) -field 1 -min 0.01 -max ($imageScaling *10.0) -fieldMaxValue ($imageScaling *100.0) -precision 2 -value $imageScaling -dragCommand ("adjustImageScale "+$editor+" #1") -changeCommand ("adjustImageScale "+$editor+" #1") ($windowName + "adjustImageScaleSlider"); setParent ..; button -label (uiRes("m_HyperGraphEdMenu.kFitToWidth")) -command ("adjustImageForView " + $editor + " \"fitToWidth\"") ($windowName + "adjustImageFitToWidthButton"); button -label (uiRes("m_HyperGraphEdMenu.kFitToHeight")) -command ("adjustImageForView " + $editor + " \"fitToHeight\"") ($windowName + "adjustImageFitToHeightButton"); formLayout -edit -attachForm topColumnLayout "left" 5 -attachForm topColumnLayout "top" 5 -attachForm topColumnLayout "right" 5 -attachNone topColumnLayout "bottom" -attachForm ($windowName + "adjustImageFitToWidthButton") "left" 5 -attachControl ($windowName + "adjustImageFitToWidthButton") "top" 10 topColumnLayout -attachPosition ($windowName + "adjustImageFitToWidthButton") "right" 5 50 -attachNone ($windowName + "adjustImageFitToWidthButton") "bottom" -attachControl ($windowName + "adjustImageFitToHeightButton") "left" 5 ($windowName + "adjustImageFitToWidthButton") -attachControl ($windowName + "adjustImageFitToHeightButton") "top" 10 topColumnLayout -attachForm ($windowName + "adjustImageFitToHeightButton") "right" 5 -attachNone ($windowName + "adjustImageFitToHeightButton") "bottom" topFormLayout; updateImageWindowControls($editor); showWindow $windowName; } global proc buildHyperContainerMenu( string $editor, string $parent ) // // Description: // Builds the Hypergraph->Edit->Container submenu. // { setParent -m $parent; menu -edit -deleteAllItems $parent; // Using uiRes rather than L10N as these are the same as hypershade, and the icons menuItem -label (uiRes("m_HyperGraphEdMenu.kCreateAssetWithTransform")) -annotation (getRunTimeCommandAnnotation("CreateDagContainer")) -allowOptionBoxes true -command CreateDagContainer; menuItem -optionBox true -annotation (getRunTimeCommandAnnotation("CreateDagContainerOptions")) -c CreateDagContainerOptions; menuItem -label (uiRes("m_HyperGraphEdMenu.kAdvancedAssets")) -subMenu true -tearOff true -allowOptionBoxes true; menuItem -label (uiRes("m_HyperGraphEdMenu.kCreate")) -annotation (getRunTimeCommandAnnotation("CreateContainer")) -allowOptionBoxes true -dmc "performCreateContainer 2" -command CreateContainer; menuItem -optionBox true -annotation (getRunTimeCommandAnnotation("CreateContainerOptions")) -c CreateContainerOptions; menuItem -label (uiRes("m_HyperGraphEdMenu.kPublishParentAnchor")) -allowOptionBoxes false -annotation( getRunTimeCommandAnnotation("PublishParentAnchor")) -c PublishParentAnchor; menuItem -optionBox true -annotation (getRunTimeCommandAnnotation("PublishParentAnchorOptions")) -c PublishParentAnchorOptions; menuItem -label (uiRes("m_HyperGraphEdMenu.kPublishChildAnchor")) -allowOptionBoxes false -annotation( getRunTimeCommandAnnotation("PublishChildAnchor")) -c PublishChildAnchor; menuItem -optionBox true -annotation (getRunTimeCommandAnnotation("PublishChildAnchorOptions")) -c PublishChildAnchorOptions; menuItem -label (uiRes("m_HyperGraphEdMenu.kUnpublishParent")) -allowOptionBoxes false -annotation( getRunTimeCommandAnnotation("UnpublishParentAnchor")) -c UnpublishParentAnchor; menuItem -label (uiRes("m_HyperGraphEdMenu.kUnpublishChild")) -allowOptionBoxes false -annotation( getRunTimeCommandAnnotation("UnpublishChildAnchor")) -c UnpublishChildAnchor; string $sccSubmenu = ` menuItem -label (uiRes("m_HyperGraphEdMenu.kSetCurrentAsset")) -annotation (uiRes("m_HyperGraphEdMenu.kSetCurrentAssetAnnot")) -sm true setCurrentContainerItem`; setParent -menu ..; menu -e -pmc ("buildSetContainerMenu \"" + $sccSubmenu + "\"") setCurrentContainerItem; setParent -menu ..; menuItem -label (uiRes("m_HyperGraphEdMenu.kTransferAttrValues")) -allowOptionBoxes true -annotation (getRunTimeCommandAnnotation("TransferAttributeValues")) -c TransferAttributeValues; menuItem -optionBox true -annotation (getRunTimeCommandAnnotation("TransferAttributeValuesOptions")) -c TransferAttributeValuesOptions; menuItem -label (uiRes("m_HyperGraphEdMenu.kPublishConnections")) -annotation (getRunTimeCommandAnnotation("PublishConnections")) -c PublishConnections; menuItem -label (uiRes("m_HyperGraphEdMenu.kRemoveAsset")) -command ("unpackAndRemoveContainer(`ls -sl -containers`)") -annotation (uiRes("m_HyperGraphEdMenu.kRemoveAssetAnnot")) removeContainerItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kCollapseAsset")) -command ("hyperGraph -edit -collapseContainer " + $editor) -annotation (uiRes("m_HyperGraphEdMenu.kCollapseAssetAnnot")) collapseContainerItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kExpandAsset")) -command ("hyperGraph -edit -expandContainer " + $editor) -annotation (uiRes("m_HyperGraphEdMenu.kExpandAssetAnnot")) expandContainerItem; } // // Menus // // Create the different menus, but only create them when they are needed // (dynamically build menus), and hook them up. // create and destroy the RMB menu as soon as you hit two different hit areas // the hyperPanel background and a node create different menus. // The menuItem creation is used by the popupMenu as well as the menuBarLayout. // global proc buildHyperEditMenu(string $editor, string $parent ) { setParent -m $parent; if (`menu -query -numberOfItems $parent` != 0) { checkHGControls $editor; return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kRename")) RenameItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kCollapse")) FoldAllItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kExpand")) UnfoldSelectedItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kExpandAll")) UnfoldAllItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowSelected")) UnfoldHiddenItem; menuItem -divider true; // Next is the Container submenu. // string $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kAsset")) -subMenu true -allowOptionBoxes true ($editor+"ContainerCascade")`; menuItem -edit -postMenuCommand ("buildHyperContainerMenu " + $editor + " " + $menuItem) $menuItem; setParent -menu ..; menuItem -divider true; // Then the rest of the stuff // menuItem -label (uiRes("m_HyperGraphEdMenu.kResetFreeformLayout")) ResetFreeformItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kClearView")) ClearViewItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kAttributes")) SingleAttrEditorItem; checkHGControls $editor; // // hook ups for the EditMenuItems // menuItem -edit -c ("hyperGraph -e -rename " + $editor) RenameItem; menuItem -edit -c ("hyperGraph -e -fold " + $editor) FoldAllItem; menuItem -edit -c ("hyperGraph -e -unfold " + $editor) UnfoldSelectedItem; menuItem -edit -c ("hyperGraph -e -unfoldAllShapes " + $editor) UnfoldAllItem; menuItem -edit -c ("hyperGraph -e -unfoldHidden " + $editor) UnfoldHiddenItem; menuItem -edit -c ("confirmResetFreeform " + $editor) ResetFreeformItem; menuItem -edit -c ("confirmClear " + $editor) ClearViewItem; menuItem -edit -c ("hyperGraph -e -attributeEditor single " + $editor) SingleAttrEditorItem; } global proc buildHyperViewMenu (string $editor, string $parent) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { checkHGControls $editor; return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kPreviousView")) previousViewItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kNextView")) nextViewItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrameAll")) ZoomOutItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrameSelection")) frameSelectionItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrameHierarchy")) frameHierarchyItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrameBranch")) frameBranchItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kSetBackgroundImage")) adjustImageItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowBackgroundImage")) -checkBox off showImageItem; checkHGControls $editor; // // hook up the ViewMenuItems // menuItem -edit -c ("hyperGraph -e -previousView " + $editor) previousViewItem; menuItem -edit -c ("hyperGraph -e -nextView " + $editor) nextViewItem; menuItem -edit -c ("FrameSelected") frameSelectionItem; menuItem -edit -c ("FrameAll") ZoomOutItem; menuItem -edit -c ("hyperGraph -e -frameHierarchy " + $editor) frameHierarchyItem; menuItem -edit -c ("hyperGraph -e -frameBranch " + $editor) frameBranchItem; menuItem -edit -c ("adjustImageWindow " + $editor) adjustImageItem; menuItem -edit -c ("hyperGraph -e -imageEnabled #1 " + $editor + ";optionVar -intValue hypergraphDisplayImage #1") showImageItem; } global proc buildHyperNavigateMenu(string $editor, string $parent) { int $dimWhenNoSelect = 0; setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kSceneHierarchy")) navHomeItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kInputAndOutputConnections")) allConnectionsItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kInputConnections")) upstreamItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kOutputConnections")) downstreamItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kLayout")) DoLayoutItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kRebuild")) RebuildItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kIncreaseDepthTraversal")) incrDTItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kDecreaseDepthTraversal")) decrDTItem; // // hook up all the NavigateMenuItems // menuItem -edit -c ("hyperGraph -e -navigateHome " + $editor + "; " + "checkHGControls " + $editor) navHomeItem; menuItem -edit -c ("hyperGraph -e -down " + $editor + "; " + "checkHGControls " + $editor + "; ") allConnectionsItem; menuItem -edit -c ("hyperGraph -e -upstream " + $editor + "; " + "checkHGControls " + $editor + "; ") upstreamItem; menuItem -edit -c ("hyperGraph -e -downstream " + $editor + "; " + "checkHGControls " + $editor + "; " ) downstreamItem; menuItem -edit -c ("hyperGraph -e -layout " + $editor + "; " ) DoLayoutItem; menuItem -edit -c ("hyperGraph -e -rebuild " + $editor) RebuildItem; menuItem -edit -c ("hyperGraphDepthControl 1") incrDTItem; menuItem -edit -c ("hyperGraphDepthControl -1") decrDTItem; checkHGControls $editor; if ($dimWhenNoSelect) { dimWhen -f "SomethingSelected" allConnectionsItem; dimWhen -f "SomethingSelected" upstreamItem; dimWhen -f "SomethingSelected" downstreamItem; } } global proc checkInterestingNodeName ( string $nodeType, string $editor ) { if ($nodeType == "renderPartition"){ string $renderPartitionName = `renderPartition -q`; hyperGraph -e -dn $renderPartitionName $editor; hyperGraph -e -frameGraph $editor; } else { string $nodeTypeNames[] = `ls -type $nodeType`; hyperGraph -e -dn $nodeTypeNames[0] $editor; hyperGraph -e -frameGraph $editor; } } global proc buildHyperRenderingMenu(string $editor, string $parent) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kShowShadingGroups")) showShadGroupItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowMaterials")) showShadersItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowTextures")) showTexturesItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowLights")) showLightsItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kCreateRenderNode")) createRendNodeItem; // // Hook up all the RenderingMenuItems // menuItem -edit -c ("checkInterestingNodeName renderPartition " + $editor + ";checkHGControls " + $editor) showShadGroupItem; menuItem -edit -c ("checkInterestingNodeName defaultShaderList " + $editor + ";checkHGControls " + $editor) showShadersItem; menuItem -edit -c ("checkInterestingNodeName defaultTextureList " + $editor + ";checkHGControls " + $editor) showTexturesItem; menuItem -edit -c ("checkInterestingNodeName lightList " + $editor + ";checkHGControls " + $editor) showLightsItem; menuItem -edit -c ("createRenderNode \"-all\" \"\" \"\" ") createRendNodeItem; } global proc buildHyperShowSubMenu( string $editor, string $parent, string $collectionName) // // Description: // Build the contents of the Options > Display menu. // { setParent -menu $parent; // Check if the menu items have already been created. // if (`menu -query -numberOfItems $parent` != 0) { return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kShapeNodes")) -checkBox `hyperGraph -query -showShapes $editor` ($collectionName + "ShapeNodesItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kHiddenNodes")) -checkBox `hyperGraph -query -showInvisible $editor` ($collectionName + "InvisibleNodesItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kUnderworldNodes")) -checkBox `hyperGraph -query -showUnderworld $editor` ($collectionName + "UnderworldItem"); menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kExpressionConnections")) -checkBox `hyperGraph -query -showExpressions $editor` ($collectionName + "ExpressionsItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kConstraintConnections")) -checkBox `hyperGraph -query -showConstraints $editor` ($collectionName + "ConstraintsItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kDeformerConnections")) -checkBox `hyperGraph -query -showDeformers $editor` ($collectionName + "DeformersItem"); menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowCachedConnections")) -checkBox `hyperGraph -query -showCachedConnections $editor` ($collectionName + "CachedConnectionItem"); string $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kFilterConnect")) -subMenu true FilterCascade`; menuItem -edit -postMenuCommand ("buildHyperFilterSubMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; // Edits to the above menu items... // menuItem -edit -command ("checkShowSubMenu shape " + $collectionName + " " + $editor) ($collectionName + "ShapeNodesItem"); menuItem -edit -command ("checkShowSubMenu underworld " + $collectionName + " " + $editor) ($collectionName + "UnderworldItem"); menuItem -edit -command ("checkShowSubMenu invisible " + $collectionName + " " + $editor) ($collectionName + "InvisibleNodesItem"); menuItem -edit -command ("checkShowSubMenu expressions " + $collectionName + " " + $editor) ($collectionName + "ExpressionsItem"); menuItem -edit -command ("checkShowSubMenu constraints " + $collectionName + " " + $editor) ($collectionName + "ConstraintsItem"); menuItem -edit -command ("checkShowSubMenu deformers " + $collectionName + " " + $editor) ($collectionName + "DeformersItem"); } global proc buildHyperUpdateSubMenu(string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kOnSelection")) -cb `hyperGraph -q -updateSelection $editor` ($collectionName + "UpdateSelectionItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kOnNodesCreation")) -cb `hyperGraph -q -updateNodeAdded $editor` ($collectionName + "UpdateNodeAddedItem"); menuItem -edit -c ("checkUpdateSubMenu selection " + $collectionName + " " + $editor) ($collectionName + "UpdateSelectionItem"); menuItem -edit -c ("checkUpdateSubMenu node " + $collectionName + " " + $editor) ($collectionName + "UpdateNodeAddedItem"); } global proc buildHyperGraphLayoutStyleSubMenu(string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } string $GraphLayoutStyleCollection = ($editor + "GraphLayoutStyle" + $collectionName + "Collection"); radioMenuItemCollection $GraphLayoutStyleCollection; string $layoutStyle =`hyperGraph -q -graphLayoutStyle $editor`; menuItem -label (uiRes("m_HyperGraphEdMenu.kCircularLayout")) -rb ( $layoutStyle == "circularLayout") ($editor + $collectionName + "CircularLayoutItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kHierarchicalLayout")) -rb ( $layoutStyle == "hierarchicalLayout") ($editor + $collectionName + "HierarchicalLayoutItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kOrthogonalLayout")) -rb ( $layoutStyle == "orthogonalLayout") ($editor + $collectionName + "OrthogonalLayoutItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kSymetricLayout")) -rb ( $layoutStyle == "symmetricLayout") ($editor + $collectionName + "SymmetricLayoutItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kTreeLayout")) -rb ( $layoutStyle == "treeLayout") ($editor + $collectionName + "TreeLayoutItem"); menuItem -edit -c ("checkGraphLayoutStyleCollection CircularLayout " + $editor) ($editor + $collectionName + "CircularLayoutItem"); menuItem -edit -c ("checkGraphLayoutStyleCollection HierarchicalLayout " + $editor) ($editor + $collectionName + "HierarchicalLayoutItem"); menuItem -edit -c ("checkGraphLayoutStyleCollection OrthogonalLayout " + $editor) ($editor + $collectionName + "OrthogonalLayoutItem"); menuItem -edit -c ("checkGraphLayoutStyleCollection SymmetricLayout " + $editor) ($editor + $collectionName + "SymmetricLayoutItem"); menuItem -edit -c ("checkGraphLayoutStyleCollection TreeLayout " + $editor) ($editor + $collectionName + "TreeLayoutItem"); } global proc buildHyperOrientationSubMenu(string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } string $orientCollection = ($editor + "Orient" + $collectionName + "Collection"); string $orient = `hyperGraph -q -orientation $editor`; radioMenuItemCollection $orientCollection; menuItem -label (uiRes("m_HyperGraphEdMenu.kHorizontal")) -rb ( $orient == "horiz") ($editor + $collectionName + "HorizItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kVertical")) -rb ( $orient == "vert") ($editor + $collectionName + "VertItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kSchematic")) -rb ( $orient == "schematic") ($editor + $collectionName + "SchematicItem"); menuItem -edit -command ("checkOrientCollection horiz " + $editor) ($editor + $collectionName + "HorizItem"); menuItem -edit -command ("checkOrientCollection vert " + $editor) ($editor + $collectionName + "VertItem"); menuItem -edit -command ("checkOrientCollection schematic " + $editor) ($editor + $collectionName + "SchematicItem"); } global proc buildHyperLayoutSubMenu(string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } string $freeformCollection = ($editor + "Freeform" + $collectionName + "Collection"); int $freeform = `hyperGraph -q -freeform $editor`; radioMenuItemCollection $freeformCollection; menuItem -label (uiRes("m_HyperGraphEdMenu.kFreeformLayout")) -rb ( $freeform ) ($collectionName + "FreeformOnItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kAutomaticLayout")) -rb ( !$freeform ) ($collectionName + "FreeformOffItem"); // // Hook up the LayoutSubMenuItems // menuItem -edit -c ("checkFreeformCollection On " + $editor) ($collectionName + "FreeformOnItem"); menuItem -edit -c ("checkFreeformCollection Off " + $editor) ($collectionName + "FreeformOffItem"); } global proc updateFilterConnFromMenu(string $editor, string $name) { // defaults to show all int $toFrom = `menuItem -q -rb ($name + "FilterShowToFromItem")`; int $to = `menuItem -q -rb ($name + "FilterShowToItem")`; int $from = `menuItem -q -rb ($name + "FilterShowFromItem")`; setFilterSettings( $editor, $name, ($toFrom || $from), ($toFrom || $to)); } global proc setFilterSettings(string $editor, string $name, int $from, int $to) { hyperGraph -edit -showConnectionFromSelected $from $editor; hyperGraph -edit -showConnectionToSelected $to $editor; if ($name != "Menu") updateFilterMenu($editor, "Menu"); if ($name != "Popup") updateFilterMenu($editor, "Popup"); } global proc updateFilterMenu(string $editor, string $name) { // get the current set of the editor int $from = `hyperGraph -q -showConnectionFromSelected $editor`; int $to = `hyperGraph -q -showConnectionToSelected $editor`; // set the option variables optionVar -intValue hypergraphSelectedFromConnection $from; optionVar -intValue hypergraphSelectedToConnection $to; if (`menuItem -exists ($name+"FilterShowToFromItem")`) { menuItem -edit -rb ($to && $from ) ($name+"FilterShowToFromItem"); } if (`menuItem -exists ($name+"FilterShowToItem")`) { menuItem -edit -rb ($to && !$from ) ($name+"FilterShowToItem"); } if (`menuItem -exists ($name+"FilterShowFromItem")`) { menuItem -edit -rb (!$to && $from ) ($name+"FilterShowFromItem"); } if (`menuItem -exists ($name+"FilterShowAllItem")`) { menuItem -edit -rb (!$to && !$from ) ($name+"FilterShowAllItem"); } } global proc toggleConstraintLabels(string $editor) { int $show = `hyperGraph -query -showConstraintLabels $editor`; hyperGraph -e -showConstraintLabels (!$show) $editor; } global proc toggleExpressConn(string $editor) { int $show = `hyperGraph -query -showExpressions $editor`; hyperGraph -e -showExpressions (!$show) $editor; } global proc toggleConstrConn(string $editor) { int $show = `hyperGraph -query -showConstraints $editor` ; hyperGraph -e -showConstraints (!$show) $editor; } global proc toggleDeformConn(string $editor) { int $show = `hyperGraph -query -showDeformers $editor`; hyperGraph -e -showDeformers (!$show) $editor; } global proc buildHyperFilterSubMenu(string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { return; } int $from = `hyperGraph -query -showConnectionFromSelected $editor`; int $to = `hyperGraph -query -showConnectionToSelected $editor`; string $filterCollection = ($editor + "Filter" + $collectionName + "Collection"); string $cmd = "updateFilterConnFromMenu " + $editor + " "+ $collectionName; radioMenuItemCollection $filterCollection; menuItem -label (uiRes("m_HyperGraphEdMenu.kFilterShowAll")) -rb (!$from && !$to) -c ($cmd) ($collectionName + "FilterShowAllItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kFilterToFrom")) -rb ($from && $to) -c ($cmd) ($collectionName + "FilterShowToFromItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kFilterTo")) -rb (!$from && $to) -c ($cmd) ($collectionName + "FilterShowToItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kFilterFrom")) -rb ($from && !$to) -c ($cmd) ($collectionName + "FilterShowFromItem"); } global proc buildHyperTransitionsSubMenu (string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { checkFramesMenuItems $editor; return; } string $framesCollection = ($editor + "Frames" + $collectionName + "Collection"); menuItem -label (uiRes("m_HyperGraphEdMenu.kAnimateTransitions")) -cb (`hyperGraph -q -animateTransition $editor`) animateTransitions; string $trans = `hyperGraph -q -transitionFrames $editor`; menuItem -divider true frameNumCascade; radioMenuItemCollection $framesCollection; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrames5")) -rb ( $trans == 5) ($collectionName + "Frame5Item"); menuItem -label (uiRes("m_HyperGraphEdMenu.kFrames10")) -rb ( $trans == 10) ($collectionName + "Frame10Item"); menuItem -label (uiRes("m_HyperGraphEdMenu.kFrames15")) -rb ( $trans == 15) ($collectionName + "Frame15Item"); menuItem -label (uiRes("m_HyperGraphEdMenu.kFrames20")) -rb ( $trans == 20) ($collectionName + "Frame20Item"); setParent -m ..; // // Hook up the TransitionSubMenuItems // menuItem -edit -c ("checkAnimateTransitions " + $editor ) animateTransitions; menuItem -edit -c ("checkFramesCollection 5 " + $editor) ($collectionName + "Frame5Item"); menuItem -edit -c ("checkFramesCollection 10 " + $editor) ($collectionName + "Frame10Item"); menuItem -edit -c ("checkFramesCollection 15 " + $editor) ($collectionName + "Frame15Item"); menuItem -edit -c ("checkFramesCollection 20 " + $editor) ($collectionName + "Frame20Item"); checkFramesMenuItems $editor; } global proc heatMapSelect() // Description: // Places the hottest nodes on the selection list. This allows the // user to easily identify them. The selection cutoff textfield is used // for determining minimum heat value to take. Note the cutoff is // proportionate to the min/max threshold, e.g. if the threshold is 20,70 // and the cutoff is 90 percent, we will take all nodes in the range 65 // to 70 percent of the highest timing value. // { // Get the cutoff value. // Get the threshold min/max. Assume 0/100 if disabled. // float $f[] = `floatFieldGrp -q -v heatMapCutoff`; float $cutoff = $f[0]; float $lower = 0.0; float $upper = 100.0; int $how = `checkBoxGrp -q -v1 heatMapThreshold`; if ( !$how ) { $how = `checkBoxGrp -q -v2 heatMapThreshold`; } if ( $how ) { $upper = `floatSliderGrp -q -v heatMapThresholdUpper`; $lower = `floatSliderGrp -q -v heatMapThresholdLower`; } int $i = `optionVar -q heatMapMetric`; string $metric = `convert2TimerMetric( $i )`; $i = `optionVar -q heatMapType`; string $type = `convert2TimerType( $i )`; // Trim the lower limit by the cutoff. The idea is to always // select the top entries in the threshold range. // $lower = $cutoff * 0.01 * ( $upper - $lower ) + $lower; // Use dgtimer to determine the nodes that are in range. // We need to process the data line-by-line, so we save it // to a temp file and process. We select each node by adding // to the selection list which we cleared earlier. // string $tmp = ( `internalVar -userTmpDir` + "heatMap.tmp" ); dgtimer -nh -un -sortMetric $metric -sortType $type -rangeLower $lower -rangeUpper $upper -outputFile $tmp -query; int $fileId = `fopen $tmp "r"`; select -clear; while ( !`feof $fileId` ) { string $nextLine = `fgetline $fileId`; if ( !`feof $fileId` ) { string $args[] = stringToStringArray( $nextLine, " " ); string $node = $args[8]; if ( "" != $node ) { select -add $node; } } } fclose $fileId; sysFile -delete $tmp; } global proc toggleHeatMapDisplay(string $editor, string $parent) // Description: // Method to be called when the heat map setting is toggled. // { // Update the pref, so that the next HG we create has the same state, // and this state also gets saved to file. // int $enable = `menuItem -q -checkBox $parent`; optionVar -intValue heatMapDisplay $enable; // Set the state on this HG. // hyperGraph -e -heatMapDisplay $enable $editor; // Update the heat map display for this HG. // updateHeatMapDisplay( $enable, $editor ); } global proc updateHeatMapTiming() // Description: // Updates the GLOBAL hypergraph heat map timing mode. // { int $how = `dgtimer -q -on`; if ( $how ) { dgtimer -off; } else { dgtimer -on; } } global proc updateHeatMapThreshold( int $changed ) // Description: // Updates the heat map display threshold. // // Parameters: // int $changed: (in) 0 if the Threshold toggle changed. // 1 if the upper threshold slider changed. // 2 if the lower threshold slider changed. // { global float $gHeatMapMax; // Update dimming of the threshold sliders. // If "remap" or "hide" are selected, undim the threshold sliders. // int $how = `checkBoxGrp -q -v1 heatMapThreshold`; if ( !$how ) { $how = `checkBoxGrp -q -v2 heatMapThreshold`; } floatSliderGrp -e -enable $how heatMapThresholdUpper; floatSliderGrp -e -enable $how heatMapThresholdLower; // Ensure the lower bound stays below the upper bound. // if ( $how ) { float $upper = `floatSliderGrp -q -v heatMapThresholdUpper`; float $lower = `floatSliderGrp -q -v heatMapThresholdLower`; if ( $upper < $lower ) { if ( $changed == 1 ) { floatSliderGrp -e -v $upper heatMapThresholdLower; } else if ( $changed == 2 ) { floatSliderGrp -e -v $lower heatMapThresholdUpper; } } } // Update all HyperGraph windows. // doHeatMapUpdate( true ); } global proc string convert2TimerMetric( int $metric ) // Description: // Deciphers the heatMapMetric optionVar value into a string. // { switch ( $metric ) { case 1: return( "callback" ); case 2: return( "compute" ); case 3: return( "dirty" ); case 4: return( "draw" ); } return( "" ); } global proc string convert2TimerType( int $type ) // Description: // Deciphers the heatMapType optionVar value into a string. // { switch ( $type ) { case 1: return( "self" ); case 2: return( "inclusive" ); case 3: return( "count" ); } return( "" ); } global proc heatMapControls() // Description: // Display the heat map options panel. These are GLOBAL settings // which affect all hypegraph windows which have heat map display mode // enabled. // { // If the window does not exist, create it. Note that the window is // shared amongst all Hypergraphs. // if (!`window -exists heatMapControlWindow`){ string $title = (uiRes("m_HyperGraphEdMenu.kHeatMapControls")); window -title $title -iconName $title -resizeToFitChildren true -menuBar true -minimizeButton true -maximizeButton false heatMapControlWindow; columnLayout -columnAttach "both" 0 -columnWidth 400; frameLayout -label (uiRes("m_HyperGraphEdMenu.kDisplayTimingValues")); columnLayout; optionMenuGrp -label (uiRes("m_HyperGraphEdMenu.kMetric")) -changeCommand "optionVar -iv heatMapMetric `optionMenuGrp -query -select heatMapMetric`;doHeatMapUpdate(false)" -annotation (uiRes("m_HyperGraphEdMenu.kMetricAnnot")) -columnAlign 1 "right" heatMapMetric; menuItem -label (uiRes("m_HyperGraphEdMenu.kCallback")); menuItem -label (uiRes("m_HyperGraphEdMenu.kCompute")); menuItem -label (uiRes("m_HyperGraphEdMenu.kDirty")); menuItem -label (uiRes("m_HyperGraphEdMenu.kDraw")); optionMenuGrp -label (uiRes("m_HyperGraphEdMenu.kType")) -changeCommand "optionVar -iv heatMapType `optionMenuGrp -query -select heatMapType`;doHeatMapUpdate(false)" -annotation (uiRes("m_HyperGraphEdMenu.kTypeAnnot")) -columnAlign 1 "right" heatMapType; menuItem -label (uiRes("m_HyperGraphEdMenu.kSelf")); menuItem -label (uiRes("m_HyperGraphEdMenu.kInclusive")); menuItem -label (uiRes("m_HyperGraphEdMenu.kCount")); checkBoxGrp -ncb 2 -vertical -label (uiRes("m_HyperGraphEdMenu.kThreshold")) -label1 (uiRes("m_HyperGraphEdMenu.kThreshold1")) -label2 (uiRes("m_HyperGraphEdMenu.kThreshold2")) -annotation (uiRes("m_HyperGraphEdMenu.kThresholdAnnot")) -changeCommand "updateHeatMapThreshold(0)" heatMapThreshold; floatSliderGrp -label (uiRes("m_HyperGraphEdMenu.kThresholdUpper")) -value 100.0 -field true -enable false -fieldMinValue 0.0 -fieldMaxValue 100.0 -changeCommand "updateHeatMapThreshold(1)" -annotation (uiRes("m_HyperGraphEdMenu.kThresholdUpperAnnot")) heatMapThresholdUpper; floatSliderGrp -label (uiRes("m_HyperGraphEdMenu.kThresholdLower")) -value 0.0 -field true -enable false -fieldMinValue 0.0 -fieldMaxValue 100.0 -changeCommand "updateHeatMapThreshold(2)" -annotation (uiRes("m_HyperGraphEdMenu.kThresholdLowerAnnot")) heatMapThresholdLower; setParent ..; setParent ..; string $form, $grp, $but; frameLayout -label (uiRes("m_HyperGraphEdMenu.kSelectionTool")); $form = `formLayout`; $grp = `floatFieldGrp -label (uiRes("m_HyperGraphEdMenu.kCutoff")) -value1 90.0 -annotation (uiRes("m_HyperGraphEdMenu.kCutoffAnnot")) heatMapCutoff`; $but = `button -label (uiRes("m_HyperGraphEdMenu.kSelect")) -command "heatMapSelect" -annotation (uiRes("m_HyperGraphEdMenu.kSelectAnnot")) heatMapSelect`; formLayout -e -af $grp "top" 0 -af $grp "left" 0 -ac $but "top" 5 $grp -af $but "left" 150 -af $but "right" 150 $form; setParent ..; setParent ..; frameLayout -label (uiRes("m_HyperGraphEdMenu.kGlobalTiming")); $form = `formLayout`; $grp = `checkBoxGrp -label (uiRes("m_HyperGraphEdMenu.kTiming")) -label1 (uiRes("m_HyperGraphEdMenu.kTiming1")) -cw 2 80 -annotation (uiRes("m_HyperGraphEdMenu.kChangeCommandAnnot")) -changeCommand "updateHeatMapTiming" heatMapTiming`; $but = `button -label (uiRes("m_HyperGraphEdMenu.kResetTimers")) -recomputeSize true -command "dgtimer -reset; doHeatMapUpdate(false)" -annotation (uiRes("m_HyperGraphEdMenu.kResetTimersAnnot"))`; formLayout -e -af $grp "top" 0 -af $grp "left" 0 -ac $but "top" 5 $grp -af $but "left" 150 -af $but "right" 150 $form; setParent ..; setParent ..; // Control buttons at the bottom of the panel. // $form = `formLayout`; string $redraw = `button -label (uiRes("m_HyperGraphEdMenu.kUpdateDisplay")) -annotation (uiRes("m_HyperGraphEdMenu.kUpdateDisplayAnnot")) -command "doHeatMapUpdate(true)"`; string $close = `button -label (uiRes("m_HyperGraphEdMenu.kClose")) -command "window -edit -visible false heatMapControlWindow; terminateHeatMapAutoUpdateCheck"`; formLayout -e -af $redraw "top" 0 -af $redraw "left" 0 -ap $redraw "right" 0 50 -af $close "top" 0 -af $close "right" 0 -ap $close "left" 0 50 $form; setParent ..; setParent ..; // Initialise window settings. // optionMenuGrp -e -select `optionVar -q heatMapMetric` heatMapMetric; optionMenuGrp -e -select `optionVar -q heatMapType` heatMapType; checkBoxGrp -e -v1 false -v2 false heatMapThreshold; } // Update "Timer on/off" in case the user toggled the state some way // other than the menu. // checkBoxGrp -e -v1 `dgtimer -on -q` heatMapTiming; // Display the window. // showWindow heatMapControlWindow; } global proc overrideColorCallback(string $editor, string $parent) { int $enable = `menuItem -q -checkBox $parent`; optionVar -intValue hypergraphColorOverride $enable; if ($enable) hyperGraph -e -useDrawOverrideColor 1 $editor; else hyperGraph -e -useDrawOverrideColor 0 $editor; } global proc cachedDisplayCallback( string $editor, string $parent ) { int $enable = `menuItem -q -checkBox $parent`; optionVar -intValue hypergraphShowCachedConnections $enable; hyperGraph -e -showCachedConnections $enable $editor; } global proc relationshipDisplayCallback( string $editor, string $parent ) { int $enable = `menuItem -q -checkBox $parent`; optionVar -intValue hypergraphShowRelationships $enable; hyperGraph -e -showRelationships $enable $editor; } // Update merge-connections button and menu-item states global proc checkMergeConnections(int $enable, string $editor) { if (`menuItem -exists ($editor+"MergeConnItem")`) menuItem -e -checkBox $enable ($editor+"MergeConnItem"); // update option var and apply to editor optionVar -intValue hypergraphMergeConnections $enable; hyperGraph -e -mergeConnections $enable $editor; } // merge-connections menu-item callback global proc mergeConnectionsDisplayCallback( string $editor, string $parent ) { int $enable = `menuItem -q -checkBox $parent`; checkMergeConnections($enable, $editor); } global proc opaqueContainersDisplayCallback( string $editor, string $parent ) { int $enable = `menuItem -q -checkBox $parent`; optionVar -intValue hypergraphOpaqueContainers $enable; hyperGraph -e -opaqueContainers $enable $editor; } global proc buildHyperOptionsMenu(string $editor, string $parent, string $collectionName) { setParent -menu $parent; if (`menu -query -numberOfItems $parent` != 0) { checkHGControls $editor; return; } string $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kDisplay")) -subMenu true -aob true FiltersItem`; menuItem -edit -postMenuCommand ("buildHyperShowSubMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kOrientation")) -subMenu true ($editor + $collectionName + "OrientCascade")`; string $layoutStyle =`hyperGraph -q -graphLayoutStyle $editor`; string $graphType = `hyperGraph -q -graphType $editor`; int $enableHierarchical = 0; if ( ( $graphType == "DAG" ) || ( ( $graphType == "DG" ) && ( $layoutStyle == "hierarchicalLayout" ) ) ) { $enableHierarchical = 1; } menuItem -edit -enable $enableHierarchical -postMenuCommand ("buildHyperOrientationSubMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kLayoutOptionMenu")) -subMenu true LayoutCascade`; menuItem -edit -postMenuCommand ("buildHyperLayoutSubMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kTransitions")) -subMenu true -cb true TransitionCascade`; menuItem -edit -postMenuCommand ("buildHyperTransitionsSubMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kUpdate")) -subMenu true UpdateCascade`; menuItem -edit -postMenuCommand ("buildHyperUpdateSubMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kNodeDisplayOverrideColor")) -checkBox 0 `; menuItem -edit -checkBox `hyperGraph -query -useDrawOverrideColor $editor` $menuItem; menuItem -edit -annotation (uiRes("m_HyperGraphEdMenu.kToggleDisplayNodeAnnot")) -command ("overrideColorCallback "+ $editor + " " + $menuItem) $menuItem; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kShowCachedConnectionsOption")) -checkBox 0 CachedConnItem`; menuItem -edit -checkBox `hyperGraph -query -showCachedConnections $editor` $menuItem; menuItem -edit -annotation (uiRes("m_HyperGraphEdMenu.kTogglesDisplayAnnot")) -command ("cachedDisplayCallback " + $editor + " " + $menuItem) $menuItem; string $heatMap = `menuItem -label (uiRes("m_HyperGraphEdMenu.kHeatMapDisplay")) -checkBox 0`; menuItem -edit -checkBox `hyperGraph -query -heatMapDisplay $editor` $heatMap; menuItem -edit -annotation (uiRes("m_HyperGraphEdMenu.kToggleHeatMapDisplayAnnot")) -command ("toggleHeatMapDisplay " + $editor + " " + $heatMap) $heatMap; menuItem -optionBox true -command "heatMapControls"; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kShowRelationshipConnections")) -checkBox 0 RelationshipConnItem`; menuItem -edit -checkBox `hyperGraph -query -showRelationships $editor` $menuItem; menuItem -edit -annotation (uiRes("m_HyperGraphEdMenu.kTogglesDisplayRelationshipAnnot")) -command ("relationshipDisplayCallback " + $editor + " " + $menuItem) $menuItem; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kMergeConnections")) -checkBox 0 ($editor+"MergeConnItem")`; menuItem -edit -checkBox `hyperGraph -query -mergeConnections $editor` $menuItem; menuItem -edit -annotation (uiRes("m_HyperGraphEdMenu.kTogglesMergeConnectionsAnnot")) -command ("mergeConnectionsDisplayCallback " + $editor + " " + $menuItem) $menuItem; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kOpaqueAssets")) -checkBox 0 OpaqueContainersItem`; menuItem -edit -checkBox `hyperGraph -query -opaqueContainers $editor` $menuItem; menuItem -edit -annotation (uiRes("m_HyperGraphEdMenu.kOpaqueContainersAnnot")) -command ("opaqueContainersDisplayCallback " + $editor + " " + $menuItem) $menuItem; checkHGControls $editor; } global proc buildMainPopupMenuItems(string $editor, string $menuName, string $collectionName) { setParent -m $menuName; if (`menu -query -numberOfItems $menuName` != 0) { return; } menuItem -label (uiRes("m_HyperGraphEdMenu.kHypergraph")) HyperMenuTitleItem; string $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kEdit")) -subMenu true -allowOptionBoxes true EditCascade`; menuItem -edit -postMenuCommand ("buildHyperEditMenu " + $editor + " " + $menuItem) $menuItem; setParent -menu ..; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kView")) -subMenu true ViewCascade`; menuItem -edit -postMenuCommand ("buildHyperViewMenu " + $editor + " " + $menuItem) $menuItem; setParent -menu ..; menuItem -divider true; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kBookmarks")) -subMenu true -aob true ($collectionName + "bookmarksCascade")`; menuItem -edit -postMenuCommand ("hyperBookmarkBuildMenu " + $editor + " " + $menuItem + " false") $menuItem; setParent -menu ..; menuItem -divider true; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kGraph")) -subMenu true dependencyGraph`; menuItem -edit -postMenuCommand ("buildHyperNavigateMenu " + $editor + " " + $menuItem) $menuItem; setParent -menu ..; menuItem -divider true; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kRendering")) -subMenu true renderingCascade`; menuItem -edit -postMenuCommand ("buildHyperRenderingMenu " + $editor + " " + $menuItem) $menuItem; setParent -menu ..; menuItem -divider true; $menuItem = `menuItem -label (uiRes("m_HyperGraphEdMenu.kOptions")) -subMenu true -aob true hyperOptionsCascade`; menuItem -edit -postMenuCommand ("buildHyperOptionsMenu " + $editor + " " + $menuItem + " " + $collectionName) $menuItem; setParent -menu ..; // Attach the filter menu to the popup menu. // filterUICreateMenu($editor, `setParent -query -menu`); } global proc buildHyperGraphMenu(string $editor, string $parent, string $collectionName) { // setParent $parent; string $menu = `menu -label (uiRes("m_HyperGraphEdMenu.kEditMenu")) -familyImage "menuIconEdit.png" -allowOptionBoxes true EditCascade`; menu -edit -postMenuCommand ("buildHyperEditMenu " + $editor + " " + $menu) $menu; setParent -menu ..; $menu = `menu -label (uiRes("m_HyperGraphEdMenu.kViewMenu")) -familyImage "menuIconView.png" ViewCascade`; menu -edit -postMenuCommand ("buildHyperViewMenu " + $editor + " " + $menu) $menu; setParent -menu ..; $menu = `menu -label (uiRes("m_HyperGraphEdMenu.kBookmarksHyperGraph")) -familyImage "menuIconBookmarks.png" -aob true ($collectionName + "bookmarksCascade")`; menu -edit -postMenuCommand ("hyperBookmarkBuildMenu " + $editor + " " + $menu + " false") $menu; setParent -menu ..; $menu = `menu -label (uiRes("m_HyperGraphEdMenu.kGraphHyperGraph")) -familyImage "menuIconGraph.png" dependencyGraph`; menu -edit -postMenuCommand ("buildHyperNavigateMenu " + $editor + " " + $menu) $menu; setParent -menu ..; $menu = `menu -label (uiRes("m_HyperGraphEdMenu.kRenderingHyperGraph")) -familyImage "menuIconRender.png" renderingCascade`; menu -edit -postMenuCommand ("buildHyperRenderingMenu " + $editor + " " + $menu) $menu; setParent -menu ..; $menu = `menu -label (uiRes("m_HyperGraphEdMenu.kOptionsHyperGraph")) -familyImage "menuIconOptions.png" -aob true hyperOptionsCascade`; menu -edit -postMenuCommand ("buildHyperOptionsMenu " + $editor + " " + $menu + " " + $collectionName) $menu; setParent -menu ..; // Attach the filter menu to the menu bar. // filterUICreateMenu($editor, `setParent -query`); } // // Create the separate specified menu for the RMB on a node // proc createHGnodeMenuItems( string $editor, string $menu ) { setParent -m $menu; // Obtain selected node name, without the path. string $node = `hyperGraph -q -feedbackNode $editor`; string $nodeName = match("[^|]*$", $node) + "..."; menuItem -label $nodeName NodeAttributes; menuItem -divider true; menuItem -divider true; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kCollapseMenuItem")) FoldItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kExpandMenuItem")) UnfoldItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kExpandAllMenuItem")) UnfoldAllItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrameHierarchyMenuItem")) FrameHierarchyItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kFrameBranchMenuItem")) FrameBranchItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kRenameMenuItem")) RenameItem; menuItem -divider true; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowMenuItem")) ShowItem; menuItem -label (uiRes("m_HyperGraphEdMenu.kHideMenuItem")) HideItem; // DG only items. // string $graphType = `hyperGraph -query -graphType $editor`; if ($graphType == "DG") { menuItem -divider true; string $selectedItems[] = `ls -sl`; menuItem -label (uiRes("m_HyperGraphEdMenu.kCreateNewAsset")) -annotation (uiRes("m_HyperGraphEdMenu.kCreateNewAssetAnnot")) -enable (size($selectedItems)>0) -command ("createContainerWithNodes( `ls -sl` )") CreateNewContainerItem; int $isContainer = `container -q -isContainer $node`; if( $isContainer ){ menuItem -label (uiRes("m_HyperGraphEdMenu.kSelectAssetContent")) -command SelectContainerContents -annotation (getRunTimeCommandAnnotation("SelectContainerContents")); menuItem -enable (`container -q -current` != $node) -label (uiRes("m_HyperGraphEdMenu.kSetAssetCurrent")) -command ("container -e -c 1 " + $node ) -annotation (uiRes("m_HyperGraphEdMenu.kSetAssetCurrentAnnot")); // Determine whether to dim the "Add selected to asset." // If the mouse is RMB over an container and nodes not in the // container are selected, then enable the menu item. // string $nodesToAdd = getNodesToAddToContainer($node); menuItem -label (uiRes("m_HyperGraphEdMenu.kAddToAsset")) -annotation (uiRes("m_HyperGraphEdMenu.kAddToAssetAnnot")) -enable (size($nodesToAdd)>0) -command ("container -e -f -an "+$nodesToAdd+" "+$node) -echoCommand 1 AddToContainerItem; } // If the mouse is RMB over a node that is not selected, // then only act on it, otherwise act on all selected nodes. // string $nodesToRemove = getNodesToRemoveFromContainer($node); menuItem -label (uiRes("m_HyperGraphEdMenu.kRemoveFromAsset")) -annotation (uiRes("m_HyperGraphEdMenu.kRemoveFromAssetAnnot")) -enable (size($nodesToRemove) > 0) -echoCommand 1 -command ("removeNodesFromContainer("+$nodesToRemove+",\"\",0)") RemoveFromContainerItem; if( $isContainer ){ menuItem -label (uiRes("m_HyperGraphEdMenu.kLayoutAsset")) -annotation (uiRes("m_HyperGraphEdMenu.kLayoutAssetAnnot")) -enable ( `getAttr ($node + ".isCollapsed")` == 0 ) -subMenu true; menuItem -label (uiRes("m_HyperGraphEdMenu.kHierarchicalLayout")) -command ("hyperGraph -e -layoutSelected hierarchicalLayout -useFeedbackList " + $editor); menuItem -label (uiRes("m_HyperGraphEdMenu.kSetBackgroundImage")) -command ("python(\"import maya.app.general.adjustBackgroundImageWin as modu; modu.adjustBackgroundImageWin('" + $editor +"')\")"); } } checkHGControls $editor; } // // define context-sensitive node commands issued on highlight node // proc defineHGNodeMenuCommands(string $editor, string $menu) { menuItem -edit -c ("hyperGraph -e -attributeEditor single -useFeedbackList " + $editor) NodeAttributes; menuItem -edit -c ("hyperGraph -e -useFeedbackList -fold " + $editor) FoldItem; menuItem -edit -c ("hyperGraph -e -useFeedbackList -unfold " + $editor) UnfoldItem; menuItem -edit -c ("hyperGraph -e -unfoldAllShapes -useFeedbackList " + $editor) UnfoldAllItem; menuItem -edit -c ("hyperGraph -e -useFeedbackList -frameHierarchy " + $editor) FrameHierarchyItem; menuItem -edit -c ("hyperGraph -e -useFeedbackList -frameBranch " + $editor) FrameBranchItem; menuItem -edit -c ("hyperGraph -e -rename -useFeedbackList " + $editor) RenameItem; menuItem -edit -c ("hyperGraph -e -visibility on -useFeedbackList " + $editor) ShowItem; menuItem -edit -c ("hyperGraph -e -visibility off -useFeedbackList " + $editor) HideItem; } // // Hook up the buttons // proc defineButtonCommands (string $editor) { int $dimWhenNoSelect = 0; iconTextButton -edit -command ("FrameAll") frameGraphButton; iconTextButton -edit -command ("FrameSelected") frameSelectionButton; iconTextButton -edit -command ("hyperGraph -e -frameHierarchy " + $editor) frameHierButton; iconTextButton -edit -command ("hyperGraph -e -frameBranch " + $editor) frameBranchButton; iconTextButton -edit -command ("showDAGLevel " + $editor) showDAGButton; iconTextButton -edit -command ("showDGLevel " + $editor) showDGButton; if ($dimWhenNoSelect) dimWhen -f "SomethingSelected" showDGButton; iconTextButton -edit -command ("hyperBookmarkAddCallback " + $editor + " later") addBookmarkButton; iconTextButton -edit -command ("hyperViewer " + $editor) editBookmarkButton; iconTextCheckBox -edit -onCommand ("checkFreeformCollection On " + $editor) -offCommand ("checkFreeformCollection Off " + $editor) ($editor+"freeformButton"); iconTextCheckBox -edit -onCommand ("checkMergeConnections 1 " + $editor) -offCommand ("checkMergeConnections 0 " + $editor) ($editor+"mergeConnectionsButton"); // Container operations iconTextButton -edit -command CreateContainer -annotation (getRunTimeCommandAnnotation("CreateContainer")) ($editor+"createContainerButton"); iconTextButton -edit -command ("unpackAndRemoveContainer(`ls -sl -containers`)") -annotation (uiRes( "m_HyperGraphEdMenu.kRemoveAssetAnnot" )) ($editor+"removeContainerButton"); iconTextButton -edit -command ("hyperGraph -edit -collapseContainer "+$editor) -annotation (uiRes( "m_HyperGraphEdMenu.kCollapseAssetAnnot" )) ($editor+"collapseContainerButton"); iconTextButton -edit -command ("hyperGraph -edit -expandContainer "+$editor) -annotation (uiRes( "m_HyperGraphEdMenu.kExpandAssetAnnot" )) ($editor+"expandContainerButton"); } global proc buildHGNodeMenuItems(string $editor, string $menu) { createHGnodeMenuItems($editor, $menu); defineHGNodeMenuCommands($editor, $menu); } global proc buildHGMenuItems(string $editor, string $menu, string $collectionName) { if (`popupMenu -e -exists $menu`) { string $feedbackNode = `hyperGraph -query -feedbackNode $editor`; if ($feedbackNode != "") { popupMenu -e -deleteAllItems $menu; string $gadget = `hyperGraph -query -feedbackGadget $editor`; string $cmd = "hypergraph"+$gadget+"Menu"; if(`exists $cmd`) { string $call = $cmd+"(\""+$editor+"\",\""+$menu+"\",\""+$feedbackNode+"\");"; eval $call; }else{ buildHGNodeMenuItems($editor,$menu); } } else { popupMenu -e -deleteAllItems $menu; buildMainPopupMenuItems($editor, $menu, $collectionName); } } } global proc buildShiftPopupMenuItems(string $editor, string $menuName) { popupMenu -e -deleteAllItems $menuName; // DG mode is not supported string $type = `hyperGraph -query -graphType $editor`; if ($type != "DAG") return; setParent -m $menuName; string $cmd = "setFilterSettings( \""+$editor+"\", \"shiftPopup\", "; menuItem -label (uiRes("m_HyperGraphEdMenu.kShowAllConn")) -rp "N" -c ($cmd + "false , false);" ) ($menuName + "showConstAllPopTitleItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kShowFromConn")) -rp "NE" -c ($cmd + "true , false);" ) ($menuName + "showConstFromPopTitleItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kShowAToConn")) -rp "E" -c ($cmd + "false , true);" ) ($menuName + "showConstToPopTitleItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kShowFromToConn")) -rp "SE" -c ($cmd + "true , true);" ) ($menuName + "showConstFromToPopTitleItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kToggleConstLabel")) -rp "S" -c ("toggleConstraintLabels " + $editor + "; " ) ($menuName + "showConstLabelTitleItem"); menuItem -label (uiRes("m_HyperGraphEdMenu.kExpressionConn")) -rp "NW" -c ("toggleExpressConn " + $editor + "; " ) -checkBox `hyperGraph -query -showExpressions $editor`; menuItem -label (uiRes("m_HyperGraphEdMenu.kConstraintConn")) -rp "W" -c ("toggleConstrConn " + $editor + "; " ) -checkBox `hyperGraph -query -showConstraints $editor` ; menuItem -label (uiRes("m_HyperGraphEdMenu.kDeformerConn")) -rp "SW" -c ("toggleDeformConn " + $editor + "; " ) -checkBox `hyperGraph -query -showDeformers $editor`; } global proc HyperGraphEdMenu(string $editor) { // Find the name of the control that the menu will be attached to // string $parent = `hyperGraph -query -control $editor`; string $popupMenuName = ($editor + "PopupMenu"); string $shiftPopupMenuName = ($editor + "ShiftPopupMenu"); string $collectionNameMenu = "Menu"; string $collectionNamePopup = "Popup"; // Create the popup menu // if (!`popupMenu -exists $popupMenuName`) { string $fullMenuName = `popupMenu -parent $parent $popupMenuName`; popupMenu -e -parent $parent -pmc ("buildHGMenuItems " + $editor + " " + $fullMenuName + " " + $collectionNamePopup) $popupMenuName; } if (!`popupMenu -exists $shiftPopupMenuName`) { string $fullMenuName = `popupMenu -parent $parent $shiftPopupMenuName`; popupMenu -e -markingMenu true -ctrlModifier false -shiftModifier true -button 3 -postMenuCommandOnce false -pmc ("buildShiftPopupMenuItems " + $editor + " " + $fullMenuName) $shiftPopupMenuName; } buildHyperGraphMenu $editor "hyperGraphMenu" $collectionNameMenu; defineButtonCommands $editor; checkHGControls($editor); }