本文整理汇总了Python中pymel.core.menu函数的典型用法代码示例。如果您正苦于以下问题:Python menu函数的具体用法?Python menu怎么用?Python menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show
def show():
if pm.menu('alfredTools2', exists=True): pm.deleteUI('alfredTools2')
gMainWindow = pm.melGlobals['gMainWindow']
# 마야 상단에 메뉴 생성
alfredToolsMenu = pm.menu('alfredTools2',
label = "Alfred Tools 2",
parent = gMainWindow,
tearOff = True,
allowOptionBoxes = True,
#familyImage = familyImage,
#mnemonic = 'alfred', # 뭔지 모르겠음.
#helpMenu = True, # help메뉴 뒤로감
)
pm.menuItem( dl='Asset', divider=True, p=alfredToolsMenu )
pm.menuItem( l='Modeling', p=alfredToolsMenu, en=False )
pm.menuItem( l='Surfacing', p=alfredToolsMenu, c=pm.Callback( menuCmd_surfacing ) )
pm.menuItem( l='Rigging', p=alfredToolsMenu, c=pm.Callback( menuCmd_rig ) )
pm.menuItem( dl='Layout', divider=True, p=alfredToolsMenu )
pm.menuItem( l='Shot', p=alfredToolsMenu, c=pm.Callback(menuCmd_layout) )
pm.menuItem( dl='Animation', divider=True, p=alfredToolsMenu )
pm.menuItem( l='Animation', p=alfredToolsMenu, en=False )
pm.menuItem( l='Motion Capture', p=alfredToolsMenu, c=pm.Callback( menuCmd_motionCapture ) )
pm.menuItem( dl='FX', divider=True, p=alfredToolsMenu )
pm.menuItem( l='FX', p=alfredToolsMenu, en=False )
pm.menuItem( dl='Render', divider=True, p=alfredToolsMenu )
pm.menuItem( l='Scene Assembly', p=alfredToolsMenu, c=pm.Callback(menuCmd_sceneAssembly) )
pm.menuItem( l='Surfacing', p=alfredToolsMenu, c=pm.Callback( menuCmd_surfacing ) )
pm.menuItem( l='Lighting', p=alfredToolsMenu, en=False )
pm.menuItem( l='Render', p=alfredToolsMenu, c=pm.Callback(menuCmd_render) )
示例2: show
def show( reset=False ):
if pm.about(batch=True):
print 'menu not available in batch mode.'
return
else:
# -- get things ready for building the menu
menu_name = "Impress Example"
pm.setParent( MAYA_WINDOW )
if pm.menu( menu_name, exists=True ):
if reset:
pm.deleteUI( menu_name )
else:
main_menu = pm.menu( menu_name, edit=True )
return main_menu
if not pm.menu( menu_name, exists=True ):
main_menu = pm.menu( menu_name, tearOff=True )
# -- build the menu
with main_menu:
with pm.subMenuItem( 'Display', aob=True, tearOff=True ):
ui.commandMenuItem( performExample )
示例3: mantraMainMenu
def mantraMainMenu():
log.debug("Creating mantra main menu")
menuName = "Mantra"
if pm.menu(menuName, query=True, exists=True):
pm.deleteUI(menuName)
gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow')
mantraMenu = pm.menu(menuName, label=menuName, parent=gMainWindow, tearOff=True)
pm.menuItem(label='Create Geo Standin', command=pm.Callback(menuCallback, "GeoStandin"))
pm.setParent("..", menu=True)
示例4: create_tank_disabled_menu
def create_tank_disabled_menu(menu_name):
"""
Render a special "shotgun is disabled menu"
"""
if pm.menu("ShotgunMenu", exists=True):
pm.deleteUI("ShotgunMenu")
sg_menu = pm.menu("ShotgunMenuDisabled", label=menu_name, parent=pm.melGlobals["gMainWindow"])
pm.menuItem(label="Sgtk is disabled.", parent=sg_menu,
command=lambda arg: tank_disabled_message())
示例5: ui
def ui():
if pm.window("Depth tool", q=True, exists=True):
pm.deleteUI("Depth tool")
with pm.window("Depth tool", menuBar=True, s=False):
pm.menu(l="help")
pm.menuItem(l="document", c=pm.Callback(os.system, "D:/Users/blood/Desktop/eyeTest_01.mov"))
pm.menuItem(l="tutorial", c=pm.Callback(pm.launch, web="https://www.youtube.com/watch?v=-JwXfnrX1wM"))
with pm.columnLayout(adj=True):
with pm.rowLayout(nc=2):
pm.button(l="Create" + "\n" + "Depth", w=64, h=64, bgc=(0.2, 0.2, 0.2), c=creatAll)
pm.button(l="Adjust" + "\n" + "Min&&Max", w=64, h=64, bgc=(0.8, 0.8, 0.8), c=adjustAll)
示例6: __init__
def __init__(self):
if pm.window(self.uiID, exists=True):
pm.deleteUI(self.uiID)
win = pm.window(self.uiID, title=self.title, menuBar=True)
with win:
pm.menu( label='Create', tearOff=True )
for type in deformerTypes:
pm.menuItem( label=type, c=pm.Callback( self.initPlugin, type) )
self._parentLayout = pm.columnLayout( adj=True )
with self._parentLayout:
self.createUISet()
示例7: lcCameraToolsUI
def lcCameraToolsUI(dockable=False, *args, **kwargs):
''' '''
ci = 0 #color index iterator
windowName = 'lcCameraTools'
shelfCommand = 'import lct.src.lcCameraTools.lcCameraTools as lcCam\nreload(lcCam)\nlcCam.lcCameraToolsUI()'
icon = basePath+'lcCameraTools.png'
winWidth = 204
winHeight = 209
mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
mainWindow.create()
pm.menu(l='Options', helpMenu=True)
pm.menuItem(l='Reset Gradient Colors', command=lambda *args: cam_set_default_colors() )
#
pm.columnLayout(prefix+'_columLayout_main')
#
pm.rowColumnLayout(nc=2, cw=([1,50], [2,150]) )
pm.text(l='Edit:', al='right')
cameraListDropdown = pm.optionMenu(prefix+'_optionMenu_camera_list', bgc=colorWheel.getColorRGB(ci), w=150, h=25 )
ci+=1
cameraListDropdown.changeCommand(lambda *args: cam_get_cam_attrs(cameraListDropdown) )
pm.setParent(prefix+'_columLayout_main')
#
pm.rowColumnLayout(nc=2, cw=([1,125], [2,75]) )
pm.text(l='Focal Length:', al='right')
pm.floatField(prefix+'_floatField_focal_length', min=0.0, v=0.0, pre=1, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.text(l='Near Clip Plane:', al='right')
pm.floatField(prefix+'_floatField_near_clip_plane', min=0.0, v=0.0, pre=4, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.text(l='Far Clip Plane:', al='right')
pm.floatField(prefix+'_floatField_far_clip_plane', min=0.0, v=0.0, pre=0, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.text(l='Overscan:', al='right')
pm.floatField(prefix+'_floatField_overscan', min=0.0, v=0.0, pre=3, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.text(l='Background Color:', al='right')
pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', cw1=50, rgb=(0.0,0.0,0.0), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.text(l='Gradient Top:', al='right')
pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', cw1=50, rgb=(0.54,0.62,0.70), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.text(l='Gradient Bottom:', al='right')
pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', cw1=50, rgb=(0.1,0.1,0.1), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
pm.setParent(prefix+'_columLayout_main')
#
pm.rowColumnLayout(nc=2, cw=([1,175], [2,25]) )
pm.button(prefix+'_button_toggle_bkgd', l='Toggle Background', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Toggle between flat color and gradient background', command=lambda *args: camera.toggleBackground() )
ci+=1
pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Toggle Camera Background', 'from lct.src.core.lcUtility import Camera as camera\ncamera.toggleBackground()', iconBasePath+'toggleBackground.png', "Toggle Camera's Viewport Background") )
#
mainWindow.show()
cam_populate_camera_list(cameraListDropdown)
cam_get_cam_attrs(cameraListDropdown)
示例8: __init__
def __init__(self):
if pm.window(self.uiID, exists=True):
pm.deleteUI(self.uiID)
win = pm.window(self.uiID, title=self.title, menuBar=True)
with win:
pm.menu( label='CageDeformer', tearOff=True )
pm.menuItem( label="CageDeformer", c=pm.Callback( self.initPlugin, "cage") )
pm.menuItem( label="CageDeformerARAP", c=pm.Callback( self.initPlugin, "cageARAP") )
self._parentLayout = pm.columnLayout( adj=True )
with self._parentLayout:
self.createUISet()
示例9: mantraMainMenu
def mantraMainMenu():
log.debug("Creating mantra main menu")
menuName = "Mantra"
if pm.menu(menuName, query=True, exists=True):
pm.deleteUI(menuName)
gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow')
mantraMenu = pm.menu(menuName, label = menuName, parent = gMainWindow, tearOff = True )
pm.menuItem( label = 'AttributeManager', command = Callback(menuCallback, "AttributeManager") )
pm.menuItem( label = 'DummyMenu' , command = Callback(menuCallback, "Dummy") )
pm.menuItem( label = '', divider = True )
pm.menuItem( label = 'DummyMenuA' , command = Callback(menuCallback, "DummyA") )
pm.setParent("..", menu = True)
示例10: mvgCreateMenu
def mvgCreateMenu():
gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow')
menuName = "mvgMenu"
menuLabel = "MayaMVG"
if(pm.menu(menuName, exists=True)):
pm.deleteUI(menuName)
if(gMainWindow != ""):
pm.setParent(gMainWindow)
menu = pm.menu(menuName, label=menuLabel, tearOff=True)
pm.menuItem(parent=menu, label='Open...', command=pm.Callback(openMVGWindow_CB))
pm.menuItem(parent=menu, label='Export selection as ABC', command=pm.Callback(exportSelectionAsABC_CB))
pm.menuItem(parent=menu, label='Create locator from vertex', command=pm.Callback(createLocatorFromVertex_CB))
pm.menuItem(parent=menu, divider=True)
示例11: create_sgtk_disabled_menu
def create_sgtk_disabled_menu(menu_name):
"""
Render a special "shotgun is disabled" menu
"""
if cmds.about(batch=True):
# don't create menu in batch mode
return
if pm.menu("ShotgunMenu", exists=True):
pm.deleteUI("ShotgunMenu")
sg_menu = pm.menu("ShotgunMenuDisabled", label=menu_name, parent=pm.melGlobals["gMainWindow"])
pm.menuItem(label="Sgtk is disabled.", parent=sg_menu,
command=lambda arg: sgtk_disabled_message())
示例12: UI_Build
def UI_Build(self):
"""Build the static UI and define the main layouts.
Keyword arguments:
none
"""
# Delete windows if already existing
if pc.window("lookdevAssistant", exists=True):
pc.deleteUI("lookdevAssistant")
# Main window
self.globalWidgets['window'] = pc.window("lookdevAssistant", menuBar=True, title="Arnold Lookdev assistant", sizeable=False, h=430, w=500)
# Menu bar
# |-- Creation Menu
self.globalWidgets['windowMenuCreate'] = pc.menu(label="Create")
pc.menuItem(label='new aiStandard', parent=self.globalWidgets['windowMenuCreate'], c=partial(self.Maya_createNode, 'aiStandard'))
pc.menuItem(label='new File', parent=self.globalWidgets['windowMenuCreate'], c=partial(self.Maya_createNode, 'file'))
pc.menuItem(label='new ygColorCorrect', parent=self.globalWidgets['windowMenuCreate'], c=partial(self.Maya_createNode, 'ygColorCorrect'))
pc.menuItem(divider=True)
# --|-- Create complete network Menu
self.globalWidgets['completeNetworkMenu'] = pc.menuItem(label='Complete network', parent=self.globalWidgets['windowMenuCreate'], subMenu=True, pmc=self.UI_refreshMenu)
self.globalWidgets['fromFile'] = pc.menuItem(l="from existing File...", subMenu=True, p=self.globalWidgets['completeNetworkMenu'])
pc.menuItem(l="from new File", c=partial(self.Maya_createFullNetwork, False, ''), p=self.globalWidgets['completeNetworkMenu'])
# |-- See on flat Menu
self.globalWidgets['windowMenuSeeOnFlat'] = pc.menu(label="See on flat")
pc.menuItem(label='Diffuse Color', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'color'))
pc.menuItem(label='Specular Color', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'KsColor'))
pc.menuItem(label='Specular Roughness', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'specularRoughness'))
pc.menuItem(label='Bump', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'normalCamera'))
pc.menuItem(divider=True, parent=self.globalWidgets['windowMenuSeeOnFlat'])
pc.menuItem(label='Revert to aiStandard', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=self.Maya_revertToAiStd)
# Main layout : 2 columns / 1 for the list of the ai* shaders / 1 to access selected shader attributes
self.globalWidgets['mainLayout'] = pc.rowColumnLayout(nc=2, cw=[(1, 150), (2, 240)])
# Shaders list layout
self.globalWidgets['sListLayout'] = pc.frameLayout(label='Shaders list', borderStyle='etchedIn', cll=True, h=430 , parent=self.globalWidgets['mainLayout'])
self.sListWidgets['layout'] = pc.columnLayout(parent=self.globalWidgets['sListLayout'])
self.sListWidgets['list'] = pc.textScrollList(h=340, parent=self.sListWidgets['layout'])
self.sListWidgets['listRefreshButton'] = pc.button(l='Refresh', w=95, c=self.UI_refreshShaders)
# Shaders attributes layout
self.globalWidgets['sAttrLayout'] = pc.frameLayout(label='Shaders attributes', borderStyle='etchedIn', cll=True, h=430, parent=self.globalWidgets['mainLayout'])
# Setup all callbacks
self.UI_Callbacks()
示例13: ui
def ui():
#masking이란 윈도우가 있는지를 확인한다. q는 확인하다. exists는 존재여부를 체크한다.
if pm.window('masking', q=True, exists=True) :
pm.deleteUI('masking')
with pm.window('masking',menuBar=True, s=True):
pm.menu(l='help')
pm.menuItem(l='document', c=pm.Callback( os.system, "D:/Users/blood/Desktop/eyeTest_01.mov" ))
pm.menuItem(l='tutorial', c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=-JwXfnrX1wM") )
with pm.columnLayout( adj=True ):
with pm.rowLayout(nc=4):
pm.button(l='', w=64, h=64, bgc=(1,0,0), c=redCmd )
pm.button(l='', w=64, h=64, bgc=(0,1,0), c=greenCmd )
pm.button(l='', w=64, h=64, bgc=(0,0,1), c=blueCmd)
pm.button(l='matte', w=64, h=64, bgc=(0.2,0.2,0.2), c=alphaCmd)
示例14: removeKrakenMenu
def removeKrakenMenu():
mainWindow = maya.mel.eval('$tmpVar=$gMainWindow')
menus = pm.window(mainWindow, q=True, ma=True)
if 'Kraken' in menus:
menuParent = pm.menu('Kraken', query=True, parent=True)
pm.deleteUI('|'.join([menuParent, 'Kraken']))
示例15: MakeMenu
def MakeMenu(menuTitle):
"""
Creates & returns a new menu instance.
:param menuTitle: string, title for the menu.
"""
return pm.menu(menuTitle)