当前位置: 首页>>代码示例>>Python>>正文


Python cmds.menu函数代码示例

本文整理汇总了Python中maya.cmds.menu函数的典型用法代码示例。如果您正苦于以下问题:Python menu函数的具体用法?Python menu怎么用?Python menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _init_menu

    def _init_menu(self):
        # Get Maya's main window
        maya_main_window = mel.eval("$tmpVar = $gMainWindow")

        # Delete previously created Rigathon menu, if exists
        menus = cmds.window(maya_main_window, query=True, menuArray=True)
        for menu in menus:
            label = cmds.menu(menu, query=True, label=True)
            if label == "Rigathon":
                cmds.deleteUI(menu)
                break

                # Create Rigathon menu
        rigathon_menu = cmds.menu(parent=maya_main_window, label="Rigathon")
        cmds.menuItem(parent=rigathon_menu, label="Rig a Character", command=partial(self.show_rig_a_character_window))
        cmds.menuItem(
            parent=rigathon_menu, label="Add Character for Animation", command=partial(self.add_character_for_animation)
        )
        cmds.menuItem(parent=rigathon_menu, divider=True)
        cmds.menuItem(parent=rigathon_menu, label="Show Animation UI", command=partial(self.show_animation_ui_window))
        cmds.menuItem(parent=rigathon_menu, divider=True)
        menuAdvanced = cmds.menuItem(parent=rigathon_menu, label="Ad&vanced", subMenu=True)
        cmds.menuItem(parent=menuAdvanced, label="(&1) Reload modules", command=partial(self.reload_modules))
        cmds.menuItem(parent=rigathon_menu, divider=True)
        cmds.menuItem(parent=rigathon_menu, label="&About...", command=partial(self.show_about_window))
开发者ID:ChyrosNX,项目名称:NephX7,代码行数:25,代码来源:cnx_rigathon.py

示例2: process

def process():
    '''
        Brings up the Dome Light Rig UI.
    '''

    dlWin = "domeLightWin"

    if cmds.window(dlWin, exists=True):
        cmds.deleteUI(dlWin)
    if cmds.windowPref(dlWin, exists=True):
        cmds.windowPref(dlWin, remove=True)

    winWidth = 425
    winHeight = 485

    cmds.window(dlWin, width=winWidth, height=winHeight, sizeable=False, menuBar=True, 
        title="Dome Light Rig")

    cmds.menu(label="Help")
    cmds.menuItem(label="About...", 
        command="from project import domeLight; domeLight.aboutWin()")

    cmds.frameLayout(borderVisible=1, borderStyle="etchedIn", labelVisible=0)
    mainForm = cmds.formLayout("mainForm")

    _buildControls( dlWin )
    _positionControls( dlWin, mainForm )

    cmds.window(dlWin, edit=True, width=winWidth, height=winHeight)

    cmds.showWindow(dlWin)
开发者ID:tmowyang,项目名称:maya-tools,代码行数:31,代码来源:domeLight.py

示例3: pythonScripts

def pythonScripts():

    if cmds.menu("pythonScripts_menu", exists=True):

        # print ("Removing old pythonScripts menu...")
        cmds.deleteUI("pythonScripts_menu")

    gMainWindow = maya.mel.eval("$gMainWindow=$gMainWindow")
    gMainProgressBar = maya.mel.eval("$gMainProgressBar=$gMainProgressBar")

    mainDir = findFile("pythonScripts.py")

    timer = maya.mel.eval("timerX")
    cmds.waitCursor(state=True)
    # print ""

    cmds.progressBar(
        gMainProgressBar,
        edit=True,
        beginProgress=True,
        isInterruptable=True,
        status="Creating pythonScripts...",
        maxValue=100,
    )

    pMenu = cmds.menu("pythonScripts_menu", parent=gMainWindow, tearOff=True, aob=True, label="pythonScripts")

    gen_pythonScripts(mainDir, pMenu)

    cmds.waitCursor(state=False)

    endTime = maya.mel.eval("timerX -st %(timer)s" % vars())

    cmds.progressBar(gMainProgressBar, edit=True, endProgress=True)
开发者ID:EricTRocks,项目名称:Maya-devkit,代码行数:34,代码来源:pythonScripts.py

示例4: createMenu

def createMenu(*args):
	mi = cmds.window('MayaWindow', ma=True, q=True)
	for m in mi:
		if m == 'RDojo_Menu':
			cmds.deleteUI('RDojo_Menu', m=True)

	cmds.menu('RDojo_Menu', label='RDMenu', to=True, p='MayaWindow')
开发者ID:RiggingDojo,项目名称:Python101_2014,代码行数:7,代码来源:startup.py

示例5: buildTimeMenu

	def buildTimeMenu( self, parent, uiItem ):
		cmd.menu( parent, e=True, dai=True )
		cmd.setParent( parent, m=True )

		cmd.menuItem( l="! - use current range", c=lambda a: cmd.textField( uiItem, e=True, tx='!' ) )
		cmd.menuItem( l=". - use current frame", c=lambda a: cmd.textField( uiItem, e=True, tx='.' ) )
		cmd.menuItem( l="$ - use scene range", c=lambda a: cmd.textField( uiItem, e=True, tx='$' ) )
开发者ID:Italic-,项目名称:maya-prefs,代码行数:7,代码来源:xferAnimUI.py

示例6: appendMayaMenu

    def appendMayaMenu(self, path):
        '''
        Add tools to the maya menus
        '''
        menuLabel = labelFromPath(path)
        formatLabel = menuLabel.replace(' ','').lower()
        menuItemArray = mc.menu(self.mainMenus[formatLabel], query=True, itemArray=True)

        #if this menu hasn't been built yet, run the post menu command to build it
        #that took a long time to figure out.
        if not menuItemArray:
            if self.verbose:
                print 'pre-building menu: ',menuLabel
            pmc = mc.menu(self.mainMenus[formatLabel], query=True, postMenuCommand=True)
            if pmc:
                mm.eval(pmc)
                menuItemArray = mc.menu(self.mainMenus[formatLabel], query=True, itemArray=True)

        #get all the menu items in the menu
        menuItems = dict()
        for each in menuItemArray:
            eachLabel = mc.menuItem(each, query=True, label=True)
            menuItems[eachLabel] = each

        subItems = [posixpath.join(path,x) for x in os.listdir(path) if (x.endswith('.py') or x.endswith('.mel')) and x != '__init__.py']

        if subItems:
            for path in subItems:
                tool = Tool(path)
                self.classifyTool(tool)
                if not tool.errors:
                    tool.createMenuItem(parent=self.mainMenus[formatLabel], labelPrefix=MENU_ITEM_PREFIX+' ', italicized=True)
开发者ID:liudger,项目名称:ml_tools,代码行数:32,代码来源:ml_toolbox.py

示例7: pythonScripts

def pythonScripts():

    if (cmds.menu ('pythonScripts_menu', exists=True)):
	
        print ("Removing old pythonScripts menu...")
	cmds.deleteUI ('pythonScripts_menu')
	
    gMainWindow = maya.mel.eval('$temp1=$gMainWindow')
    gMainProgressBar = maya.mel.eval('$temp=$gMainProgressBar')

    mainDir = findFile('pythonScripts.py')

    timer = cmds.timerX()
    cmds.waitCursor (state=True)
    print ""
    
    cmds.progressBar (gMainProgressBar, edit=True,
    		beginProgress=True,
    		isInterruptable=True,
    		status="Creating pythonScripts...",
    		maxValue=100)

    pMenu = (cmds.menu ('pythonScripts_menu', parent=gMainWindow, tearOff=True, aob=True, label="pythonScripts"))

    gen_pythonScripts(mainDir, pMenu)
    		
    cmds.waitCursor (state=False)

    endTime = cmds.timerX(startTime=timer)

    cmds.progressBar (gMainProgressBar, edit=True,
    		endProgress=True,)
             
    print ("pythonTools has now been updated in: " + str(endTime) + " seconds...!")
开发者ID:DimondTheCat,项目名称:xray,代码行数:34,代码来源:pythonScripts.py

示例8: setupMayaPipe

def setupMayaPipe():

    import fxpipe # generic and should already be loaded!
    import vrayUtils # for vray mojo

    # let's create the menus
    if cmds.menu('fxpipeMenu', exists=1):
        cmds.deleteUI('fxpipeMenu')

    fxpipeMenu = cmds.menu('fxpipeMenu', p='MayaWindow', to=1, aob=1, l='Pipeline Tools')
    cmds.menuItem(p=fxpipeMenu, d=1)
    toolsMenu = cmds.menuItem(p=fxpipeMenu, subMenu = 1, l="Tools")
    vrayMenu = cmds.menuItem(p=toolsMenu, subMenu = 1, to =1, l='VRay')
    
    # Tools Menu
    cmds.menuItem(p=toolsMenu, l='Remove Namespaces', c='from removeNamespaces import removeNamespaces;removeNamespaces()')
    # VRay Menu
    # please note that even though we have imported vrayUtils, we need to do it again in the commands as it loses context.
    cmds.menuItem(p=vrayMenu, l='Set up basic render settings', c='import vrayUtils;vrayUtils.createBaseRenderSettings()')
    cmds.menuItem(p=vrayMenu, l='Add Gamma to file nodes', c='import vrayUtils;vrayUtils.vrayAddGamma()')
    cmds.menuItem(p=vrayMenu, l='Add tech render passes', c='import vrayUtils;vrayUtils.createTechPasses()')
    cmds.menuItem(p=vrayMenu, l='Add Light Select Render Element', c='import vrayUtils;vrayUtils.createLightSelect()')
    cmds.menuItem(p=vrayMenu, l='Add Subdivision to selected objects', c='import vrayUtils;vrayUtils.addSubdivision()')
    cmds.menuItem(p=vrayMenu, l='Disable Subdivision on selected objects', c='import vrayUtils;vrayUtils.remSubdivision()')  
    cmds.menuItem(p=vrayMenu, l='Enable Subdivision on selected objects', c='import vrayUtils;vrayUtils.enableSubdivision()') 
    cmds.menuItem(p=vrayMenu, l='Add Object ID to Selected Objects', c='import vrayUtils;vrayUtils.addObjectID()') 
    cmds.menuItem(p=vrayMenu, l='Create Material Selects from Selected Shaders', c='import vrayUtils;vrayUtils.createMaterialSelect()')
    cmds.menuItem(p=vrayMenu, l='Convert files to tiled EXRs', c='import vrayUtils;vrayUtils.vrayConvertToTiledEXR()')
    
    if fxpipe.job != '':
        mayaJobPath = (os.path.join(fxpipe.jobPath, fxpipe.job, fxpipe.jobPathMaya))
        sys.path.append(mayaJobPath)
开发者ID:spinifexgroup-studio,项目名称:vfxpipe,代码行数:32,代码来源:userSetup.py

示例9: p4buildMenu

def p4buildMenu( parent, file=None ):
	file = Path( file )

	cmd.menu( parent, e=True, dai=True )
	cmd.setParent( parent, m=True )

	#if the given file is an empty string, then query the currently opened file and use that
	if not file:
		file = Path( cmd.file( q=True, sn=True ) )

	addPerforceMenuItems( file )
	cmd.menuItem( d=True )

	if isPerforceEnabled() and file.exists:
		def doGather( *a ):
			import exportManagerCore
			exportManagerCore.gatherSceneDependenciesIntoChange()
		cmd.menuItem( l="Generate Changelist For This Scene", c=doGather, ann="adds all files that this scene depends on or generates (ie textures, dmx files, .qc files, .mdl files etc...) to the changelist for the current scene" )

		#ignoreTexs = cmd.optionVar( q='vIgnoreTexturesOnCheckin' ) if cmd.optionVar( ex='vIgnoreTexturesOnCheckin' ) else True
		#def doTex( *a ):
			#cmd.optionVar( iv=('vIgnoreTexturesOnCheckin', a[ 0 ] ) )
		#cmd.menuItem( l="Ignore Textures", cb=ignoreTexs, c=doTex, ann="ignores textures by default when doing most perforce operations" )

		def syncDeps( *a ):
			import exportManagerCore
			exportManagerCore.syncStaleSceneDependencies()
			ans = cmd.confirmDialog( m="do you want to reload the file?", b=("Yes", "No"), db="No" )
			if ans == "Yes": cmd.file( file, f=True, o=True )
		cmd.menuItem( l="Sync Maya Dependencies", c=syncDeps )
		cmd.menuItem( d=True )

	addExploreToMenuItems( file )
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:33,代码来源:api.py

示例10: optionsWindow

def optionsWindow():
	"""This function creates an options window for inserting parents above all items in the selection list."""
	# create the main interface
	if cmds.window(kInsertOptionsWindow, q=True, ex=True):
		cmds.deleteUI(kInsertOptionsWindow)
	mainWindow = cmds.window(kInsertOptionsWindow, title='%s Options' % kToolName, menuBar=True, wh=(545,350))
	
	# build the menu bar
	cmds.menu(label='Help')
	amui.helpMenuItem(kToolName, __file__)
	amui.aboutMenuItem(kToolName, kVersionNumber, kVersionDate)
	
	mainForm = cmds.formLayout(nd=100)
	
	# build the section to get information about the new parents
	if_prefixName = cmds.textFieldGrp(text='', label='Prefix of New Parents:')
	if_suffixName = cmds.textFieldGrp(text='_xForm', label='Suffix of New Parents:')
	if_locatorScale = cmds.floatSliderGrp(v=1.0, min=0.0, max=10.0, fmn=0.0, fmx=100.0, label='Parent Locator Scale:', field=True)
	
	# position the input fields for the new parents
	cmds.formLayout(mainForm, edit=True, attachForm=[(if_prefixName, 'left', 30), (if_prefixName, 'top', 5)], attachNone=[(if_prefixName, 'right'), (if_prefixName, 'bottom')])
	cmds.formLayout(mainForm, edit=True, attachForm=[(if_suffixName, 'left', 30)], attachNone=[(if_suffixName, 'right'), (if_suffixName, 'bottom')], attachControl=[(if_suffixName, 'top', 5, if_prefixName)])
	cmds.formLayout(mainForm, edit=True, attachForm=[(if_locatorScale, 'left', 30)], attachNone=[(if_locatorScale, 'right'), (if_locatorScale, 'bottom')], attachControl=[(if_locatorScale, 'top', 5, if_suffixName)])
	
	# create the buttons to execute the script
	cmd_create='amTools.rigging.insertParents.doOptions (\"%s\", \"%s\", \"%s\")' % (if_prefixName, if_suffixName, if_locatorScale)
	amui.threeButtonLayout(mainForm, mainWindow, cmd_create)
	
	cmds.showWindow(mainWindow)
开发者ID:0xb1dd1e,项目名称:PipelineConstructionSet,代码行数:29,代码来源:insertParents.py

示例11: popup_filemenu

	def popup_filemenu( self, parent, *args ):
		cmd.menu(parent, e=True, dai=True)
		cmd.setParent(parent, m=True)

		other = self.other()
		items = self.selected()
		numItems = len(items)
		if numItems:
			cmd.menuItem(l='copy to %s' % other, c=self.copy)
			cmd.menuItem(l='move to %s' % other, c=self.move)

			if len(items) == 1:
				filepath = items[0].resolve()
				cmd.menuItem(d=True)
				cmd.menuItem(l='open in notepad', c=lambda *x: self.on_notepad( filepath ))

				#if the files are global files, display the perforce menu
				if self.locale == GLOBAL:
					cmd.menuItem(d=True)
					api.addPerforceMenuItems(filepath)
				cmd.menuItem(d=True)
				api.addExploreToMenuItems(filepath)

			cmd.menuItem(d=True)
			cmd.menuItem(l='delete', c=self.delete)

		#if the file is a global file, display an option to sync to presets
		if self.locale == GLOBAL:
			if numItems: cmd.menuItem(d=True)
			cmd.menuItem(l='sync to presets', c=self.syncall)

		#if no files are selected, prompt the user to select files
		if numItems == 0: cmd.menuItem(en=False, l='select a preset file')
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:33,代码来源:presetsUI.py

示例12: create_Menu

def create_Menu(*args):
	maya_Window = cmds.window('MayaWindow', ma=True, q=True)
	for m in maya_Window:
		if m == 'RDojo_Menu':
			cmds.deleteUI('RDojo_Menu', m=True)
	cmds.menu('RDojo_Menu', label='RDMenu', to=True, p='MayaWindow')
	cmds.menuItem(label="arm", command="run_Script()")
开发者ID:griffinanimator,项目名称:Python101,代码行数:7,代码来源:startup.py

示例13: main

def main():
	mc.python('from kmAnimImpExp import *')

	if mc.window( 'AnimImpExpUI', exists=True ):
		mc.deleteUI('AnimImpExpUI')
		
	WinName = mc.window( 
		'AnimImpExpUI', 
		title='Anim Import/Export with select', 
		iconName='AnimImpExpUI', 
		width=100, 
		height=200,
		menuBar=True
	)
	mc.menu( label='Menu', tearOff=False )
	mc.menuItem( label='Reload',command='from kmAnimImpExp import *;main()')
	mc.menuItem( divider=True )
	mc.menuItem( label='Quit' )
	
	mc.columnLayout(adj=True)
	mc.button(label='Import Anim',command='kmAnimImp()')
	mc.button(label='Export Anim',command='kmAnimExp()')
	mc.setParent('..') #columnLayout
		
	mc.showWindow(WinName)
开发者ID:smymc,项目名称:Maya-Python,代码行数:25,代码来源:kmAnimImpExp.py

示例14: createMenu

    def createMenu(self,menuDic,menuOrder=None):
        """ Define and draw the window/widget top file menu
        @type  menuDic: dictionary
        @param menuDic: the menu elements, ie entry, callback and submenu
        @type  menuOrder: array
        @param menuOrder: the menu keys oredered
        """        
        
        if menuOrder : 
            lookat = menuOrder
        else :
            lookat = menuDic.keys()
        for mitem in lookat:
            cmds.menu( label=mitem, tearOff=True , parent = self.winName)
            for elem in menuDic[mitem]:            
                if elem["sub"] is not None:
                    elem['id']=cmds.menuItem(subMenu=True, label=elem["name"])
                    for sub in elem['sub'].keys():
                        checkBox = False#elem['sub'][sub]['checkBox']
                        if elem['sub'][sub]["action"] is not None :
                            elem['sub'][sub]['id']=cmds.menuItem( label=elem['sub'][sub]["name"],
#                                                            checkBox=checkBox,
                                                            c=partial(elem['sub'][sub]["action"],sub))
                        else :
                            elem['sub'][sub]['id']=cmds.menuItem( label=elem['sub'][sub]["name"],)
#                                                            checkBox=checkBox,)
#                        if checkBox and elem['sub'][sub].has_key("var"):
#                            cmds.menuItem(elem['sub'][sub]['id'],e=1,checkBox=bool(elem['sub'][sub]['var']))
                    cmds.setParent( '..', menu=True )
                else:
                    if elem["action"] is not None :
                        elem['id']=cmds.menuItem( label=elem["name"],c=elem["action"])
                    else :
                        elem['id']=cmds.menuItem( label=elem["name"])
开发者ID:gj210,项目名称:upy,代码行数:34,代码来源:mayaUI.py

示例15: createHelpMenu

 def createHelpMenu(self,actions):
     cmds.menu( label='Help',mnemonic='H' )
     cmds.menuItem( label='View Manual Online',command=self.viewManual )
     cmds.menuItem( label='Check for Updates',command=self.execCheckForUpdates )
     self.createDivider()
     cmds.menuItem( label='Planned Features and Known Issues',command=self.openIssueTracker)
     cmds.menuItem( label='About ngSkinTools',mnemonic='A',command=self.execAbout )
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:7,代码来源:mainwindow.py


注:本文中的maya.cmds.menu函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。