// =========================================================================== // 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: 6 June 1997 // // Create a new model panel with the menu bar // proc int inShadedMode(string $editor) { string $shadeMode = `modelEditor -q -displayAppearance $editor`; int $modeIsShaded = false; switch($shadeMode) { case "smoothShaded": case "flatShaded": $modeIsShaded = true; break; default: break; } return $modeIsShaded; } global proc setWireframeOnShadedOption( int $val, string $editor ) { int $modeIsShaded = inShadedMode($editor); if (false == $modeIsShaded && true == $val) { modelEditor -edit -displayAppearance smoothShaded -activeOnly false -wireframeOnShaded 1 $editor; } else { modelEditor -edit -wireframeOnShaded $val $editor; } } global proc setXrayOption( int $val, string $editor ) { int $modeIsShaded = inShadedMode($editor); if (false == $modeIsShaded && true == $val) { modelEditor -edit -displayAppearance smoothShaded -activeOnly false -xray 1 $editor; } else { modelEditor -edit -xray $val $editor; } } proc int autoLoadSelectedItem(string $editor) { int $autoLoad = false; // First, find out what is connected to this editor // string $mainListConnection = `editor -query -mainListConnection $editor`; // Only if it is the active list and the connection is not locked // do we auto load. // if($mainListConnection == "activeList" && !`selectionConnection -query -lock $mainListConnection`) { $autoLoad = true; } return $autoLoad; } global string $gIsolateSelectAutoAddEditors[]; global int $gIsolateSelectAutoAddEnabled[]; proc int isolateSelectAutoAdd(string $editor) { global string $gIsolateSelectAutoAddEditors[]; global int $gIsolateSelectAutoAddEnabled[]; int $len = size($gIsolateSelectAutoAddEditors); for ($i = 0; $i < $len; $i++) { if ($editor == $gIsolateSelectAutoAddEditors[$i]) { return $gIsolateSelectAutoAddEnabled[$i]; } } // Not found, default is enabled so add this editor $gIsolateSelectAutoAddEditors[$len] = $editor; $gIsolateSelectAutoAddEnabled[$len] = 1; return 1; } global proc setIsolateSelectAutoAdd(string $editor, int $enable) { global string $gIsolateSelectAutoAddEditors[]; global int $gIsolateSelectAutoAddEnabled[]; int $len = size($gIsolateSelectAutoAddEditors); for ($i = 0; $i < $len; $i++) { if ($editor == $gIsolateSelectAutoAddEditors[$i]) { // Found, change setting $gIsolateSelectAutoAddEnabled[$i] = $enable; return; } } // Not found, add it $gIsolateSelectAutoAddEditors[$len] = $editor; $gIsolateSelectAutoAddEnabled[$len] = $enable; updateIsolateSelectAutoAddScriptJob(); } global proc updateIsolateSelectAutoAddScriptJob() { global string $gIsolateSelectAutoAddEditors[]; global int $gIsolateSelectAutoAddEnabled[]; global int $gIsolateSelectAutoAddScriptJob = -1; int $len = size($gIsolateSelectAutoAddEditors); for ($i = 0; $i < $len; $i++) { string $editor = $gIsolateSelectAutoAddEditors[$i]; if ($gIsolateSelectAutoAddEnabled[$i] && `modelEditor -exists $editor` && `modelEditor -q -viewSelected $editor`) { if (!`scriptJob -ex $gIsolateSelectAutoAddScriptJob`) { // Add a script job to monitor for new objects $gIsolateSelectAutoAddScriptJob = `scriptJob -protected -event "DagObjectCreated" "isolateSelectAutoAddCallback"`; } return; } } // Remove the script job, no longer required if ($gIsolateSelectAutoAddScriptJob != -1) { scriptJob -force -kill $gIsolateSelectAutoAddScriptJob; $gIsolateSelectAutoAddScriptJob = -1; } } global proc isolateSelectAutoAddCallback() { global string $gIsolateSelectAutoAddEditors[]; global int $gIsolateSelectAutoAddEnabled[]; int $len = size($gIsolateSelectAutoAddEditors); for ($i = 0; $i < $len; $i++) { string $editor = $gIsolateSelectAutoAddEditors[$i]; if ($gIsolateSelectAutoAddEnabled[$i] && `modelEditor -exists $editor` && `modelEditor -q -viewSelected $editor`) { modelEditor -edit -addSelectedObjects $editor; } } } global proc isolateSelectAddObject(string $object) { global string $gIsolateSelectAutoAddEditors[]; global int $gIsolateSelectAutoAddEnabled[]; int $len = size($gIsolateSelectAutoAddEditors); for ($i = 0; $i < $len; $i++) { string $editor = $gIsolateSelectAutoAddEditors[$i]; if ($gIsolateSelectAutoAddEnabled[$i] && `modelEditor -exists $editor` && `modelEditor -q -viewSelected $editor`) { isolateSelect -addDagObject $object $editor; } } } global proc enableIsolateSelect (string $editor, int $enable) { if ($enable) { // First, find out what is connected to this editor // string $mainListConnection = `editor -query -mainListConnection $editor`; if ($mainListConnection == "") { int $autoLoad = autoLoadSelectedItem($editor); if ( $autoLoad ) { editor -edit -mainListConnection "activeList" $editor; } else { editor -edit -lck -mainListConnection "activeList" $editor; } } else if (`selectionConnection -query -lock $mainListConnection`) { editor -edit -ulk $editor; editor -edit -lck $editor; } } modelEditor -edit -viewSelected $enable $editor; isolateSelectAutoAdd($editor); // add editor to list updateIsolateSelectAutoAddScriptJob(); } global proc removeSelectedFromEditor (string $editor) { // Make sure the editor exists // if (!`editor -exists $editor`) { error (uiRes("m_createModelPanelMenu.kEditorNotFound")); } // If this is a modelEditor, then we can add the members directly // if (`modelEditor -exists $editor`) { modelEditor -edit -removeSelected $editor; return; } } global proc updateIsolateMenu( string $parentMenu, string $editor, string $panel ) // // This updates the shading menu, based on the current settings // of the model editor // { loadAnimMenuLibrary; // Set the proper check state of the AutoLoad menu // setParent -menu $parentMenu; if (`menu -query -numberOfItems $parentMenu` == 0) { // Register the default connection for this editor // registerEditor $editor "activeList"; menuItem -label (uiRes("m_createModelPanelMenu.kViewSelected")) -enableCommandRepeat false -checkBox true -command ("ToggleIsolateSelect") iselectEnableItem; menuItem -label (uiRes("m_createModelPanelMenu.kAutoLoadNewObjects")) -checkBox true -command ("setIsolateSelectAutoAdd " + $editor + " #1") autoLoadNewItem; menuItem -label (uiRes("m_createModelPanelMenu.kAutoLoadSelectedObjects")) -checkBox false -command ("toggleAutoLoad " + $editor + " #1") autoLoadItem; menuItem -label (uiRes("m_createModelPanelMenu.kLoadSelectedObjects")) -command ("doReload " + $editor) reloadItem; menuItem -label (uiRes("m_createModelPanelMenu.kAddSelectedObjects")) -command ("addSelectedToEditor " + $editor) addToListItem; menuItem -label (uiRes("m_createModelPanelMenu.kRemoveSelectedObjects")) -command ("removeSelectedFromEditor " + $editor) removeFromListItem; string $menuItem = `menuItem -label (uiRes("m_createModelPanelMenu.kShowBookmarks")) -subMenu true -aob true bookMarkHierItem`; menuItem -edit -postMenuCommand ("buildBookmarkMenu -type bookmarkModelView -editor " + $editor + " " + $menuItem) $menuItem; menuItem -label (uiRes("m_createModelPanelMenu.kBookmarkCurrentObjects")) -command ("createBookmark " + $editor + " bookmarkModelView false") bookAnimMarkObjectsItem; menuItem -optionBox true -command ("createBookmark " + $editor + " bookmarkModelView true") bookAnimMarkObjectsDialog; setParent -menu ..; } menuItem -e -checkBox `modelEditor -q -viewSelected $editor` iselectEnableItem; int $autoAdd = isolateSelectAutoAdd($editor); menuItem -edit -checkBox $autoAdd autoLoadNewItem; int $autoLoad = autoLoadSelectedItem($editor); if ($autoLoad) { menuItem -edit -checkBox on autoLoadItem; menuItem -edit -enable false reloadItem; menuItem -edit -enable false addToListItem; } else { menuItem -edit -checkBox off autoLoadItem; menuItem -edit -enable true reloadItem; menuItem -edit -enable true addToListItem; } } global proc toggleInteractiveShading( int $val, string $panel ) { string $cmd; if ($val) { $cmd = ("modelEditor -e -useInteractiveMode on " + $panel); } else { $cmd = ("modelEditor -e -useInteractiveMode off " + $panel); } eval $cmd; } global proc togglePrimTransparencySorting( int $val, string $panel ) { string $cmd; if ($val) { $cmd = ("modelEditor -e -tal \"perPolygonSort\"" + $panel); } else { $cmd = ("modelEditor -e -tal \"frontAndBackCull\"" + $panel); } eval $cmd; } global proc displayTexturedOptionBox( string $panel) { if (isLegacyViewportEnabled()) hwTxOptions 1 $panel; } //Need separate proc for getting the optionVar at each point in the change of the slider global proc setLineWidth(string $panel) { float $width = `floatSliderGrp -query -value lineWidthSlider`; modelEditor -e -lineWidth $width $panel; } global proc lineWidthReset(string $panel) { floatSliderGrp -edit -value 1.0 lineWidthSlider; modelEditor -e -lineWidth 1.0 $panel; } global proc displayLineWidthOptionBox( string $panel) { string $wndName = "lineWidthWnd"; string $wndTitle = (uiRes("m_createModelPanelMenu.kLineWidthWindow")); string $resetMenu = ($panel+"ResetMenu"); string $resetMenuItem = ($panel+"ResetToItem"); if ( `window -exists $wndName`) { showWindow $wndName; } else { window -resizeToFitChildren 1 -title $wndTitle -iconName (uiRes("m_createModelPanelMenu.kIconNameLineWidth")) -menuBar 1 -height 75 $wndName; menu -parent $wndName -label (uiRes("m_createModelPanelMenu.kResetMenu")) -enable 1 -familyImage "menuIconReset.png" $resetMenu; menuItem -parent $resetMenu -label (uiRes("m_createModelPanelMenu.kResetSettings")) -command ("lineWidthReset "+$panel) $resetMenuItem; setParent $wndName; string $formLayout = `formLayout`; string $columnLayout = `columnLayout -adj true`; float $currWidth = `modelEditor -q -lineWidth $panel`; floatSliderGrp -field 1 -minValue 1.0 -maxValue 10.0 -precision 1.0 -value $currWidth -changeCommand ( ("setLineWidth " + $panel) ) // -changeCommand ("modelEditor -lineWidth `floatSliderGrp -query -value lineWidthSlider` " + $panel) lineWidthSlider; formLayout -edit -attachForm $columnLayout top 3 -attachForm $columnLayout left 3 -attachForm $columnLayout right 3 -attachForm $columnLayout bottom 3 $formLayout; } showWindow $wndName; } global proc buildRendererMenu(string $parent, string $panel) { setParent -m $parent; global string $gHighQualityViewport; // Get rid of any old items menu -e -deleteAllItems $parent; string $currentRenderer = getViewportRenderer($panel); global string $gViewport2; global string $gLegacyViewport; global string $gHighQualityViewport; global string $gStubRenderer; global string $gDeviceDirectX11; int $radioState = 0; radioMenuItemCollection; // Disable VP2 renderer usage for stereo panel + OGS DX string $viewType = `modelEditor -q -viewType $panel`; int $ogsRendererEnabled = 1; if ($viewType == "stereoCameraView") { string $devOverride = `getenv MAYA_OGS_DEVICE_OVERRIDE`; if ($devOverride == $gDeviceDirectX11) $ogsRendererEnabled = 0; } string $currentOverride = `modelEditor -q -rom $panel`; if ($currentRenderer == $gViewport2) { if (($currentOverride == "") || ($currentOverride == "stereoOverrideVP2")) $radioState = 1; else $radioState = 0; } else $radioState = 0; string $cmd = "ActivateViewport20"; menuItem -radioButton $radioState -label (uiRes("m_createModelPanelMenu.kOGSRenderer")) -aob true -command ($cmd) -annotation (getRunTimeCommandAnnotation($cmd)) -enable $ogsRendererEnabled OGSRenderer; menuItem -enableCommandRepeat false -optionBox 1 -command ("createViewport20OptionsUI") OGSRendererOption; if (isLegacyViewportEnabled()) { if ($currentRenderer == $gLegacyViewport) $radioState = 1; else $radioState = 0; menuItem -radioButton $radioState -label (uiRes("m_createModelPanelMenu.kDefaultQualityRendering")) -command ("setRendererInModelPanel $gLegacyViewport " + $panel) -annotation (uiRes("m_createModelPanelMenu.kDefaultQualityRenderingAnnot")) DefaultQualityRenderer; if ($currentRenderer == $gHighQualityViewport) $radioState = 1; else $radioState = 0; menuItem -radioButton $radioState -label (uiRes("m_createModelPanelMenu.kHighQualityRendering")) -aob true -command ("setRendererInModelPanel $gHighQualityViewport " + $panel) -annotation (uiRes("m_createModelPanelMenu.kHighQualityRenderingAnnot")) HighQualityRenderer; menuItem -enableCommandRepeat false -optionBox 1 -command ("hwRendererOptions 1 "+$panel) HighQualityRendererOption; } // Find out if we have any plugin overrides. Only applicable // to non-stereo views // if ($viewType != "stereoCameraView") { string $annotMsg = (uiRes("m_createModelPanelMenu.kUsePluginOverride")); string $renderOverrides[] = `modelEditor -q -rol $panel`; // Internal names string $renderOverridesUI[] = `modelEditor -q -rou $panel`; // UI names int $numOverrides = size($renderOverrides); if ($numOverrides > 0) { for ($i=0; $i<$numOverrides ; $i++) { string $overrideName = $renderOverrides[$i]; if ($overrideName != "stereoOverrideVP2") { if ($currentRenderer == $gViewport2) { if ($currentOverride == $overrideName) $radioState = 1; else $radioState = 0; } else $radioState = 0; menuItem -radioButton $radioState -aob true -label $renderOverridesUI[$i] -command ("setRendererAndOverrideInModelPanel $gViewport2 " + $overrideName + " " + $panel) -annotation (`format -s $renderOverridesUI[$i] $annotMsg`); // Check for user defined option box // string $optionBoxName = ($overrideName+"OptionBox"); string $testResult = `whatIs $optionBoxName`; if ($testResult != "Unknown") { menuItem -enableCommandRepeat false -optionBox 1 -command ($optionBoxName) $optionBoxName; } } } } } // Get any plugin renderers and add them here string $allRenderers[] = `modelEditor -q -rls $panel`; // Internal names string $allRenderersUI[] = `modelEditor -q -rlu $panel`; // UI names int $numRenderers = size($allRenderers); int $i; string $annotMsg = (uiRes("m_createModelPanelMenu.kUsePluginRenderer")); for ($i=0; $i<$numRenderers; $i++) { string $rendererName = $allRenderers[$i]; if (($rendererName != $gHighQualityViewport) && ($rendererName != $gLegacyViewport) && ($rendererName != $gStubRenderer) && ($rendererName != $gViewport2) ) { if ($currentRenderer == $rendererName) $radioState = 1; else $radioState = 0; menuItem -radioButton $radioState -aob true -label $allRenderersUI[$i] -command ("setRendererInModelPanel " + $rendererName + " " + $panel) -annotation (`format -s $allRenderersUI[$i] $annotMsg`); // Check for user defined option box string $optionBoxName = ($allRenderers[$i]+"OptionBox"); string $testResult = `whatIs $optionBoxName`; if ($testResult != "Unknown") { menuItem -enableCommandRepeat false -optionBox 1 -command ($optionBoxName) $optionBoxName; } } } } global string $gPbDisplayMenus[] = {}; global proc updatePlayblastMenus(string $pbOptionVar, string $pbMenuItem) { global string $gPbDisplayMenus[]; for ($menu in $gPbDisplayMenus) { if (`menu -exists $menu`) { menuItem -edit -checkBox `optionVar -query $pbOptionVar` ($menu+ "|"+$pbMenuItem); } } } global proc updatePlayblastPluginMenus() { global string $gPbDisplayMenus[]; string $pluginFilters[] = `pluginDisplayFilter -q -listFilters`; string $playblastExclude[] = {}; if (`optionVar -exists playblastShowPluginObjects`) { $playblastExclude = `optionVar -q playblastShowPluginObjects`; } // Set menu check boxes according to the option vars for ($menu in $gPbDisplayMenus) { if (`menu -exists $menu`) { string $filter; for ($filter in $pluginFilters) { int $show = (stringArrayFind($filter, 0, $playblastExclude) == -1); menuItem -e -checkBox $show ($menu + "|showPluginObjectsItemPB_" + $filter); } } } } global proc showAllPlayblastObjects(int $showThem) { optionVar -intValue playblastShowControllers $showThem; updatePlayblastMenus("playblastShowControllers", "showControllersItemPB"); optionVar -intValue playblastShowNURBSCurves $showThem; updatePlayblastMenus("playblastShowNURBSCurves", "showNurbsCurvesItemPB"); optionVar -intValue playblastShowNURBSSurfaces $showThem; updatePlayblastMenus("playblastShowNURBSSurfaces", "showNurbsSurfacesItemPB"); optionVar -intValue playblastShowCVs $showThem; updatePlayblastMenus("playblastShowCVs", "showNurbsCVsItemPB"); optionVar -intValue playblastShowHulls $showThem; updatePlayblastMenus("playblastShowHulls", "showNurbsHullsItemPB"); optionVar -intValue playblastShowPolyMeshes $showThem; updatePlayblastMenus("playblastShowPolyMeshes", "showPolymeshesItemPB"); optionVar -intValue playblastShowSubdivSurfaces $showThem; updatePlayblastMenus("playblastShowSubdivSurfaces", "showSubdivSurfacesItemPB"); optionVar -intValue playblastShowPlanes $showThem; updatePlayblastMenus("playblastShowPlanes", "showPlanesItemPB"); optionVar -intValue playblastShowLights $showThem; updatePlayblastMenus("playblastShowLights", "showLightsItemPB"); optionVar -intValue playblastShowCameras $showThem; updatePlayblastMenus("playblastShowCameras", "showCamerasItemPB"); optionVar -intValue playblastShowImagePlane $showThem; updatePlayblastMenus("playblastShowImagePlane", "showImagePlaneItemPB"); optionVar -intValue playblastShowJoints $showThem; updatePlayblastMenus("playblastShowJoints", "showJointsItemPB"); optionVar -intValue playblastShowIKHandles $showThem; updatePlayblastMenus("playblastShowIKHandles", "showIkHandlesItemPB"); optionVar -intValue playblastShowDeformers $showThem; updatePlayblastMenus("playblastShowDeformers", "showDeformersItemPB"); optionVar -intValue playblastShowDynamics $showThem; updatePlayblastMenus("playblastShowDynamics", "showDynamicsItemPB"); optionVar -intValue playblastShowParticleInstancers $showThem; updatePlayblastMenus("playblastShowParticleInstancers", "showParticleInstancersItemPB"); optionVar -intValue playblastShowFluids $showThem; updatePlayblastMenus("playblastShowFluids", "showFluidsItemPB"); optionVar -intValue playblastShowHairSystems $showThem; updatePlayblastMenus("playblastShowHairSystems", "showHairSystemsItemPB"); optionVar -intValue playblastShowFollicles $showThem; updatePlayblastMenus("playblastShowFollicles", "showFolliclesItemPB"); optionVar -intValue playblastShowNCloths $showThem; updatePlayblastMenus("playblastShowNCloths", "showNClothsItemPB"); optionVar -intValue playblastShowNParticles $showThem; updatePlayblastMenus("playblastShowNParticles", "showNParticlesItemPB"); optionVar -intValue playblastShowNRigids $showThem; updatePlayblastMenus("playblastShowNRigids", "showNRigidsItemPB"); optionVar -intValue playblastShowDynamicConstraints $showThem; updatePlayblastMenus("playblastShowDynamicConstraints", "showDynamicConstraintsItemPB"); optionVar -intValue playblastShowLocators $showThem; updatePlayblastMenus("playblastShowLocators", "showLocatorsItemPB"); optionVar -intValue playblastShowDimensions $showThem; updatePlayblastMenus("playblastShowDimensions", "showDimensionsItemPB"); optionVar -intValue playblastShowPivots $showThem; updatePlayblastMenus("playblastShowPivots", "showPivotsItemPB"); optionVar -intValue playblastShowHandles $showThem; updatePlayblastMenus("playblastShowHandles", "showHandlesItemPB"); optionVar -intValue playblastShowTextures $showThem; updatePlayblastMenus("playblastShowTextures", "showTexturesItemPB"); if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { optionVar -intValue playblastShowStrokes $showThem; updatePlayblastMenus("playblastShowStrokes", "showStrokesItemPB"); } optionVar -intValue playblastShowMotionTrails $showThem; updatePlayblastMenus("playblastShowMotionTrails", "showMotionTrailsItemPB"); optionVar -intValue playblastShowPluginShapes $showThem; updatePlayblastMenus("playblastShowPluginShapes", "showPluginShapesItemPB"); optionVar -clearArray playblastShowPluginObjects; string $pluginFilters[] = `pluginDisplayFilter -q -listFilters`; if (size($pluginFilters) > 0 && !$showThem) { string $filter; for ($filter in $pluginFilters) { optionVar -stringValueAppend playblastShowPluginObjects $filter; } } updatePlayblastPluginMenus(); optionVar -intValue playblastShowClipGhosts $showThem; updatePlayblastMenus("playblastShowClipGhosts", "showClipGhostsItemPB"); optionVar -intValue playblastShowGreasePencil $showThem; updatePlayblastMenus("playblastShowGreasePencil", "showGreasePencilItemPB"); optionVar -intValue playblastShowGrid $showThem; updatePlayblastMenus("playblastShowGrid", "showGridItemPB"); optionVar -intValue playblastShowHUD $showThem; updatePlayblastMenus("playblastShowHUD", "showHUDItemPB"); optionVar -intValue playblastShowHoldOuts $showThem; updatePlayblastMenus("playblastShowHoldOuts", "showHoldOutsItemPB"); optionVar -intValue playblastShowSelectionHighlighting $showThem; updatePlayblastMenus("playblastShowSelectionHighlighting", "showSelectionItemPB"); } proc initPlayblastDisplaySetting(string $varName) { if (!`optionVar -exists $varName`) { optionVar -intValue $varName 1; } } proc initPlayblastDisplaySettings() { initPlayblastDisplaySetting("playblastShowControllers"); initPlayblastDisplaySetting("playblastShowNURBSCurves"); initPlayblastDisplaySetting("playblastShowNURBSSurfaces"); initPlayblastDisplaySetting("playblastShowNURBSSurfaces"); initPlayblastDisplaySetting("playblastShowPolyMeshes"); initPlayblastDisplaySetting("playblastShowSubdivSurfaces"); initPlayblastDisplaySetting("playblastShowPlanes"); initPlayblastDisplaySetting("playblastShowLights"); initPlayblastDisplaySetting("playblastShowCameras"); initPlayblastDisplaySetting("playblastShowJoints"); initPlayblastDisplaySetting("playblastShowIKHandles"); initPlayblastDisplaySetting("playblastShowDeformers"); initPlayblastDisplaySetting("playblastShowDynamics"); initPlayblastDisplaySetting("playblastShowParticleInstancers"); initPlayblastDisplaySetting("playblastShowFluids"); initPlayblastDisplaySetting("playblastShowHairSystems"); initPlayblastDisplaySetting("playblastShowFollicles"); initPlayblastDisplaySetting("playblastShowNCloths"); initPlayblastDisplaySetting("playblastShowNParticles"); initPlayblastDisplaySetting("playblastShowNRigids"); initPlayblastDisplaySetting("playblastShowDynamicConstraints"); initPlayblastDisplaySetting("playblastShowLocators"); initPlayblastDisplaySetting("playblastShowDimensions"); initPlayblastDisplaySetting("playblastShowPivots"); initPlayblastDisplaySetting("playblastShowHandles"); initPlayblastDisplaySetting("playblastShowTextures"); if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { initPlayblastDisplaySetting("playblastShowStrokes"); } initPlayblastDisplaySetting("playblastShowMotionTrails"); initPlayblastDisplaySetting("playblastShowPluginShapes"); initPlayblastDisplaySetting("playblastShowCVs"); initPlayblastDisplaySetting("playblastShowHulls"); initPlayblastDisplaySetting("playblastShowGreasePencil"); initPlayblastDisplaySetting("playblastShowClipGhosts"); initPlayblastDisplaySetting("playblastShowGrid"); initPlayblastDisplaySetting("playblastShowHUD"); initPlayblastDisplaySetting("playblastShowHoldOuts"); initPlayblastDisplaySetting("playblastShowImagePlane"); initPlayblastDisplaySetting("playblastShowSelectionHighlighting"); } global proc togglePlayblastMenuItem(string $filter, int $enable) { // Remove the unused plugin display filter names string $pluginFilters[] = `pluginDisplayFilter -q -listFilters`; string $playblastExclude[] = {}; if (`optionVar -exists playblastShowPluginObjects`) { $playblastExclude = `optionVar -q playblastShowPluginObjects`; } for ($i = size($playblastExclude)-1; $i >= 0; $i--) { int $index = stringArrayFind($playblastExclude[$i], 0, $pluginFilters); if ($index == -1) { optionVar -removeFromArray playblastShowPluginObjects $i; } } // Find the filter in exclude list clear $playblastExclude; if (`optionVar -exists playblastShowPluginObjects`) { $playblastExclude = `optionVar -q playblastShowPluginObjects`; } int $index = stringArrayFind($filter, 0, $playblastExclude); if ($enable) { if ($index >= 0) { optionVar -removeFromArray playblastShowPluginObjects $index; } } else { if ($index == -1) { optionVar -stringValueAppend playblastShowPluginObjects $filter; } } } proc playblastDisplayMenu(string $panel, string $ed, string $playBlastMenu) { initPlayblastDisplaySettings(); string $itemName = `menuItem -tearOff true -label $playBlastMenu -postMenuCommandOnce false -subMenu true -familyImage "menuIconShow.png"`; global string $gPbDisplayMenus[]; if (!stringArrayContains($itemName, $gPbDisplayMenus)) { string $itemList[] = {$itemName}; $gPbDisplayMenus = stringArrayCatenate($itemList, $gPbDisplayMenus); } menu -e -pmc ("updateShowMenu "+$itemName+" "+$ed+" \""+$panel+"\" \""+$playBlastMenu+"\"") $itemName; menuItem -label (uiRes("m_createModelPanelMenu.kOverrideViewportPB")) -checkBox `optionVar -query playblastOverrideViewport` -enableCommandRepeat false -command ("optionVar -intValue playblastOverrideViewport #1; updatePlayblastMenus(\"playblastOverrideViewport\",\"overrideViewportItemPB\")") overrideViewportItemPB; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kAllPB")) -enableCommandRepeat false -command "showAllPlayblastObjects 1" showAllItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNonePB")) -enableCommandRepeat false -command "showAllPlayblastObjects 0" showNoneItemPB; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kControllersPB")) -checkBox `optionVar -query playblastShowControllers` -enableCommandRepeat false -command ("optionVar -intValue playblastShowControllers #1; updatePlayblastMenus(\"playblastShowControllers\", \"showControllersItemPB\")") showControllersItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSCurvesPB")) -checkBox `optionVar -query playblastShowNURBSCurves` -enableCommandRepeat false -command ("optionVar -intValue playblastShowNURBSCurves #1; updatePlayblastMenus(\"playblastShowNURBSCurves\", \"showNurbsCurvesItemPB\")") showNurbsCurvesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSSurfacesPB")) -checkBox `optionVar -query playblastShowNURBSSurfaces` -enableCommandRepeat false -command ("optionVar -intValue playblastShowNURBSSurfaces #1; updatePlayblastMenus(\"playblastShowNURBSSurfaces\", \"showNurbsSurfacesItemPB\")") showNurbsSurfacesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSCVsPB")) -checkBox `optionVar -query playblastShowCVs` -enableCommandRepeat false -command ("optionVar -intValue playblastShowCVs #1; updatePlayblastMenus(\"playblastShowCVs\", \"showNurbsCVsItemPB\")") showNurbsCVsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSHullsPB")) -checkBox `optionVar -query playblastShowHulls` -enableCommandRepeat false -command ("optionVar -intValue playblastShowHulls #1; updatePlayblastMenus(\"playblastShowHulls\", \"showNurbsHullsItemPB\")") showNurbsHullsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kPolygonsPB")) -checkBox `optionVar -query playblastShowPolyMeshes` -enableCommandRepeat false -command ("optionVar -intValue playblastShowPolyMeshes #1; updatePlayblastMenus(\"playblastShowPolyMeshes\", \"showPolymeshesItemPB\")") showPolymeshesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kSubdivSurfacesPB")) -checkBox `optionVar -query playblastShowSubdivSurfaces` -enableCommandRepeat false -command ("optionVar -intValue playblastShowSubdivSurfaces #1; updatePlayblastMenus(\"playblastShowSubdivSurfaces\", \"showSubdivSurfacesItemPB\")") showSubdivSurfacesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kPlanesPB")) -checkBox `optionVar -query playblastShowPlanes` -enableCommandRepeat false -command ("optionVar -intValue playblastShowPlanes #1; updatePlayblastMenus(\"playblastShowPlanes\", \"showPlanesItemPB\")") showPlanesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kLightsPB")) -checkBox `optionVar -query playblastShowLights` -enableCommandRepeat false -command ("optionVar -intValue playblastShowLights #1; updatePlayblastMenus(\"playblastShowLights\", \"showLightsItemPB\")") showLightsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kCamerasPB")) -checkBox `optionVar -query playblastShowCameras` -enableCommandRepeat false -command ("optionVar -intValue playblastShowCameras #1; updatePlayblastMenus(\"playblastShowCameras\", \"showCamerasItemPB\")") showCamerasItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kImagePlanesPB")) -checkBox `optionVar -query playblastShowImagePlane` -enableCommandRepeat false -command ("optionVar -intValue playblastShowImagePlane #1; updatePlayblastMenus(\"playblastShowImagePlane\", \"showImagePlaneItemPB\")") showImagePlaneItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kJointsPB")) -checkBox `optionVar -query playblastShowJoints` -enableCommandRepeat false -command ("optionVar -intValue playblastShowJoints #1; updatePlayblastMenus(\"playblastShowJoints\", \"showJointsItemPB\")") showJointsItemPB; menuItem -ltVersion "2015" -label (uiRes("m_createModelPanelMenu.kIKHandlesPB")) -checkBox `optionVar -query playblastShowIKHandles` -enableCommandRepeat false -command ("optionVar -intValue playblastShowIKHandles #1; updatePlayblastMenus(\"playblastShowIKHandles\", \"showIkHandlesItemPB\")") showIkHandlesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kDeformersPB")) -checkBox `optionVar -query playblastShowDeformers` -enableCommandRepeat false -command ("optionVar -intValue playblastShowDeformers #1; updatePlayblastMenus(\"playblastShowDeformers\", \"showDeformersItemPB\")") showDeformersItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kDynamicsPB")) -checkBox `optionVar -query playblastShowDynamics` -enableCommandRepeat false -command ("optionVar -intValue playblastShowDynamics #1; updatePlayblastMenus(\"playblastShowDynamics\", \"showDynamicsItemPB\")") showDynamicsItemPB; menuItem -version 2015 -label (uiRes("m_createModelPanelMenu.kParticleInstancersPB")) -checkBox `optionVar -query playblastShowParticleInstancers` -enableCommandRepeat false -command ("optionVar -intValue playblastShowParticleInstancers #1; updatePlayblastMenus(\"playblastShowParticleInstancers\", \"showParticleInstancersItemPB\")") showParticleInstancersItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kFluidsPB")) -checkBox `optionVar -query playblastShowFluids` -enableCommandRepeat false -command ("optionVar -intValue playblastShowFluids #1; updatePlayblastMenus(\"playblastShowFluids\", \"showFluidsItemPB\")") showFluidsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kHairSystemsPB")) -checkBox `optionVar -query playblastShowHairSystems` -enableCommandRepeat false -command ("optionVar -intValue playblastShowHairSystems #1; updatePlayblastMenus(\"playblastShowHairSystems\", \"showHairSystemsItemPB\")") showHairSystemsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kFolliclesPB")) -checkBox `optionVar -query playblastShowFollicles` -enableCommandRepeat false -command ("optionVar -intValue playblastShowFollicles #1; updatePlayblastMenus(\"playblastShowFollicles\", \"showFolliclesItemPB\")") showFolliclesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNClothsPB")) -checkBox `optionVar -query playblastShowNCloths` -enableCommandRepeat false -command ("optionVar -intValue playblastShowNCloths #1; updatePlayblastMenus(\"playblastShowNCloths\", \"showNClothsItemPB\")") showNClothsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNParticlesPB")) -checkBox `optionVar -query playblastShowNParticles` -enableCommandRepeat false -command ("optionVar -intValue playblastShowNParticles #1; updatePlayblastMenus(\"playblastShowNParticles\", \"showNParticlesItemPB\")") showNParticlesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kNRigidsPB")) -checkBox `optionVar -query playblastShowNRigids` -enableCommandRepeat false -command ("optionVar -intValue playblastShowNRigids #1; updatePlayblastMenus(\"playblastShowNRigids\", \"showNRigidsItemPB\")") showNRigidsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kDynamicConstraintsPB")) -checkBox `optionVar -query playblastShowDynamicConstraints` -enableCommandRepeat false -command ("optionVar -intValue playblastShowDynamicConstraints #1; updatePlayblastMenus(\"playblastShowDynamicConstraints\", \"showDynamicConstraintsItemPB\")") showDynamicConstraintsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kLocatorsPB")) -checkBox `optionVar -query playblastShowLocators` -enableCommandRepeat false -command ("optionVar -intValue playblastShowLocators #1; updatePlayblastMenus(\"playblastShowLocators\", \"showLocatorsItemPB\")") showLocatorsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kDimensionsPB")) -checkBox `optionVar -query playblastShowDimensions` -enableCommandRepeat false -command ("optionVar -intValue playblastShowDimensions #1; updatePlayblastMenus(\"playblastShowDimensions\", \"showDimensionsItemPB\")") showDimensionsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kPivotsPB")) -checkBox `optionVar -query playblastShowPivots` -enableCommandRepeat false -command ("optionVar -intValue playblastShowPivots #1; updatePlayblastMenus(\"playblastShowPivots\", \"showPivotsItemPB\")") showPivotsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kHandlesPB")) -checkBox `optionVar -query playblastShowHandles` -enableCommandRepeat false -command ("optionVar -intValue playblastShowHandles #1; updatePlayblastMenus(\"playblastShowHandles\", \"showHandlesItemPB\")") showHandlesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kTexturesPB")) -checkBox `optionVar -query playblastShowTextures` -enableCommandRepeat false -command ("optionVar -intValue playblastShowTextures #1; updatePlayblastMenus(\"playblastShowTextures\", \"showTexturesItemPB\")") showTexturesItemPB; if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { menuItem -label (uiRes("m_createModelPanelMenu.kStrokesPB")) -checkBox `optionVar -query playblastShowStrokes` -enableCommandRepeat false -command ("optionVar -intValue playblastShowStrokes #1; updatePlayblastMenus(\"playblastShowStrokes\", \"showStrokesItemPB\")") showStrokesItemPB; } menuItem -label (uiRes("m_createModelPanelMenu.kMotionTrailsPB")) -checkBox `optionVar -query playblastShowMotionTrails` -enableCommandRepeat false -command ("optionVar -intValue playblastShowMotionTrails #1; updatePlayblastMenus(\"playblastShowMotionTrails\", \"showMotionTrailsItemPB\")") showMotionTrailsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kPluginShapesPB")) -checkBox `optionVar -query playblastShowPluginShapes` -enableCommandRepeat false -command ("optionVar -intValue playblastShowPluginShapes #1; updatePlayblastMenus(\"playblastShowPluginShapes\", \"showPluginShapesItemPB\")") showPluginShapesItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kClipGhostsPB")) -checkBox `optionVar -query playblastShowClipGhosts` -enableCommandRepeat false -command ("optionVar -intValue playblastShowClipGhosts #1; updatePlayblastMenus(\"playblastShowClipGhosts\", \"showClipGhostsItemPB\")") showClipGhostsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kGreasePencilsPB")) -checkBox `optionVar -query playblastShowGreasePencil` -enableCommandRepeat false -command ("optionVar -intValue playblastShowGreasePencil #1; updatePlayblastMenus(\"playblastShowGreasePencil\", \"showGreasePencilItemPB\")") showGreasePencilItemPB; string $pluginFilters[] = `pluginDisplayFilter -q -listFilters`; if (size($pluginFilters) > 0) { // Sort the plugin display filter list so that the menu items will // be shown in a certain order $pluginFilters = `sort $pluginFilters`; string $playblastExclude[] = {}; if (`optionVar -exists playblastShowPluginObjects`) { $playblastExclude = `optionVar -q playblastShowPluginObjects`; } string $filter; for ($filter in $pluginFilters) { // Generate playblast menu items for each plugin display filter string $label = `pluginDisplayFilter -q -label $filter`; int $value = (stringArrayFind($filter, 0, $playblastExclude) == -1); menuItem -label $label -checkBox $value -enableCommandRepeat false -command ("togglePlayblastMenuItem " + $filter + " #1; updatePlayblastPluginMenus()") ("showPluginObjectsItemPB_" + $filter); } } menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kGridPB")) -checkBox `optionVar -query playblastShowGrid` -enableCommandRepeat false -command ("optionVar -intValue playblastShowGrid #1; updatePlayblastMenus(\"playblastShowGrid\", \"showGridItemPB\")") showGridItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kHeadsUpDisplayPB")) -checkBox `optionVar -query playblastShowHUD` -enableCommandRepeat false -command ("optionVar -intValue playblastShowHUD #1; updatePlayblastMenus(\"playblastShowHUD\", \"showHUDItemPB\")") showHUDItemPB; menuItem -version 2016 -label (uiRes("m_createModelPanelMenu.kHoldOutsPB")) -checkBox `optionVar -query playblastShowHoldOuts` -enableCommandRepeat false -command ("optionVar -intValue playblastShowHoldOuts #1; updatePlayblastMenus(\"playblastShowHoldOuts\", \"showHoldOutsItemPB\")") showHoldOutsItemPB; menuItem -label (uiRes("m_createModelPanelMenu.kSelectionHilightingPB")) -checkBox `optionVar -query playblastShowSelectionHighlighting` -enableCommandRepeat false -command ("optionVar -intValue playblastShowSelectionHighlighting #1; updatePlayblastMenus(\"playblastShowSelectionHighlighting\", \"showSelectionItemPB\")") showSelectionItemPB; } global string $gModelEditorSelectCameraMenuItem = ""; global string $gModelEditorSelectCameraSetMenuItem = ""; // // This procedure is called whenever the user selects the View menu. // global proc postModelEditorSelectCamera( string $editor, string $panel, int $customView ) { if ( $customView ) { string $view = `modelEditor -q -viewType $editor`; if ( $view == "stereoCameraView" ) { string $rigRoot = `stereoCameraView -q -rigRoot $editor`; if ( `objectType -isa "cameraSet" $rigRoot` ) { select -r $rigRoot; return; } else { string $cam = `stereoCameraView -q -centerCamera $editor`; if ( `objectType -isa "camera" $cam` ) { string $parent[] = `listRelatives -parent $cam`; if ( `objExists ($parent[0] + ".proxyRig")` ) { select -r $rigRoot; return; } } } } } string $camera = `modelEditor -q -camera $editor`; eval select `getCameraNode view $camera` `getCameraNode up $camera` $camera; } global proc string getCamerafromViewport(string $panel) { string $camera = ""; if (!size($panel)) return $camera; string $customEditor = `getCustomViewEditorFromPanel( $panel )`; if (size($customEditor)) $camera = `modelEditor -q -camera $customEditor`; else $camera = `modelPanel -q -camera $panel`; if (size($camera) && `objectType -isa "camera" $camera`) { return $camera; } else { string $shapes[] = `listRelatives -shapes -path $camera`; for ($item in $shapes) { if (size($item) && `objectType -isa "camera" $item`) { return $item; } } } warning((uiRes("m_createModelPanelMenu.kFindCameraError"))); return $camera; } global proc viewAlongAxis(string $panel, string $axis) { if(!size($panel)) return; string $camera = getCamerafromViewport($panel); if (!size($camera)) return; switch ($axis) { case "X": viewSet -vx $camera; break; case "Y": viewSet -vy $camera; break; case "Z": viewSet -vz $camera; break; case "-X": viewSet -vnx $camera; break; case "-Y": viewSet -vny $camera; break; case "-Z": viewSet -vnz $camera; break; default: break; } } global proc changeCameraLockStatus(string $panel) { if(!size($panel)) return; string $camera = getCamerafromViewport($panel); if (!size($camera)) return; int $lock = !`camera -q -lt $camera`; camera -e -lt $lock $camera; } global proc int isCameraLocked(string $panel) { if(!size($panel)) return false; string $camera = getCamerafromViewport($panel); int $lock = false; if (size($camera)) $lock = `camera -q -lt $camera`; return $lock; } // Description: If we are looking through a selected object which is not a // camera, return false. e.g. We are looking through a point light. global proc int islookingThroughCamera(string $panel) { if(!size($panel)) return false; string $camera = getCamerafromViewport($panel); if (size($camera) && `objectType -isa "camera" $camera`) { string $results[] = `listRelatives -parent -f -type "transform" $camera`; // If "$camera" is a camera shape, and no transform connects with it, // consider it as a camera. if (!size($results)) return true; if (size($results[0])) $camera = $results[0]; } int $enableLock = false; if(size($camera) && `objectType -isa "transform" $camera`) { string $shapes[] = `listRelatives -shapes $camera`; // Consider "$camera" as a type of camera only when its first shape is camera // shape. // e.g. We're looking through a light, it's not a camera since we assume its // first child node is light shape. // But it's still possible to consider a light as a camera if we set a camera // shape as its first shape node manually. if(size($shapes) && size($shapes[0])) { //MAYA-63036, identify the shape along with its transform. string $path = $camera + "|" + $shapes[0]; $enableLock = `objectType -isa "camera" $path`; } } return $enableLock; } global proc updateCameraMenu(string $parentMenu, string $panel, string $editor, int $isCustomView ) { setParent -m $parentMenu; string $panelType = `getPanel -typeOf $panel`; // We might need to disable some menu's if a cameraSet is being viewed. string $cameraSetUsed = false; if ($panelType == "modelPanel") { string $chosenCameraSet = `modelEditor -q -cameraSet $panel`; if ($chosenCameraSet != "") { $cameraSetUsed = true; } } string $menu; int $scEnabled = false; if( `menu -q -ni $parentMenu` == 0 ) { menuItem -label (uiRes("m_createModelPanelMenu.kSelectCamera")) -command ("postModelEditorSelectCamera " + $editor + " " + $panel + " " + $isCustomView ) selectCamItem ; menuItem -label (uiRes("m_createModelPanelMenu.kCreateCameraFromView")) -command "CreateCameraFromView"; $menu = `menuItem -label (uiRes("m_createModelPanelMenu.kLookThroughSelected")) -command ("lookThroughSelected 0 " + $panel)`; if ($cameraSetUsed) menuItem -e -enable false $menu; $menu = `menuItem -optionBox true -annotation (uiRes("m_createModelPanelMenu.kLookThroughAnnot")) -c ("lookThroughSelected 1 " + $panel )`; if ($cameraSetUsed) menuItem -e -enable false $menu; menuItem -divider true -dividerLabel (uiRes("m_createModelPanelMenu.kProjectionType")); radioMenuItemCollection; menuItem -radioButton true -label (uiRes("m_createModelPanelMenu.kPerspectiveCamera")) -c ("CameraModePerspective") PerspectiveMenuItem; menuItem -radioButton true -label (uiRes("m_createModelPanelMenu.kOrthographicCamera")) -c ("CameraModeOrthographic") OrthographicMenuItem; menuItem -divider true -dividerLabel (uiRes("m_createModelPanelMenu.kCameraFrustrumDisplay")); menuItem -checkBox true -label (uiRes("m_createModelPanelMenu.kClipPlanes")) ClipPlanesMenuItem; menuItem -checkBox true -label (uiRes("m_createModelPanelMenu.kFrustrum")) FrustrumMenuItem; string $imagePlaneMenuName = $editor + "imagePlaneSubMenu_Camera"; menuItem -label (uiRes("m_createModelPanelMenu.kImagePlane")) -subMenu true -tearOff true -postMenuCommand ("buildImagePlaneMenu " + $imagePlaneMenuName + " " + $panel) $imagePlaneMenuName; setParent -m ..; } setParent -m $parentMenu; string $camera = `modelEditor -q -camera $panel`; int $isPerspective = !`camera -q -orthographic $camera`; menuItem -edit -radioButton ($isPerspective) PerspectiveMenuItem; menuItem -edit -radioButton (!$isPerspective) OrthographicMenuItem; int $planesOn = (`getAttr ($camera+".displayCameraNearClip")`); int $frustrumOn = (`getAttr ($camera+".displayCameraFrustum")`); string $setAttrCmd = ("{setAttr "+$camera+".displayCameraNearClip #1; setAttr "+$camera+".displayCameraFarClip #1;}"); menuItem -edit -checkBox $planesOn -c ($setAttrCmd) ClipPlanesMenuItem; $setAttrCmd = ("{setAttr "+$camera+".displayCameraFrustum #1;}"); menuItem -edit -checkBox $frustrumOn -c ($setAttrCmd) FrustrumMenuItem; // TODO // Camera Sets: // en var would look for "using camera sets" and disable some menu items } global proc postModelEditorViewMenuCmd(string $menu, string $panel, string $editor, int $isCustomView ) { setParent -m $menu; int $lock = isCameraLocked($panel); int $enableLockIcon = islookingThroughCamera($panel); int $localTumble = `tumbleCtx -q -localTumble tumbleContext`; if( `menu -q -ni $menu` != 0 ){ menuItem -e -enable (`pluginInfo -q -loaded "modelingToolkit"`) AlignCameraToPolygonMenuItem; menuItem -e -enable $enableLockIcon -checkBox $lock LockCameraItem; menuItem -edit -radioButton (!$localTumble) TumbleOnMostRecentMenuItem; menuItem -edit -radioButton $localTumble TumbleOnCenterOfInterestMenuItem; }else{ if ( `getenv ENABLE_DEFAULT_VIEWPORT_CAMERA_SETS` == 1 ) { menuItem -label (uiRes("m_createModelPanelMenu.kSelectCameraSet")) selectCSetItem; } menuItem -version "2017" -checkBox $lock -label (uiRes("m_createModelPanelMenu.kLockCamera")) -enable $enableLockIcon -command ("changeCameraLockStatus " + $panel) LockCameraItem; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kUndoViewChange")) -command ("UndoViewChange"); menuItem -label (uiRes("m_createModelPanelMenu.kRedoViewChange")) -command ("RedoViewChange"); menuItem -divider true -dividerLabel (uiRes("m_createModelPanelMenu.kTumbleBehaviour")); radioMenuItemCollection; menuItem -radioButton (!$localTumble) -label (uiRes("m_createModelPanelMenu.kRecentSelection")) -command ("tumbleCtx -e -localTumble 0 tumbleContext; tumbleCtx -e -autoSetPivot true tumbleContext;") TumbleOnMostRecentMenuItem; menuItem -radioButton $localTumble -label (uiRes("m_createModelPanelMenu.kCenterOfInterest")) -command ("tumbleCtx -e -localTumble 1 tumbleContext;") TumbleOnCenterOfInterestMenuItem; //tumbleCtx -e -localTumble 0 tumbleContext; tumbleCtx -e -autoSetPivot true tumbleContext; //tumbleCtx -e -localTumble 1 tumbleContext; menuItem -divider true -dividerLabel (uiRes("m_createModelPanelMenu.kChangeView")); menuItem -label (uiRes("m_createModelPanelMenu.kAlignCameraToPolygon")) -version "2014" -enable (`pluginInfo -q -loaded "modelingToolkit"`) -command ("AlignCameraToPolygon") AlignCameraToPolygonMenuItem; menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kCenterViewOfSelection")) -command ("{ string $camera = `modelEditor -q -camera "+$editor+"`;"+ "viewFit -c $camera;}"); // Bug 276541: With the introduction of the ViewCube, the term // 'Home View' came to mean a view chosen by the artist as // being the best from which to view or review the model or // from which to start a tour of the model. To avoid confusion, // what we used to call the camera's 'Default Home' is now called // its 'Default View'. menuItem -label (uiRes("m_createModelPanelMenu.kDefaultView")) -command ("GoToDefaultView"); menuItem -label (uiRes("m_createModelPanelMenu.kFrameAll")) -command ("FrameAll"); menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kFrameSelectionWithoutChildren")) -command ("FrameSelectedWithoutChildren"); $itemName = `menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kFrameSelectionWithChildren")) -command ("FrameSelected")`; $itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kLookAtSelection")) -command ("{ string $camera = `modelEditor -q -camera "+$editor+"`;"+ "viewLookAt $camera;}")`; menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kViewAlongAxis")) -subMenu true -tearOff true; menuItem -label (uiRes("m_createModelPanelMenu.kViewX")) -command ("viewAlongAxis " + $panel + " " + "X"); menuItem -label (uiRes("m_createModelPanelMenu.kViewY")) -command ("viewAlongAxis " + $panel + " " + "Y"); menuItem -label (uiRes("m_createModelPanelMenu.kViewZ")) -command ("viewAlongAxis " + $panel + " " + "Z"); menuItem -label (uiRes("m_createModelPanelMenu.kViewNegativeX")) -command ("viewAlongAxis " + $panel + " " + "-X"); menuItem -label (uiRes("m_createModelPanelMenu.kViewNegativeY")) -command ("viewAlongAxis " + $panel + " " + "-Y"); menuItem -label (uiRes("m_createModelPanelMenu.kViewNegativeZ")) -command ("viewAlongAxis " + $panel + " " + "-Z"); setParent -m ..; menuItem -divider true; $itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kViewBookmarks")) -subMenu true`; menuItem -e -postMenuCommand ("buildCameraBookmarkMenu "+$itemName+" "+$panel) $itemName; setParent -m ..; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kCameraAttributeEditor")) -command ("showPanelCameraEditor "+$panel); menuItem -label (uiRes("m_createModelPanelMenu.kCameraTools")) -subMenu true -tearOff true -aob true camerCtrlItem; menuItem -label (uiRes("m_createModelPanelMenu.kTumbleTool")) -annotation (getRunTimeCommandAnnotation("TumbleTool")) -image "tumble.png" -command ("TumbleTool"); menuItem -optionBox true -command ("TumbleTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kTrackTool")) -annotation (getRunTimeCommandAnnotation("TrackTool")) -image "track.png" -command ("TrackTool"); menuItem -optionBox true -command ("TrackTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kDollyTool")) -annotation (getRunTimeCommandAnnotation("DollyTool")) -image "dolly.png" -command ("DollyTool"); menuItem -optionBox true -command ("DollyTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kZoomTool")) -annotation (getRunTimeCommandAnnotation("ZoomTool")) -image "boxZoom.png" -command ("ZoomTool"); menuItem -optionBox true -command ("ZoomTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kPanZoomTool")) -annotation (getRunTimeCommandAnnotation("PanZoomTool")) -image "camPanZoom.png" -command ("PanZoomTool"); menuItem -optionBox true -command ("PanZoomTool; ToolSettingsWindow"); menuItem -version "2014" -label (uiRes("m_createModelPanelMenu.kGreasePencilTool")) -annotation (getRunTimeCommandAnnotation("GreasePencilTool")) -image "GreasePencil.png" -command ("GreasePencilTool; createGreasePencilWindow()"); menuItem -optionBox true -command ("GreasePencilTool; createGreasePencilWindow(); ToolSettingsWindow"); menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kRollTool")) -annotation (uiRes("m_createModelPanelMenu.kRollToolAnnot")) -image "roll.png" -command "setToolTo rollContext"; menuItem -optionBox true -command "setToolTo rollContext; toolPropertyWindow"; menuItem -label (uiRes("m_createModelPanelMenu.kAzimuthElevationTool")) -annotation (uiRes("m_createModelPanelMenu.kAzimuthElevationToolAnnot")) -image "azimuthElevation.png" -command "setToolTo azimuthElevationContext"; menuItem -optionBox true -command "setToolTo azimuthElevationContext; toolPropertyWindow"; menuItem -label (uiRes("m_createModelPanelMenu.kYawPitchTool")) -annotation (uiRes("m_createModelPanelMenu.kYawPitchToolAnnot")) -image "yawPitch.png" -command "setToolTo yawPitchContext"; menuItem -optionBox true -command "setToolTo yawPitchContext; toolPropertyWindow"; menuItem -label (uiRes("m_createModelPanelMenu.kFlyTool")) -annotation (uiRes("m_createModelPanelMenu.kFlyToolAnnot")) -command "setToolTo flyThroughContext"; menuItem -label (uiRes("m_createModelPanelMenu.kWalkTool")) -version 2015 -annotation (getRunTimeCommandAnnotation("WalkTool")) -image "walk.png" -command "WalkTool"; menuItem -optionBox true -command "WalkTool; toolPropertyWindow"; setParent -menu ..; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kSetSequencerView")) -annotation (uiRes("m_createModelPanelMenu.kSetSequencerViewAnnot")) -command ("sequenceManager -modelPanel " + $editor); } if ( `getenv ENABLE_DEFAULT_VIEWPORT_CAMERA_SETS` == 1 ) { string $panelToUse = $panel; if ($panelToUse == "") { $panelToUse = `modelEditor -q -panel $editor`; } // Check to see if the modelPanel controls a cameraSet. if ($panelToUse != "") { if (`getPanel -typeOf $panelToUse` == "modelPanel") { int $cameraSetUsed = false; string $chosenCameraSet = `modelEditor -q -cameraSet $panelToUse`; if ($chosenCameraSet != "") $cameraSetUsed = true; string $panelControl = `panel -q -control $panel`; if ( `menuBarLayout -exists $panelControl` ){ string $modelEditorSelectCameraSetMenuItem = ($panelControl + "|View|selectCSetItem"); menuItem -e -enable $cameraSetUsed $modelEditorSelectCameraSetMenuItem; if ($cameraSetUsed) { string $cmdString = "select " + $chosenCameraSet; menuItem -e -command $cmdString $modelEditorSelectCameraSetMenuItem; } } } } setFocus $editor; } } global proc postModelEditorViewMenuCmd_Old(string $menu, string $panel, string $editor, int $isCustomView ) { setParent -m $menu; int $lock = isCameraLocked($panel); int $enableLockIcon = islookingThroughCamera($panel); if( `menu -q -ni $menu` != 0 ){ menuItem -e -enable (`pluginInfo -q -loaded "modelingToolkit"`) AlignCameraToPolygonMenuItem; menuItem -e -enable $enableLockIcon -checkBox $lock LockCameraItem; }else{ menuItem -label (uiRes("m_createModelPanelMenu.kSelectCamera")) -command ("postModelEditorSelectCamera " + $editor + " " + $panel + " " + $isCustomView ) selectCamItem ; if ( `getenv ENABLE_DEFAULT_VIEWPORT_CAMERA_SETS` == 1 ) { menuItem -label (uiRes("m_createModelPanelMenu.kSelectCameraSet")) selectCSetItem; } menuItem -version "2017" -checkBox $lock -label (uiRes("m_createModelPanelMenu.kLockCamera")) -enable $enableLockIcon -command ("changeCameraLockStatus " + $panel) LockCameraItem; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kCreateCameraFromView")) -version "2014" -command "CreateCameraFromView"; menuItem -label (uiRes("m_createModelPanelMenu.kCycleThroughCameras")) -version "2014" -command "CycleThroughCameras"; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kUndoViewChange")) -command ("UndoViewChange"); menuItem -label (uiRes("m_createModelPanelMenu.kRedoViewChange")) -command ("RedoViewChange"); // Bug 276541: With the introduction of the ViewCube, the term // 'Home View' came to mean a view chosen by the artist as // being the best from which to view or review the model or // from which to start a tour of the model. To avoid confusion, // what we used to call the camera's 'Default Home' is now called // its 'Default View'. menuItem -label (uiRes("m_createModelPanelMenu.kDefaultView")) -command ("GoToDefaultView"); menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kViewAlongAxis")) -subMenu true -tearOff true; menuItem -label (uiRes("m_createModelPanelMenu.kViewX")) -command ("viewAlongAxis " + $panel + " " + "X"); menuItem -label (uiRes("m_createModelPanelMenu.kViewY")) -command ("viewAlongAxis " + $panel + " " + "Y"); menuItem -label (uiRes("m_createModelPanelMenu.kViewZ")) -command ("viewAlongAxis " + $panel + " " + "Z"); menuItem -label (uiRes("m_createModelPanelMenu.kViewNegativeX")) -command ("viewAlongAxis " + $panel + " " + "-X"); menuItem -label (uiRes("m_createModelPanelMenu.kViewNegativeY")) -command ("viewAlongAxis " + $panel + " " + "-Y"); menuItem -label (uiRes("m_createModelPanelMenu.kViewNegativeZ")) -command ("viewAlongAxis " + $panel + " " + "-Z"); setParent -m ..; menuItem -d true; $itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kLookAtSelection")) -command ("{ string $camera = `modelEditor -q -camera "+$editor+"`;"+ "viewLookAt $camera;}")`; menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kCenterViewOfSelection")) -command ("{ string $camera = `modelEditor -q -camera "+$editor+"`;"+ "viewFit -c $camera;}"); menuItem -label (uiRes("m_createModelPanelMenu.kFrameAll")) -command ("FrameAll"); menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kFrameSelectionWithoutChildren")) -command ("FrameSelectedWithoutChildren"); $itemName = `menuItem -version "2017" -label (uiRes("m_createModelPanelMenu.kFrameSelectionWithChildren")) -command ("FrameSelected")`; menuItem -label (uiRes("m_createModelPanelMenu.kAlignCameraToPolygon")) -version "2014" -enable (`pluginInfo -q -loaded "modelingToolkit"`) -command ("AlignCameraToPolygon") AlignCameraToPolygonMenuItem; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kPredefinedBookmarks")) -subMenu true -tearOff true; menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kPerspective")) -command ("viewSet -p `modelEditor -q -camera "+$editor+"`;"); menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kFront")) -command ("viewSet -f `modelEditor -q -camera "+$editor+"`;"); menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kTop")) -command ("viewSet -t `modelEditor -q -camera "+$editor+"`;"); menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kRightSide")) -command ("viewSet -rs `modelEditor -q -camera "+$editor+"`;"); menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kLeftSide")) -command ("viewSet -ls `modelEditor -q -camera "+$editor+"`;"); menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kBack")) -command ("viewSet -b `modelEditor -q -camera "+$editor+"`;"); menuItem -ecr 0 -label (uiRes("m_createModelPanelMenu.kBottom")) -command ("viewSet -bo `modelEditor -q -camera "+$editor+"`;"); setParent -m ..; $itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kViewBookmarks")) -subMenu true`; menuItem -e -postMenuCommand ("buildCameraBookmarkMenu "+$itemName+" "+$panel) $itemName; setParent -m ..; menuItem -divider true; $itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kCameraSettings")) -subMenu true -tearOff true`; menuItem -e -postMenuCommand ("buildCameraToggleMenu "+$itemName+" "+$panel) $itemName; if ($isCustomView) menuItem -edit -enable false $itemName; setParent -m ..; menuItem -label (uiRes("m_createModelPanelMenu.kCameraAttributeEditor")) -command ("showPanelCameraEditor "+$panel); menuItem -label (uiRes("m_createModelPanelMenu.kCameraTools")) -subMenu true -tearOff true -aob true camerCtrlItem; menuItem -label (uiRes("m_createModelPanelMenu.kTumbleTool")) -annotation (getRunTimeCommandAnnotation("TumbleTool")) -image "tumble.png" -command ("TumbleTool"); menuItem -optionBox true -command ("TumbleTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kTrackTool")) -annotation (getRunTimeCommandAnnotation("TrackTool")) -image "track.png" -command ("TrackTool"); menuItem -optionBox true -command ("TrackTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kDollyTool")) -annotation (getRunTimeCommandAnnotation("DollyTool")) -image "dolly.png" -command ("DollyTool"); menuItem -optionBox true -command ("DollyTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kZoomTool")) -annotation (getRunTimeCommandAnnotation("ZoomTool")) -image "boxZoom.png" -command ("ZoomTool"); menuItem -optionBox true -command ("ZoomTool; ToolSettingsWindow"); menuItem -label (uiRes("m_createModelPanelMenu.kPanZoomTool")) -annotation (getRunTimeCommandAnnotation("PanZoomTool")) -image "camPanZoom.png" -command ("PanZoomTool"); menuItem -optionBox true -command ("PanZoomTool; ToolSettingsWindow"); menuItem -version "2014" -label (uiRes("m_createModelPanelMenu.kGreasePencilTool")) -annotation (getRunTimeCommandAnnotation("GreasePencilTool")) -image "GreasePencil.png" -command ("GreasePencilTool; createGreasePencilWindow()"); menuItem -optionBox true -command ("GreasePencilTool; createGreasePencilWindow(); ToolSettingsWindow"); menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kRollTool")) -annotation (uiRes("m_createModelPanelMenu.kRollToolAnnot")) -image "roll.png" -command "setToolTo rollContext"; menuItem -optionBox true -command "setToolTo rollContext; toolPropertyWindow"; menuItem -label (uiRes("m_createModelPanelMenu.kAzimuthElevationTool")) -annotation (uiRes("m_createModelPanelMenu.kAzimuthElevationToolAnnot")) -image "azimuthElevation.png" -command "setToolTo azimuthElevationContext"; menuItem -optionBox true -command "setToolTo azimuthElevationContext; toolPropertyWindow"; menuItem -label (uiRes("m_createModelPanelMenu.kYawPitchTool")) -annotation (uiRes("m_createModelPanelMenu.kYawPitchToolAnnot")) -image "yawPitch.png" -command "setToolTo yawPitchContext"; menuItem -optionBox true -command "setToolTo yawPitchContext; toolPropertyWindow"; menuItem -label (uiRes("m_createModelPanelMenu.kFlyTool")) -annotation (uiRes("m_createModelPanelMenu.kFlyToolAnnot")) -command "setToolTo flyThroughContext"; menuItem -label (uiRes("m_createModelPanelMenu.kWalkTool")) -version 2015 -annotation (getRunTimeCommandAnnotation("WalkTool")) -image "walk.png" -command "WalkTool"; menuItem -optionBox true -command "WalkTool; toolPropertyWindow"; setParent -menu ..; menuItem -divider true; string $imagePlaneMenuName = $editor + "imagePlaneSubMenu"; menuItem -label (uiRes("m_createModelPanelMenu.kImagePlane")) -subMenu true -tearOff true $imagePlaneMenuName; menuItem -e -postMenuCommand ("buildImagePlaneMenu " + $imagePlaneMenuName + " " + $panel) $imagePlaneMenuName; setParent -m ..; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kSetSequencerView")) -annotation (uiRes("m_createModelPanelMenu.kSetSequencerViewAnnot")) -command ("sequenceManager -modelPanel " + $editor); } if ( `getenv ENABLE_DEFAULT_VIEWPORT_CAMERA_SETS` == 1 ) { string $panelToUse = $panel; if ($panelToUse == "") { $panelToUse = `modelEditor -q -panel $editor`; } // Check to see if the modelPanel controls a cameraSet. if ($panelToUse != "") { if (`getPanel -typeOf $panelToUse` == "modelPanel") { int $cameraSetUsed = false; string $chosenCameraSet = `modelEditor -q -cameraSet $panelToUse`; if ($chosenCameraSet != "") $cameraSetUsed = true; string $panelControl = `panel -q -control $panel`; if ( `menuBarLayout -exists $panelControl` ){ string $modelEditorSelectCameraMenuItem = ($panelControl + "|View|selectCamItem"); string $modelEditorSelectCameraSetMenuItem = ($panelControl + "|View|selectCSetItem"); menuItem -e -enable (!$cameraSetUsed) $modelEditorSelectCameraMenuItem; menuItem -e -enable $cameraSetUsed $modelEditorSelectCameraSetMenuItem; if ($cameraSetUsed) { string $cmdString = "select " + $chosenCameraSet; menuItem -e -command $cmdString $modelEditorSelectCameraSetMenuItem; } } } } setFocus $editor; } } global string $gModelPanelShowMenus[] = {}; global proc createModelPanelMenuDoIt( string $panel, string $ed, string $subset[], string $extra[], string $extraCmd[] ) { global string $gModelEditorSelectCameraMenuItem; global string $gModelEditorSelectCameraSetMenuItem; // if this menu has already been built, return // if ( $panel != "" ) { string $panelControl = `panel -q -control $panel`; if ( `menuBarLayout -exists $panelControl` ){ string $ma[] = `menuBarLayout -q -menuArray $panelControl`; if ( size( $ma ) > 0 ) { return; } setParent $panelControl; } } // By the time we get here, we know the menu bar // of the modelPanel is the current menu bar // // Get the name of the model editor from the panel if the editor name // was not given. // if ( $panel != "" && $ed == "" ) { $ed = `modelPanel -q -modelEditor $panel`; } // Check for a custom view int $isCustomView = 0; string $customEditor = `getCustomViewEditorFromPanel( $panel )`; if (size($customEditor)) { $ed = $customEditor; $isCustomView = 1; } int $all_menus = ( size( $subset ) == 0 ); string $itemName; int $RevertToLegacyCameraMenus = 1; string $menuName; if (0 == $RevertToLegacyCameraMenus) { // Create the Camera menu. // $menuName = (uiRes("m_createModelPanelMenu.kCamera")); if ( $all_menus || stringArrayContains( $menuName, $subset ) ) { $itemName = `menu -tearOff true -aob true -label $menuName -postMenuCommandOnce false -familyImage "menuIconShading.png"`; menu -edit -pmc ("updateCameraMenu " + $itemName +" " + $panel + " " + $ed + " " + $isCustomView) $itemName; } } // Create the View menu. // $menuName = (uiRes("m_createModelPanelMenu.kView")); if ( $all_menus || stringArrayContains( $menuName, $subset ) ) { $itemName = `menu -tearOff true -label $menuName -familyImage "menuIconView.png" View`; if (0 == $RevertToLegacyCameraMenus) menu -edit -pmc ("postModelEditorViewMenuCmd " + $itemName +" " + $panel + " " + $ed + " " + $isCustomView) $itemName; else menu -edit -pmc ("postModelEditorViewMenuCmd_Old " + $itemName +" " + $panel + " " + $ed + " " + $isCustomView) $itemName; } // Create the Shading menu. // $menuName = (uiRes("m_createModelPanelMenu.kShading")); if ( $all_menus || stringArrayContains( $menuName, $subset ) ) { $itemName = `menu -tearOff true -aob true -label $menuName -postMenuCommandOnce false -familyImage "menuIconShading.png"`; menu -edit -pmc ("updateShadingMenu "+$itemName+" "+$ed) $itemName; } // Create the Lighting menu. // $menuName = (uiRes("m_createModelPanelMenu.kLighting")); if ( $all_menus || stringArrayContains( $menuName, $subset ) ) { $itemName = `menu -tearOff true -label $menuName -postMenuCommandOnce false -familyImage "menuIconLighting.png"`; menu -e -pmc ("updateLightingMenu "+$itemName+" "+$ed) $itemName; } // Create the Show menu. // $menuName = (uiRes("m_createModelPanelMenu.kShow")); if ( $all_menus || stringArrayContains( $menuName, $subset ) ) { $itemName = `menu -tearOff true -label $menuName -postMenuCommandOnce false -familyImage "menuIconShow.png"`; // Save the Show menu name global string $gModelPanelShowMenus[]; if (!stringArrayContains($itemName, $gModelPanelShowMenus)) { string $itemList[] = {$itemName}; $gModelPanelShowMenus = stringArrayCatenate($itemList, $gModelPanelShowMenus); } string $playBlastMenu = (uiRes("m_createModelPanelMenu.kPlayblastDisplay")); if( !( $all_menus || stringArrayContains( $playBlastMenu, $subset ) ) ){ $playBlastMenu = ""; } menu -e -pmc ("updateShowMenu "+$itemName+" "+$ed+" \""+$panel+"\" \""+$playBlastMenu+"\"") $itemName; } // Create the Renderer menu. // $menuName = (uiRes("m_createModelPanelMenu.kRenderer")); if ( $all_menus || stringArrayContains( $menuName, $subset ) ) { $itemName = `menu -tearOff true -label $menuName -aob true -postMenuCommandOnce false`; menu -edit -postMenuCommand ("buildRendererMenu " + $itemName + " " + $ed) $itemName; } // Create any extra menuBar menus the user requested. // int $i, $nx = size( $extra ); for ( $i = 0; $i < $nx; $i++ ) { $itemName = `menu -tearOff true -l $extra[$i] -postMenuCommandOnce false -familyImage "menuIconShow.png"`; menu -e -pmc ($extraCmd[$i]+" "+$itemName+" "+$ed) $itemName; } setParent -m ..; // Panel menu only appears in embedded (not floating) editor windows. // $menuName = (uiRes("m_createModelPanelMenu.kPanels")); if ( $panel != "" && ( $all_menus || stringArrayContains( $menuName, $subset ) ) ) { buildPanelPopupMenu( $panel ); } } // Create the contents of the menubar for a modelPanel. // global proc createModelPanelMenu( string $panel ) { string $subset[], $extra[], $extraCmd[]; createModelPanelMenuDoIt( $panel, "", $subset, $extra, $extraCmd ); } global proc updateAllModelEditorsToShadingSetting( string $menu, string $ed ) // // Update all model editors to have the same settings as this one // // { string $shadeMode = `modelEditor -q -displayAppearance $ed`; string $interactiveShadeMode = `modelEditor -q -interactive -displayAppearance $ed`; int $xray = `modelEditor -q -xray $ed`; int $transpSort = `modelEditor -q -st $ed`; int $useInteractiveMode = `modelEditor -q -useInteractiveMode $ed`; int $activeOnly = `modelEditor -q -activeOnly $ed`; int $culling = `modelEditor -q -backfaceCulling $ed`; int $wireOnShaded = `modelEditor -q -wireframeOnShaded $ed`; int $textures = `modelEditor -q -displayTextures $ed`; int $fogging = `modelEditor -q -fogging $ed`; int $backingStore = `modelEditor -q -wbs $ed`; int $smoothWireframe = `modelEditor -q -smoothWireframe $ed`; int $lineWidth = `modelEditor -q -lineWidth $ed`; string $rendererUsed = `modelEditor -q -rnm $ed`; // HW Renderer options. int $colorRes[2] = `modelEditor -q -crz $ed`; int $bumpRes[2] = `modelEditor -q -brz $ed`; string $transpAlg = `modelEditor -q -tal $ed`; string $cullOverride = `modelEditor -q -cov $ed`; int $lowQualLighting = `modelEditor -q -lql $ed`; int $transpInShadows = `modelEditor -q -tis $ed`; string $editors[] = `getPanel -type "modelPanel"`; for ( $editor in $editors ) { modelEditor -edit -displayAppearance $shadeMode -xray $xray -st $transpSort -useInteractiveMode $useInteractiveMode -activeOnly $activeOnly -wbs $backingStore -backfaceCulling $culling -wireframeOnShaded $wireOnShaded -fogging $fogging -displayTextures $textures -smoothWireframe $smoothWireframe -lineWidth $lineWidth -rnm $rendererUsed -crz $colorRes[0] $colorRes[0] -brz $bumpRes[0] $bumpRes[0] -tal $transpAlg -cov $cullOverride -tis $transpInShadows -lql $lowQualLighting $editor; modelEditor -edit -interactive -displayAppearance $interactiveShadeMode $editor; } } global proc updateShadingMenu( string $menu, string $ed ) // // This updates the shading menu, based on the current settings // of the model editor // { int $enableLegacy = isLegacyViewportEnabled(); setParent -m $menu; if( `menu -q -ni $menu` == 0 ){ // Create menu items // radioMenuItemCollection; menuItem -radioButton true -label (uiRes("m_createModelPanelMenu.kWireframe")) -command ("DisplayWireframe") shadeWireItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kSmoothShadeAll")) -command ("modelEditor -edit -displayAppearance smoothShaded -activeOnly false " + $ed) shadeSmoothItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kSmoothShadeSelectedItems")) -command ("modelEditor -edit -displayAppearance smoothShaded -activeOnly true " + $ed) shadeSmoothSelectedItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kFlatShadeAll")) -command ("modelEditor -edit -displayAppearance flatShaded -activeOnly false " + $ed) shadeFlatItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kFlatShadeSelectedItems")) -command ("modelEditor -edit -displayAppearance flatShaded -activeOnly true " + $ed) shadeFlatSelectedItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kBoundingBox")) -command ("modelEditor -edit -displayAppearance boundingBox " + $ed) shadeBBoxItem; if ($enableLegacy) { menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kPoints")) -command ("modelEditor -edit -displayAppearance points " + $ed) shadePointsItem; } menuItem -divider true; menuItem -checkBox 1 -label (uiRes("m_createModelPanelMenu.kUseDefaultMaterial")) -command ("modelEditor -e -udm #1 "+$ed) useDefaultMaterialItem; menuItem -checkBox 1 -label (uiRes("m_createModelPanelMenu.kWireframeShaded")) -command ("setWireframeOnShadedOption #1 "+$ed) wireOnShadedItem; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kXRay")) -command ("setXrayOption #1 "+$ed) xrayItem; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kXRayJoints")) -command ("modelEditor -e -jointXray #1 "+$ed) xrayJointsItem; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kXRayActiveComps")) -command ("modelEditor -e -activeComponentsXray #1 "+ $ed) xrayActiveCompsItem; if ($enableLegacy) { menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kObjectTransparencySort")) -command ("modelEditor -e -st #1 "+$ed) -annotation (uiRes("m_createModelPanelMenu.kObjectTransparencySortAnnot")) transpSortItem; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kPolygonTransparencySort")) -command ("togglePrimTransparencySorting #1 " + $ed) -annotation (uiRes("m_createModelPanelMenu.kPolygonTransparencySortAnnot")) transpPrimSortItem; menuItem -divider true; menuItem -checkBox 1 -label (uiRes("m_createModelPanelMenu.kInteractiveShading")) -command ("toggleInteractiveShading #1 " + $ed) interactiveShadingItem; menuItem -enableCommandRepeat false -optionBox 1 -command ("interactiveShadingOptions "+$ed) hwRenderShadeOptionBoxItem; } menuItem -d true; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kBackfaceCulling")) -command ("ToggleBackfaceCulling") -annotation (getRunTimeCommandAnnotation("ToggleBackfaceCulling")) backFaceCullingItem; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kSmoothWireframe")) -command ("setAttr hardwareRenderingGlobals.lineAAEnable #1; modelEditor -e -smoothWireframe #1 " +$ed) smoothWireframeItem; //menuItem -label _L10N( kLineWidth, "Thicker lines..." ) //-annotation _L10N(kLineWidthAnnot, "Controls thickness of all wireframe lines displayed.") //-command ("displayLineWidthOptionBox "+$ed) //lineWidthItem; menuItem -d true; menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kHardwareTexturing")) -command ("modelEditor -e -displayTextures #1 "+$ed) dispTexItem; if ($enableLegacy) { menuItem -enableCommandRepeat false -optionBox 1 -command ("displayTexturedOptionBox "+$ed) dispTexOptionItem; } menuItem -checkBox false -label (uiRes("m_createModelPanelMenu.kHardwareFog")) -command ("modelEditor -e -fogging #1 "+$ed) dispFogItem; menuItem -enableCommandRepeat false -optionBox 1 -command ("hwFogOptions 1 "+$ed) dispFogOptionItem; menuItem -version 2016 -checkBox true -label (uiRes("m_createModelPanelMenu.kDepthOfFieldPreview")) -command ("modelEditor -e -depthOfFieldPreview #1 "+$ed) -annotation (uiRes("m_createModelPanelMenu.kDepthOfFieldPreviewAnnot")) previewDofItem; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kApplyCurrent")) -command ( "updateAllModelEditorsToShadingSetting( \"" + $menu + "\", \"" + $ed + "\")" ) updateAllViewsItem; } string $shadeMode = `modelEditor -q -displayAppearance $ed`; string $interactiveShadeMode = `modelEditor -q -interactive -displayAppearance $ed`; int $xray = `modelEditor -q -xray $ed`; int $xrayJoints = `modelEditor -q -jointXray $ed`; int $xrayActiveComps = `modelEditor -q -activeComponentsXray $ed`; int $transpSort = `modelEditor -q -st $ed`; string $transpPrimSort = `modelEditor -q -tal $ed`; int $useInteractiveMode = `modelEditor -q -useInteractiveMode $ed`; int $activeOnly = `modelEditor -q -activeOnly $ed`; int $culling = `modelEditor -q -backfaceCulling $ed`; int $fogging = `modelEditor -q -fogging $ed`; int $textures = `modelEditor -q -displayTextures $ed`; int $backingStore = `modelEditor -q -wbs $ed`; int $smoothWireframe = `modelEditor -q -smoothWireframe $ed`; int $useDefaultMaterial = `modelEditor -q -udm $ed`; int $depthOfFieldPreview = `modelEditor -q -depthOfFieldPreview $ed`; int $modeIsShaded = false; // Check the renderer used string $rendererUsed = getViewportRenderer($ed); global string $gHighQualityViewport; global string $gViewport2; int $inHwRendererMode = ($rendererUsed == $gHighQualityViewport); int $isV2RendererMode = ($rendererUsed == $gViewport2); menuItem -e -checkBox `modelEditor -q -wos $ed` wireOnShadedItem; // Set the radio buttons to reflect which display // style is selected // switch($shadeMode){ case "wireframe": menuItem -e -radioButton true shadeWireItem; break; case "points": if ($enableLegacy) menuItem -e -radioButton true shadePointsItem; break; case "boundingBox": menuItem -e -radioButton true shadeBBoxItem; break; case "smoothShaded": $modeIsShaded = true; if ( $activeOnly ){ menuItem -e -radioButton true shadeSmoothSelectedItem; } else { menuItem -e -radioButton true shadeSmoothItem; } break; case "flatShaded": $modeIsShaded = true; if ( $activeOnly ){ menuItem -e -radioButton true shadeFlatSelectedItem; } else { menuItem -e -radioButton true shadeFlatItem; } break; default: break; } menuItem -e -checkBox $xray xrayItem; menuItem -e -checkBox $xrayJoints xrayJointsItem; menuItem -e -checkBox $xrayActiveComps xrayActiveCompsItem; if ($enableLegacy) { menuItem -e -checkBox $transpSort transpSortItem; int $checkTranspPrim = ($transpPrimSort == "perPolygonSort"); menuItem -e -checkBox $checkTranspPrim transpPrimSortItem; } menuItem -e -checkBox $textures dispTexItem; menuItem -e -checkBox $fogging dispFogItem; menuItem -e -checkBox $culling backFaceCullingItem; menuItem -e -checkBox $smoothWireframe smoothWireframeItem; menuItem -e -checkBox $useDefaultMaterial useDefaultMaterialItem; menuItem -e -checkBox $depthOfFieldPreview previewDofItem; // Set the radio buttons to reflect which interactive // mode is selected // if ($enableLegacy) menuItem -e -checkBox $useInteractiveMode interactiveShadingItem; string $pcamera = `modelEditor -q -camera $ed`; int $isOrtho = `getAttr ($pcamera+".orthographic")`; menuItem -e -enable false -checkBox $fogging dispFogItem; menuItem -e -enable false dispFogOptionItem; menuItem -e -enable false -checkBox $depthOfFieldPreview previewDofItem; if ( $modeIsShaded ) { menuItem -e -en true useDefaultMaterialItem; menuItem -e -en true wireOnShadedItem; //menuItem -e -en true lineWidthItem; // A number of items are not supported in hw renderer mode // if ($inHwRendererMode) { menuItem -edit -enable false xrayItem; menuItem -e -en false dispFogItem; menuItem -e -en false dispFogOptionItem; menuItem -e -en false previewDofItem; if ($enableLegacy) menuItem -e -en false transpSortItem; menuItem -e -en false backFaceCullingItem; menuItem -e -en false useDefaultMaterialItem; if ($enableLegacy) { if ($useDefaultMaterial) menuItem -e -en false transpPrimSortItem; else menuItem -e -en true transpPrimSortItem; } } else { if ($enableLegacy) { // transpSort is disabled in default material mode if ($useDefaultMaterial) { menuItem -e -en false transpSortItem; menuItem -e -en false transpPrimSortItem; } else { menuItem -e -en true transpSortItem; menuItem -e -en true transpPrimSortItem; } } menuItem -e -en true backFaceCullingItem; if ($isV2RendererMode) { string $cam = `modelEditor -query -camera $ed`; menuItem -e -en `camera -q -depthOfField $cam` previewDofItem; } if ($isOrtho == 0) { menuItem -e -en true dispFogItem; menuItem -e -en true dispFogOptionItem; } } // Textured display mode is disabled in default material mode. if ($useDefaultMaterial) { menuItem -e -en false dispTexItem; if ($enableLegacy) menuItem -e -en false dispTexOptionItem; } else { menuItem -e -en true dispTexItem; if ($enableLegacy) menuItem -e -en true dispTexOptionItem; } } else { menuItem -e -en false useDefaultMaterialItem; if ($enableLegacy) { menuItem -e -en false transpSortItem; menuItem -e -en false transpPrimSortItem; } menuItem -e -en false backFaceCullingItem; menuItem -e -en false dispTexItem; if ($enableLegacy) menuItem -e -en false dispTexOptionItem; } int $notV2RendererMode = !($isV2RendererMode); if ($enableLegacy) { menuItem -e -en $notV2RendererMode interactiveShadingItem; menuItem -e -en $notV2RendererMode shadePointsItem; } if ($isV2RendererMode) { menuItem -e -checkBox `getAttr hardwareRenderingGlobals.lineAAEnable` smoothWireframeItem; if ($enableLegacy) { menuItem -e -en false transpPrimSortItem; menuItem -e -en false transpSortItem; menuItem -e -en false dispTexOptionItem; } } } global proc updateLightingMenu( string $menu, string $ed ) // // This updates the lighting menu, based on the current settings // of the model editor // { global string $gHighQualityViewport; global string $gLegacyViewport; setParent -m $menu; if( `menu -q -ni $menu` == 0 ){ radioMenuItemCollection; menuItem -radioButton true -label (uiRes("m_createModelPanelMenu.kUseDefaultLighting")) -command ("modelEditor -e -dl \"default\" "+$ed) lightDefaultItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kUseAllLights")) -command ("DisplayLight") lightAllItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kUseSelectedLights")) -command ("modelEditor -e -dl active "+$ed) lightActiveItem; menuItem -version 2015 -radioButton false -label (uiRes("m_createModelPanelMenu.kUseFlatLighting")) -command ("modelEditor -e -dl flat "+$ed) lightFlatItem; menuItem -radioButton false -label (uiRes("m_createModelPanelMenu.kUseNoLights")) -command ("modelEditor -e -dl none "+$ed) lightNoneItem; menuItem -divider true; menuItem -checkBox false -enable true -label (uiRes("m_createModelPanelMenu.kTwoSidedLighting")) -command ("modelEditor -e -twoSidedLighting #1 "+$ed) lightTwoSidedItem; menuItem -checkBox false -enable true -label (uiRes("m_createModelPanelMenu.kShadows")) -command ("modelEditor -e -shadows #1 "+$ed) lightHardwareShadows; } string $lightingMode = `modelEditor -q -displayLights $ed`; int $twoSidedLighting = `modelEditor -q -twoSidedLighting $ed`; int $shadows = `modelEditor -q -shadows $ed`; menuItem -e -checkBox $twoSidedLighting lightTwoSidedItem; string $pcamera = `modelEditor -q -camera $ed`; int $isOrtho = `getAttr ($pcamera+".orthographic")`; // When the menuItem was in a disabled state, but is enabled through // a script during a file loading, the menuItem cannot be disabled. // Hence, by setting it to be enabled before disabling it will // synch the state of the menuItem properly. // menuItem -e -enable true lightHardwareShadows; menuItem -e -enable false -checkBox $shadows lightHardwareShadows; switch($lightingMode){ case "selected": menuItem -e -enable true lightHardwareShadows; break; case "active": menuItem -e -radioButton true lightActiveItem; menuItem -e -enable true lightHardwareShadows; break; case "all": menuItem -e -radioButton true lightAllItem; menuItem -e -enable true lightHardwareShadows; break; case "flat": menuItem -e -enable true lightFlatItem; break; case "none": menuItem -e -enable true lightNoneItem; break; case "default": menuItem -e -radioButton true lightDefaultItem; break; } string $rendererUsed = `modelEditor -q -rnm $ed`; // It is a bit tricky for the flat lighting/no light mode. // VP1 supports flat lighting mode, but not no light mode. // HW Renderer supports no light mode, but not flat lighting mode. // VP2 supports both of the modes. // Any Plug-in renderers supports both of the modes, by default. int $isNotV1RendererMode = (`strcmp $rendererUsed $gLegacyViewport` != 0); int $isNotHwRendererMode = (`strcmp $rendererUsed $gHighQualityViewport` != 0); menuItem -e -enable ( $isNotV1RendererMode ) lightNoneItem; menuItem -e -enable ( $isNotHwRendererMode) lightFlatItem; } global proc updateShowMenu( string $menu, string $ed, string $panel, string $playBlastMenu ) // // This updates the viewport display menu, based on current model editor settings. // { setParent -m $menu; if( `menu -q -ni $menu` == 0 ){ $itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kIsolateSelect")) -subMenu true -tearOff true`; menuItem -e -pmc ("updateIsolateMenu "+$itemName+" "+$ed+" \""+$panel+"\"") $itemName; setParent -m ..; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kAll")) -enableCommandRepeat false -command ("modelEditor -e -allObjects 1 " + $ed + ";updateShowMenu "+$menu+" "+$ed+" \""+$panel+"\" \""+$playBlastMenu+"\"") showAllItem; menuItem -label (uiRes("m_createModelPanelMenu.kNone")) -enableCommandRepeat false -command ("modelEditor -e -allObjects 0 " + $ed + ";updateShowMenu "+$menu+" "+$ed+" \""+$panel+"\" \""+$playBlastMenu+"\"") showNoneItem; menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kControllers")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -controllers #1 " + $ed) showControllersItem; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSCurves")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -nurbsCurves #1 " + $ed) showNurbsCurvesItem; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSSurfaces")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -nurbsSurfaces #1 " + $ed + ";modelEditor -e -hos #1 " + $ed) showNurbsSurfacesItem; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSCVs")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -cv #1 " + $ed) showNurbsCVsItem; menuItem -label (uiRes("m_createModelPanelMenu.kNURBSHulls")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -hulls #1 " + $ed) showNurbsHullsItem; menuItem -label (uiRes("m_createModelPanelMenu.kPolygons")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -polymeshes #1 " + $ed + ";modelEditor -e -hos #1 " + $ed) showPolymeshesItem; menuItem -label (uiRes("m_createModelPanelMenu.kSubdivSurfaces")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -subdivSurfaces #1 " + $ed) showSubdivSurfacesItem; menuItem -label (uiRes("m_createModelPanelMenu.kPlanes")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -planes #1 " + $ed) showPlanesItem; menuItem -label (uiRes("m_createModelPanelMenu.kLights")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -lights #1 " + $ed) showLightsItem; menuItem -label (uiRes("m_createModelPanelMenu.kCameras")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -cameras #1 " + $ed) showCamerasItem; menuItem -label (uiRes("m_createModelPanelMenu.kImagePlanes")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -imagePlane #1 " + $ed) showImagePlaneItem; menuItem -label (uiRes("m_createModelPanelMenu.kJoints")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -joints #1 " + $ed) showJointsItem; menuItem -ltVersion "2015" -label (uiRes("m_createModelPanelMenu.kIKHandles")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -ikHandles #1 " + $ed) showIkHandlesItem; menuItem -label (uiRes("m_createModelPanelMenu.kDeformers")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -deformers #1 " + $ed) showDeformersItem; menuItem -label (uiRes("m_createModelPanelMenu.kDynamics")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -dynamics #1 " + $ed) showDynamicsItem; menuItem -version 2015 -label (uiRes("m_createModelPanelMenu.kParticleInstancers")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -particleInstancers #1 " + $ed) showParticleInstancersItem; menuItem -label (uiRes("m_createModelPanelMenu.kFluids")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -fluids #1 " + $ed) showFluidsItem; menuItem -label (uiRes("m_createModelPanelMenu.kHairSystems")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -hairSystems #1 " + $ed) showHairSystemsItem; menuItem -label (uiRes("m_createModelPanelMenu.kFollicles")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -follicles #1 " + $ed) showFolliclesItem; menuItem -label (uiRes("m_createModelPanelMenu.kNCloths")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -nCloths #1 " + $ed) showNClothsItem; menuItem -label (uiRes("m_createModelPanelMenu.kNParticles")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -nParticles #1 " + $ed) showNParticlesItem; menuItem -label (uiRes("m_createModelPanelMenu.kNRigids")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -nRigids #1 " + $ed) showNRigidsItem; menuItem -label (uiRes("m_createModelPanelMenu.kDynamicConstraints")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -dynamicConstraints #1 " + $ed) showDynamicConstraintsItem; menuItem -label (uiRes("m_createModelPanelMenu.kLocators")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -locators #1 " + $ed) showLocatorsItem; menuItem -label (uiRes("m_createModelPanelMenu.kDimensions")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -dimensions #1 " + $ed) showDimensionsItem; menuItem -label (uiRes("m_createModelPanelMenu.kPivots")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -pivots #1 " + $ed) showPivotsItem; menuItem -label (uiRes("m_createModelPanelMenu.kHandles")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -handles #1 " + $ed) showHandlesItem; menuItem -label (uiRes("m_createModelPanelMenu.kTextures")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -textures #1 " + $ed) showTexturesItem; if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { menuItem -label (uiRes("m_createModelPanelMenu.kStrokes")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -strokes #1 " + $ed) showStrokesItem; } menuItem -label (uiRes("m_createModelPanelMenu.kMotionTrails")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -motionTrails #1 " + $ed) showMotionTrailsItem; menuItem -label (uiRes("m_createModelPanelMenu.kPluginShapes")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -pluginShapes #1 " + $ed) showPluginShapesItem; menuItem -label (uiRes("m_createModelPanelMenu.kClipGhost")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -clipGhosts #1 " + $ed) showClipGhostsItem; menuItem -label (uiRes("m_createModelPanelMenu.kGreasePencils")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -greasePencils #1 " + $ed) showGreasePencilsItem; string $pluginFilters[] = `pluginDisplayFilter -q -listFilters`; if (size($pluginFilters) > 0) { // Sort the plugin display filter list so that the menu items will // be shown in a certain order $pluginFilters = `sort $pluginFilters`; string $filter; for ($filter in $pluginFilters) { // Generate menu items for each plugin display filter string $label = `pluginDisplayFilter -q -label $filter`; menuItem -label $label -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -pluginObjects " + $filter + " #1 " + $ed) ("showPluginObjectsItem_" + $filter); } } menuItem -divider true; menuItem -label (uiRes("m_createModelPanelMenu.kManipulators")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -manipulators #1 " + $ed) showManipulatorsItem; menuItem -label (uiRes("m_createModelPanelMenu.kGrid")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -grid #1 " + $ed) showGridItem; menuItem -label (uiRes("m_createModelPanelMenu.kHeadsUpDisplay")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -hud #1 " + $ed) showHUDItem; menuItem -version 2016 -label (uiRes("m_createModelPanelMenu.kHoldOuts")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -hos #1 " + $ed) showHoldOutsItem; menuItem -label (uiRes("m_createModelPanelMenu.kSelectionHilighting")) -checkBox 1 -enableCommandRepeat false -command ("modelEditor -e -sel #1 " + $ed) showSelectionItem; menuItem -divider true; if( $playBlastMenu != "" ){ playblastDisplayMenu($panel, $ed, $playBlastMenu ); } } menuItem -e -checkBox `modelEditor -q -controllers $ed` showControllersItem; menuItem -e -checkBox `modelEditor -q -nurbsCurves $ed` showNurbsCurvesItem; menuItem -e -checkBox `modelEditor -q -nurbsSurfaces $ed` showNurbsSurfacesItem; menuItem -e -checkBox `modelEditor -q -cv $ed` showNurbsCVsItem; menuItem -e -checkBox `modelEditor -q -hulls $ed` showNurbsHullsItem; menuItem -e -checkBox `modelEditor -q -polymeshes $ed` showPolymeshesItem; menuItem -e -checkBox `modelEditor -q -subdivSurfaces $ed` showSubdivSurfacesItem; menuItem -e -checkBox `modelEditor -q -planes $ed` showPlanesItem; menuItem -e -checkBox `modelEditor -q -cameras $ed` showCamerasItem; menuItem -e -checkBox `modelEditor -q -imagePlane $ed` showImagePlaneItem; menuItem -e -checkBox `modelEditor -q -lights $ed` showLightsItem; menuItem -e -checkBox `modelEditor -q -joints $ed` showJointsItem; menuItem -e -checkBox `modelEditor -q -pivots $ed` showPivotsItem; menuItem -e -checkBox `modelEditor -q -handles $ed` showHandlesItem; menuItem -e -checkBox `modelEditor -q -deformers $ed` showDeformersItem; menuItem -e -checkBox `modelEditor -q -ikHandles $ed` showIkHandlesItem; menuItem -e -checkBox `modelEditor -q -dynamics $ed` showDynamicsItem; menuItem -e -checkBox `modelEditor -q -particleInstancers $ed` showParticleInstancersItem; menuItem -e -checkBox `modelEditor -q -fluids $ed` showFluidsItem; menuItem -e -checkBox `modelEditor -q -hairSystems $ed` showHairSystemsItem; menuItem -e -checkBox `modelEditor -q -follicles $ed` showFolliclesItem; menuItem -e -checkBox `modelEditor -q -nCloths $ed` showNClothsItem; menuItem -e -checkBox `modelEditor -q -nParticles $ed` showNParticlesItem; menuItem -e -checkBox `modelEditor -q -nRigids $ed` showNRigidsItem; menuItem -e -checkBox `modelEditor -q -dynamicConstraints $ed` showDynamicConstraintsItem; menuItem -e -checkBox `modelEditor -q -locators $ed` showLocatorsItem; menuItem -e -checkBox `modelEditor -q -dimensions $ed` showDimensionsItem; menuItem -e -checkBox `modelEditor -q -textures $ed` showTexturesItem; if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { menuItem -e -checkBox `modelEditor -q -strokes $ed` showStrokesItem; } menuItem -e -checkBox `modelEditor -q -motionTrails $ed` showMotionTrailsItem; menuItem -e -checkBox `modelEditor -q -pluginShapes $ed` showPluginShapesItem; menuItem -e -checkBox `modelEditor -q -clipGhosts $ed` showClipGhostsItem; menuItem -e -checkBox `modelEditor -q -greasePencils $ed` showGreasePencilsItem; string $pluginFilters[] = `pluginDisplayFilter -q -listFilters`; if (size($pluginFilters) > 0) { string $filter; for ($filter in $pluginFilters) { menuItem -e -checkBox `modelEditor -q -queryPluginObjects $filter $ed` ("showPluginObjectsItem_" + $filter); } } menuItem -e -checkBox `modelEditor -q -manipulators $ed` showManipulatorsItem; menuItem -edit -enable `grid -query -toggle` -checkBox `modelEditor -q -grid $ed` showGridItem; menuItem -e -checkBox `modelEditor -q -hud $ed` showHUDItem; menuItem -e -checkBox `modelEditor -q -hos $ed` showHoldOutsItem; menuItem -e -checkBox `modelEditor -q -sel $ed` showSelectionItem; string $rendererUsed = getViewportRenderer($ed); global string $gViewport2; int $isV2RendererMode = ($rendererUsed == $gViewport2); { menuItem -e -enable $isV2RendererMode showParticleInstancersItem; } } global proc rebuildShowMenu() { global string $gModelPanelShowMenus[]; string $menu; for ($menu in $gModelPanelShowMenus) { if (`menu -exists $menu`) { menu -e -deleteAllItems $menu; } } }