Esempio n. 1
0
    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')
Esempio n. 2
0
def mgear_dagmenu_callback(*args, **kwargs):  # @UnusedVariable
    """ Triggers dag menu display

    If selection is ends with **_ctl** then display mGear's contextual menu.
    Else display Maya's standard right click dag menu

    Args:
        *args: Parent Menu path name / Variable length argument list.
        **kwargs: Arbitrary keyword arguments.

    Returns:
        str: Menu object name/path that is passed to the function
    """

    # cast args into more descend variable name
    parent_menu = args[0]

    # if second argument if not a bool then means that we are running
    # the override
    if type(args[1]) != bool:
        sel = cmds.ls(selection=True, long=True, exactType="transform")
        if sel and cmds.objExists("{}.isCtl".format(sel[0])):
            # cleans menu
            _parent_menu = parent_menu.replace('"', '')
            cmds.menu(_parent_menu, edit=True, deleteAllItems=True)

            # fills menu
            mgear_dagmenu_fill(_parent_menu, sel[0])
        else:
            mel.eval("buildObjectMenuItemsNow " + parent_menu)

    # always return parent menu path
    return parent_menu
Esempio n. 3
0
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)
Esempio n. 4
0
	def update_recents_menu(self, menu):
		""" Populate the recent files menu or disable it if no recent files
			in list.
		"""
		recent_files.recents.reload()  # Force reload of datafile
		recent_file_list = recent_files.recents.get('maya')

		# Delete all items in the pop-up menu
		mc.menu(menu, edit=True, deleteAllItems=True)

		# Re-populate the items in the pop-up menu
		for item in recent_file_list:
			filepath = os_wrapper.absolutePath(item)

			# Create the menu items...
			menu_name = os.path.basename(filepath)
			menu_cmd = str('session.scnmgr.file_open(\"%s\")' % filepath)
			mc.menuItem(item, label=menu_name, command=menu_cmd, parent=menu)

		# If recent file list contains no entries, disable menu
		enable = True;
		if len(recent_file_list) == 0:
			enable = False
		if len(recent_file_list) == 1 and recent_file_list[0] == "":
			enable = False

		try:
			mc.menuItem(menu, edit=True, enable=enable)
		except RuntimeError:
			mc.menu(menu, edit=True, enable=enable)
Esempio n. 5
0
 def deferred():
     cmds.menu(self.menu,
               label="Pyblish Starter",
               tearOff=True,
               parent="MayaWindow")
     cmds.menuItem("Show Creator", command=creator.show)
     cmds.menuItem("Show Loader", command=loader.show)
Esempio n. 6
0
def main():
    cmds.menu(l='My Tool', p='MayaWindow', to=True)
    cmds.menuItem(l='General', to=True, sm=True, aob=True)
    cmds.menuItem(l='Capture',
                  c='from myTool.general import capture;capture.main()')

    cmds.setParent('..', m=True)
    cmds.menuItem(l='Modeling', to=True, sm=True, aob=True)
    cmds.menuItem(
        l='Mirror Geometry',
        c='from myTool.modeling import mirrorGeometry;mirrorGeometry.main()')
    cmds.menuItem(
        l='Mirror Geometry Option',
        ob=True,
        c='from myTool.modeling import mirrorGeometry;mirrorGeometry.option()')

    cmds.setParent('..', m=True)
    cmds.menuItem(l='Animation', to=True, sm=True, aob=True)
    cmds.menuItem(l='Set Key',
                  c='from myTool.animation import setKey;setKey.main()')

    cmds.setParent('..', m=True)
    cmds.menuItem(l='Rigging', to=True, sm=True, aob=True)
    cmds.menuItem(
        l='Transfar Weight',
        c='from myTool.rigging import transfarWeight;transfarWeight.main()')

    cmds.setParent('..', m=True)
    cmds.menuItem(l='Rendering', to=True, sm=True, aob=True)
    cmds.menuItem(
        l='Fresnel Shader',
        c='from myTool.rendering import fresnelShader;fresnelShader.main()')
Esempio n. 7
0
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 )
Esempio n. 8
0
    def __init__(self, windowsWidth=360,windowsHeight=400 ):

        welcome_massage=cmds.warning("Welcome, your Main Path is: "+projects_scene_dir)

        self.query_username = getpass.getuser()
        self.allUIs={}
        self.deletewindow()
        self.windowsWidth=windowsWidth
        self.windowsHeight=windowsHeight

        #window
        self.allUIs ["clean_save"]=cmds.window('clean_save', title='clean save  v '+str(Version)+' - UI ', widthHeight=(self.windowsWidth,self.windowsHeight),sizeable=False,menuBar=True, minimizeButton=True, maximizeButton=False)

        cmds.menu(label="Debug", tearOff = True)
        cmds.menuItem(label = "Debug", command=self.debug)
        cmds.setParent('..', menu=True)


        # Vars
        self.fileName = ""


        #call_mainUI//call_listFiles
        self.mainUI()
        self.login_file()
def grill_tools_menu_init():

    gMainWindow = mm.eval("$temp1=$gMainWindow")
    if mc.menu("grill-tools", exists=True):
        mc.deleteUI("grill-tools")

    menu = mc.menu("grill-tools",
                   parent=gMainWindow,
                   tearOff=False,
                   label="grill-tools")

    cmd = "from grill_tools import pyblish_utils;"
    cmd += "pyblish_utils.process_targets_local()"
    mc.menuItem(label="Process Local", parent=menu, command=cmd)

    cmd = "from grill_tools import pyblish_utils;"
    cmd += "pyblish_utils.process_targets_local_silent()"
    mc.menuItem(label="Process Local silent", parent=menu, command=cmd)

    cmd = "from grill_tools import pyblish_utils;"
    cmd += "pyblish_utils.process_targets_royalrender()"
    mc.menuItem(label="Process RoyalRender", parent=menu, command=cmd)

    cmd = "from grill_tools import pyblish_utils;"
    cmd += "pyblish_utils.process_targets_royalrender_silent()"
    mc.menuItem(label="Process RoyalRender silent", parent=menu, command=cmd)

    cmd = "from grill_tools import pyblish_utils;"
    cmd += "pyblish_utils.process_targets_deadline()"
    mc.menuItem(label="Process Deadline", parent=menu, command=cmd)
Esempio n. 10
0
def createMenu():
    mainWindow = mm.eval('$null = $gMainWindow')
    global COMMONMENU
    if mc.menu(COMMONMENU, q=True, exists=True):
        mc.deleteUI(COMMONMENU)

    COMMONMENU = mc.menu(p=mainWindow, to=True, l='COMMON')

    mc.menuItem(subMenu=True, l='Common Tool', to=True)
    mc.menuItem(l='Rename Materials', c=__renameMaterials)
    mc.menuItem(l='Change Locator Size', c=__changeLocatorSize)
    mc.menuItem(optionBox=True, c=__showChangeLocatorSize)
    mc.menuItem(l='Change 2 Meter', c=__change2Meter)
    mc.menuItem(l='Replace Node Name', c=__replaceNodeName)
    mc.menuItem(l='Change Absolute Path 2 Relative', c=__relativePath)
    mc.menuItem(l='Install AnimBot', c=__installAnimBot)
    mc.setParent('..', menu=True)

    mc.menuItem(d=True)
    # --------------------------------

    mc.menuItem(subMenu=True, l='Utility Tool', to=True)
    mc.menuItem(l='Repair Maya Tool', c=__repairMayaTool)
    mc.menuItem(l='Update Python Packages', c=__updatePackages)
    mc.setParent('..', menu=True)
Esempio n. 11
0
 def outliner_mm_rmb(self):
     cmds.menu(self.menu_popup_rmb, e=True, dai=True)
     cmds.menuItem(parent=self.menu_popup_rmb,
                   l='Clear',
                   radialPosition='N',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.clear_list())
     cmds.menuItem(parent=self.menu_popup_rmb,
                   l='Add',
                   radialPosition='E',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.add_to_list())
     cmds.menuItem(parent=self.menu_popup_rmb,
                   l='Sort',
                   radialPosition='S',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.sort_list())
     cmds.menuItem(parent=self.menu_popup_rmb,
                   l='Remove',
                   radialPosition='W',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.remove_from_list())
     cmds.setParent(m=True)
     return
Esempio n. 12
0
    def loadMenu(cls):
        """Load the gfTools menu in Maya menu.

        Returns:
            True: If succeed.
        """
        MainMenu.deleteIfExists()

        mayaMenu = "MayaWindow"
        mainMenu = MainMenu.kMenuName
        mainLabel = MainMenu.kMenuLabel
        toolsMenu = "gfTools_PToolsMenu"
        toolsLabel = "Tools"

        cmds.menu(mainMenu, l=mainLabel, to=True, p=mayaMenu)
        # cmds.menuItem(l="Login")
        # cmds.menuItem(l="Sign Up")
        # cmds.menuItem(d=True)
        cmds.menuItem(toolsMenu, l=toolsLabel, to=True, sm=True)
        cmds.menuItem(l="Create IK Solver")
        # cmds.menuItem(l="Create IK Solver Options", ob=True)
        cmds.menuItem(l="Create PSD")
        # cmds.menuItem(l="Create PSD Options", ob=True)
        cmds.menuItem(l="Parent Constraint")
        # cmds.menuItem(l="Parent Constraint Options", ob=True)
        cmds.menuItem(l="Aim Constraint")
        # cmds.menuItem(l="Aim Constraint Options", ob=True)
        cmds.menuItem(l="Blend Transformations")
        # cmds.menuItem(l="Blend Transformations Options", ob=True)
        cmds.setParent("..", m=True)
        cmds.menuItem(d=True)
        cmds.menuItem(l="About Application", c=MainMenu.aboutApplication)

        return True
Esempio n. 13
0
 def mm_set_attrs(self):
     popup_menu = self.menu_popup_ctrl_rmb
     cmds.menu(popup_menu, e=True, dai=True)
     cmds.menuItem(parent=popup_menu,
                   l='One',
                   radialPosition='N',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.set_attr_value(value=1))
     cmds.setParent(self.m_form)
     cmds.menuItem(parent=popup_menu,
                   l='Zero',
                   radialPosition='S',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.set_attr_value(value=0))
     cmds.setParent(self.m_form)
     cmds.menuItem(parent=popup_menu,
                   l='Shoot Out',
                   radialPosition='W',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.shoot_out())
     cmds.menuItem(parent=popup_menu,
                   l='Reset',
                   radialPosition='E',
                   enableCommandRepeat=True,
                   ec=True,
                   c=lambda *args: self.shoot_out(reset=True))
     cmds.setParent(self.m_form)
     return
Esempio n. 14
0
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()")
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)
    def __init__(self):
        #构造函数
        self.bsName = None

        if cmds.window(self.WINDOW_NAME, exists = True):
            cmds.deleteUI(self.WINDOW_NAME, window = True)

        main_window = cmds.window(self.WINDOW_NAME, title =  "FACE Edit", rtf = True,  menuBar=True)
        # main_layout = cmds.formLayout(parent = main_window)

        cmds.menu( label='Help', helpMenu=True )
        cmds.menuItem( 'Application..."', label='"About' )

        
        cmds.frameLayout("Face:", collapsable = True, labelVisible=1, marginWidth=5,marginHeight=5,borderStyle='etchedOut' )
        cmds.columnLayout(adj=1)
        
        Import_button = cmds.button(label = "ChangeBSTarget",h=25,command = self.ChangeBSTarget) 

        
        cmds.separator( height=5,style='in' )
        cmds.separator( height=5,style='in' )

        Moth_button = cmds.button(label = "ConnectHeadBS",h=25,command = self.HeadBSConnect )
        cmds.separator( height=10,style='in' )    
        Eye_button = cmds.button(label = "ConnectBrowesBS",h=25,command = self.DoBrowesBSConnect)

        cmds.separator( height=10,style='in' )


        cmds.showWindow(main_window)
Esempio n. 17
0
def savefolder(savepathini):
    newpath=mc.fileDialog2(ds = 1, fm = 3)
    if newpath:
        chkpath= newpath[0]+'/'
        counts=mc.getFileList (folder=chkpath)
        nc=counts.count('SavePose')
        if not nc:
            cofirm_but=mc.confirmDialog( title='Confirm', message='Do u want to create a new library in '+newpath[0]+ '   ??', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
            if cofirm_but=='Yes':
                getMnuItms=mc.menu('chgFld',q=1,ia=1)
                if len(getMnuItms) >= 7:
                    mc.deleteUI(getMnuItms[3],mi=1)
                getMnuItms=mc.menu('chgFld',q=1,ia=1)    
                getItmLab=[]
                for each in getMnuItms:
                    lab=mc.menuItem(each,q=1,l=1)
                    getItmLab.append(lab)  
                if newpath:
                    if newpath[0] not in getItmLab:
                        mc.menuItem(label=newpath[0],p='chgFld',c=partial(changepath,newpath))
                savepathini=newpath[0]
            else:
                return
        else:
            savepathini=newpath[0]      
    else:
        return 
    Refresh_UI(savepathini)
    temp_path(savepathini)
Esempio n. 18
0
def UI():
	if cmds.window('FBXExport',ex=True):
		cmds.deleteUI('FBXExport',wnd=True)
	window = cmds.window('FBXExport',t='FBX Export Version 1.0.0',wh=(450,300),sizeable=False)

	mainLayout = cmds.columnLayout(w=450, h=300)
	cmds.menuBarLayout()
	# cmds.menu(label ='About Me',helpMenu=True)
	cmds.menu(label='File')
	cmds.menuItem(label='About Me',c=AboutMe)
	cmds.menuItem(label='Help',c=Help)
	cmds.separator(st='in')
	cmds.columnLayout(columnAlign='left', columnAttach=('both', 50), rowSpacing=30, columnWidth=420)
	cmds.text(l='')
	cmds.optionMenu(label ='ExportType:',changeCommand=printNewMenuItem)
	cmds.menuItem( label='Export Selection' )
	cmds.menuItem( label='Export All' )
	
	cmds.rowColumnLayout(numberOfColumns=2)
	cmds.textField("filepath",w=270,pht=configpath, bgc=(0.2,0.2,0.2))
	cmds.button(l='path',w =50,h=20,c=browseFilePath)
	cmds.setParent( '..' )

	cmds.rowColumnLayout(numberOfColumns=2)
	cmds.button(l='Name:',w =50,h=20,en=False)
	cmds.textField('FileName',pht='Enter a filename',ed =True,w=270,bgc=(0.2,0.2,0.2))
	cmds.setParent( '..' )
	cmds.button(l='Export',bgc=(0.3,0.7,0.7),c=ExportFBX)

	cmds.showWindow(window)
Esempio n. 19
0
    def create(self):

        if cmds.menu( self.uiname, ex=1 ):
            cmds.deleteUI( self.uiname )
        cmds.menu( self.uiname, l= self.title, p='MayaWindow', to=1 )
        
        return self.uiname
Esempio n. 20
0
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)
Esempio n. 21
0
File: mayaUI.py Progetto: gj210/upy
    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"])
Esempio n. 22
0
    def createMenu(self, *args):
        '''
        Create the main menu for the UI
        '''
        
        #generate shelf label by removing ml_
        shelfLabel = self.name.replace('ml_','')
        module = self.module
        if not module:
            module = self.name
            
        #if icon exists, use that
        argString = ''
        if not self.icon:
            argString = ', label="'+shelfLabel+'"'
        
        mc.menu(label='Tools')
        mc.menuItem(label='Add to shelf', 
            command='import ml_utilities;ml_utilities.createShelfButton("import '+module+';'+module+'.ui()", name="'+self.name+'", description="Open the UI for '+self.name+'."'+argString+')')
        if not self.icon:
            mc.menuItem(label='Get Icon',
                command=(_showHelpCommand(websiteURL+'/wp-content/files/'+self.name+'.png')))
        mc.menuItem(label='Get More Tools!', 
            command=(_showHelpCommand(websiteURL+'/downloads')))
        mc.setParent( '..', menu=True )

        mc.menu(label='Help')
        mc.menuItem(label='About', command=self.about)
        mc.menuItem(label='Documentation', command=(_showHelpCommand(wikiURL+'#'+self.name)))
        mc.menuItem(label='Python Command Documentation', command=(_showHelpCommand(wikiURL+'#\%5B\%5B'+self.name+'\%20Python\%20Documentation\%5D\%5D')))
        mc.menuItem(label='Submit a Bug or Request', command=(_showHelpCommand(websiteURL+'/downloads/feedback-and-bug-reports/?1ex_field1='+self.name)))
        
        mc.setParent( '..', menu=True )
Esempio n. 23
0
	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')
Esempio n. 24
0
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)
Esempio n. 25
0
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')
Esempio n. 26
0
    def tools_menu(self):
        tools_menu = "studioTools"
        tools_menu_name = "{0} Tools".format(self.pipeline_name)

        gMainWindow = mel.eval("$tmpVar = $gMainWindow")

        if cmds.menu(tools_menu, exists=True):
            cmds.deleteUI(tools_menu, menu=True)

        studio_tools_menu = cmds.menu(tools_menu, parent=gMainWindow, label=tools_menu_name, to=True)

        animation_menu = cmds.menuItem(parent=studio_tools_menu, label="Animation Tools", subMenu=True, to=True)
        cmds.menuItem(parent=animation_menu, label="FKIK Snap Tool", to=True, c=self.test)
        cmds.menuItem(parent=animation_menu, label="Zero Out Tool", to=True)

        rig_menu = cmds.menuItem(parent=studio_tools_menu, label="Rig Tools", subMenu=True, to=True)
        cmds.menuItem(parent=rig_menu, label="FKIK Snap Setup", to=True)
        cmds.menuItem(parent=rig_menu, label="No Flip Pole Vector Setup", to=True)

        developer_menu = "developerTools"
        developer_menu_name = "{0} Developer".format(self.pipeline_name)

        if cmds.menu(developer_menu, exists=True):
            cmds.deleteUI(developer_menu, menu=True)

        studio_developer_menu = cmds.menu(developer_menu, parent=gMainWindow, label=developer_menu_name, to=True)
        cmds.menuItem(parent=studio_developer_menu, label="Environment Tool", to=True, c=self.environment_tool)
Esempio n. 27
0
    def popup_filemenu(self, parent, *args):
        cmd.menu(parent, e=True, dai=True)
        cmd.setParent(parent, m=True)

        other = self.otherLocale()
        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))

                cmd.menuItem(d=True)
                addExploreToMenuItems(filepath)

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

            # if no files are selected, prompt the user to select files
        if numItems == 0:
            cmd.menuItem(en=False, l="select a preset file")
    def initUI(self):
        """Creates the interface."""
        if not cmds.menu(MENU_NAME, exists=True):
            cmds.menu(
                MENU_NAME,
                label='Arudo',
                parent=mel.eval('$htkeyswitch = $gMainWindow'),
            )

        if cmds.menu(HOTKEY_MENU_NAME, exists=True):
            cmds.deleteUI(HOTKEY_MENU_NAME, menuItem=True)

        cmds.menuItem(
            HOTKEY_MENU_NAME,
            label='Hotkey Set',
            subMenu=True,
            allowOptionBoxes=True,
            insertAfter='',
            parent=MENU_NAME,
            )
        cmds.menuItem(l='Maya Default', c=lambda *args: self.set_factory())
        cmds.menuItem(divider=True)
        self._add_menu_items()
        cmds.menuItem(divider=True)
        cmds.menuItem(l='Update', c=lambda *args: self.update())
        cmds.menuItem(l='Print Current', c=lambda *args: self.output())
Esempio n. 29
0
 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 )
Esempio n. 30
0
def SLiBSetupMenu():
    gMainWindow = mel.eval('$temp1=$gMainWindow')
    if cmds.menu('SLiBMenu', query=True, exists=True):
        cmds.deleteUI('SLiBMenu', menu=True)
    SLiBMenu = cmds.menu('SLiBMenu',
                         parent=gMainWindow,
                         tearOff=True,
                         label='SLiB')
    cmds.menuItem(
        parent='SLiBMenu',
        label='Settings',
        command=
        'import SLiBBrowserPy;reload(SLiBBrowserPy);SLiBBrowserPy.SLiBSetupSettingsUI()'
    )
    cmds.menuItem(parent='SLiBMenu', divider=True)
    cmds.menuItem(
        parent='SLiBMenu',
        label='SLiB Browser ...',
        command=
        'import SLiBBrowserPy;reload(SLiBBrowserPy);SLiBBrowserPy.SLiBBrowserUI()'
    )
    cmds.menuItem(parent='SLiBMenu', divider=True)
    cmds.menuItem(
        parent='SLiBMenu',
        label='Homepage',
        command=
        'import maya;maya.cmds.showHelp("http://www.slib.digidim.info", absolute=True)'
    )
Esempio n. 31
0
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)
Esempio n. 32
0
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...!")
Esempio n. 33
0
	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='$' ) )
Esempio n. 34
0
    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)
Esempio n. 35
0
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)
Esempio n. 36
0
 def commonMenu(self):
     """Create common menu items for all option boxes"""
     self.editMenu = cmds.menu(label='Edit')
     self.editMenuSave = cmds.menuItem(
         label='Save Settings',
         enable=self.supportsSaveSettings,
         command=self.editMenuSaveCmd
     )
     self.editMenuReset = cmds.menuItem(
         label='Reset Settings',
         command=self.editMenuResetCmd
     )
     self.editMenuDiv = cmds.menuItem(d=True)
     self.editMenuRadio = cmds.radioMenuItemCollection()
     self.editMenuTool = cmds.menuItem(
         label='As Tool',
         radioButton=True,
         enable=self.supportsToolAction,
         command=self.editMenuToolCmd
     )
     self.editMenuAction = cmds.menuItem(
         label='As Action',
         radioButton=True,
         enable=self.supportsToolAction,
         command=self.editMenuActionCmd
     )
     self.helpMenu = cmds.menu(label='Help')
     self.helpMenuItem = cmds.menuItem(
         label='Help on %s'%self.title,
         command=self.helpMenuCmd
     )
Esempio n. 37
0
	def buildGUI(self):
	
		if cmds.window(self.name, q=True, exists=True):
			cmds.deleteUI(self.name)
		cmds.window(self.name, title=self.title, sizeable=False, mxb=False, mnb=False, toolbox=False, w=100, h=30)
		cmds.columnLayout("mainLayout", adj=True, parent=self.name, co=("left", 5))

		# Add onClose Event
		cmds.scriptJob(uiDeleted=(self.name, self.onClose))
		
		# Help Menu
		cmds.menuBarLayout("menuBar")
		cmds.menu(label="Show Help", helpMenu =True, pmc=self.showHelp)

		# Import paths
		cmds.textFieldButtonGrp("tfbDBPath", label="Links: ", bl="Set Link Path", cw=(1,50), parent="mainLayout", bc=self.setDBPath)
		cmds.textFieldButtonGrp("tfbShaderPath", label="Shaders: ", bl="Set Shader Path", cw=(1,50), parent="mainLayout", bc=self.setShaderPath)
		
		cmds.checkBox("cbSelection", label="Use Selection", parent="mainLayout")
		cmds.checkBox("cbSubstring", label="Substring prefix", parent="mainLayout", value=True)
		cmds.textField("tfSubstring", parent="mainLayout", text="s100_char")

		cmds.separator(h=10, style="none", parent="mainLayout")

		# Buttons
		cmds.rowColumnLayout("buttonsLayout", numberOfColumns=2, parent="mainLayout")
		cmds.button("bExportLinks", label = "Export Links", w=200, h=30, parent="buttonsLayout", c=self.exportLinks)
		cmds.button("bImportShader", label="Link Shaders", w=200, h=30, parent="buttonsLayout", c=self.linkShaders)

		cmds.showWindow(self.name)
Esempio n. 38
0
    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))
Esempio n. 39
0
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 )
Esempio n. 40
0
 def menuBar(self):
     """create the top menubar"""
     cmds.menu('mtn_menuBar', label='File', allowOptionBoxes=False)
     # add items
     # refresh button
     updateC = self.refreshUI
     cmds.menuItem(label='Refresh', c=updateC) 
     # settings button
     settingsC = self.settingsUI
     cmds.menuItem(label='Settings', c=settingsC) 
     # exit button
     exitC = 'import maya.cmds as cmds;cmds.deleteUI("'+WINDOW_NAME+'", window=True)'
     cmds.menuItem(label='Exit', c=exitC)
     # add help menu
     cmds.menu(label='Help', helpMenu=True)
     helpC = 'import webbrowser;webbrowser.open("'+HELP_PAGE+'"")'
     cmds.menuItem(label='Github', c=helpC)
     
     fun1C = 'import webbrowser;webbrowser.open("http://www.google.com/images?q=mecha &")'
     cmds.menuItem(label='Bonus: Mechas !!', c=fun1C)
     
     fun2C = 'import webbrowser;webbrowser.open("http://www.google.com/images?q=kittens &")'
     cmds.menuItem(label='Bonus: Kittens !!', c=fun2C)
     
     aboutC = 'import maya.cmds as cmds;cmds.confirmDialog(title="about", message="version v1.0", button="OK")'
     cmds.menuItem(label='About', c=aboutC)
Esempio n. 41
0
def buildMenu():
    cmds.menu('ms_menu', edit=True, deleteAllItems=True, pmc=('import ms_menu\nms_menu.buildMenu()'))

    # Add/Select Render Settings Node
    cmds.menuItem(label='Add Render Settings Node', parent='ms_menu', command='import maya.cmds\nmaya.cmds.createNode("ms_renderSettings")')
    cmds.menuItem('menu_select_render_settings', subMenu=True, label='Select Render Settings Node', to=True, parent='ms_menu')
    for render_settings_node in cmds.ls(type='ms_renderSettings'):
        cmds.menuItem(label=render_settings_node, parent='menu_select_render_settings', command=('import maya.cmds as cmds\ncmds.select("{0}")'.format(render_settings_node)))

    # Add/Select Environment Node
    cmds.menuItem(divider=True, parent='ms_menu')
    cmds.menuItem(label='Add Environment Node', parent='ms_menu', command='import maya.cmds\nmaya.cmds.createNode("ms_environment")')
    cmds.menuItem('menu_select_environment', subMenu=True, label='Select Environment Node', to=True, parent='ms_menu')
    for environment in cmds.ls(type='ms_environment'):
        cmds.menuItem(label=environment, parent='menu_select_environment', command=('import maya.cmds as cmds\ncmds.select("{0}")'.format(environment)))

    cmds.menuItem(divider=True, parent='ms_menu')
    cmds.menuItem(label='Create Material', parent='ms_menu', command=('import maya.cmds as cmds\ncmds.shadingNode("ms_appleseed_material", asShader=True)'))

    # Load entity definitions
    entity_defs = ms_commands.get_entity_defs(os.path.join(ms_commands.ROOT_DIRECTORY, 'scripts', 'appleseedEntityDefs.xml'))

    # Create BSDF
    cmds.menuItem('menu_create_BSDF', subMenu=True, label='Create BSDF', to=True, parent='ms_menu')
    for entity_key in entity_defs.keys():
        if entity_defs[entity_key].type == 'bsdf':
            command = 'import ms_commands\nms_commands.create_shading_node("' + entity_key + '")'
            cmds.menuItem(label=entity_key, parent='menu_create_BSDF', command=command)

    # Create EDF
    cmds.menuItem('menu_create_EDF', subMenu=True, label='Create EDF', to=True, parent='ms_menu')
    for entity_key in entity_defs.keys():
        if entity_defs[entity_key].type == 'edf':
            command = 'import ms_commands\nms_commands.create_shading_node("' + entity_key + '")'
            cmds.menuItem(label=entity_key, parent='menu_create_EDF', command=command)

    # Create Surface Shader
    cmds.menuItem('menu_create_surface_shader', subMenu=True, label='Create Surface Shader', to=True, parent='ms_menu')
    for entity_key in entity_defs.keys():
        if entity_defs[entity_key].type == 'surface_shader':
            command = 'import ms_commands\nms_commands.create_shading_node("' + entity_key + '")'
            cmds.menuItem(label=entity_key, parent='menu_create_surface_shader', command=command)

    # convert materials
    cmds.menuItem(divider=True, parent='ms_menu')
    cmds.menuItem('menu_convert_maya_materials', subMenu=True, label='Convert Maya Materials', to=True, parent='ms_menu')

    cmds.menuItem(label='Selected Materials', parent='menu_convert_maya_materials', command='import ms_commands\nms_commands.convert_selected_materials()')
    cmds.menuItem(label='All Materials', parent='menu_convert_maya_materials', command='import ms_commands\nms_commands.convert_all_materials()')

    # Export
    cmds.menuItem(divider=True, parent='ms_menu')
    cmds.menuItem('menu_export', subMenu=True, label='Export', to=True, parent='ms_menu')
    for render_settings_node in cmds.ls(type='ms_renderSettings'):
        cmds.menuItem(label=render_settings_node, parent='menu_export', command=('import ms_export \nreload(ms_export)\nms_export.export("{0}")'.format(render_settings_node)))

    # About
    cmds.menuItem(divider=True, parent='ms_menu')
    cmds.menuItem(label='About', parent='ms_menu', command='import ms_commands\nms_commands.ms_info_dial()')
Esempio n. 42
0
def createUI():
    cmds.setParent('MayaWindow')
    try:
        cmds.menu('MukaiLab', query=True, label=True)
    except:
        cmds.menu('MukaiLab', label='MukaiLab')
    cmds.setParent('MukaiLab', menu=True)
    cmds.menuItem('SSDS', label='SSDS', command=showBuildWindow)
Esempio n. 43
0
 def createMenubar(self):
     # create menus
     self.ui["toolsMenu"] = cmds.menu(label="Tools")
     cmds.menuItem(label="Batch Publish...")
     cmds.menuItem(label="Export File List...")
     cmds.menuItem(label="Archive Old Versions...")
     self.ui["settingsMenu"] = cmds.menu(label="Settings")
     cmds.menuItem(label="Settings Manager...")
Esempio n. 44
0
def reload_items(*_):
    if cmds.menu(_MAIN_MENU, exists=True):
        cmds.menu(_MAIN_MENU, edit=True, deleteAllItems=True)

    import moon.menu.pulldown_menu_set as menu
    reload(menu)

    _create_menuitem(menu.MENUS)
Esempio n. 45
0
def createMyMenu():
	gMainWindow = mel.eval('$tmpVar=$gMainWindow')
	mc.menu("JKTool_UI", label="JKTool", tearOff=True, parent=gMainWindow )
	mc.menuItem( label="Run", command="mc.JKTRun()" )
	mc.menuItem( label='Update', enable=False )
	# mc.menuItem( label='Save' )
	mc.menuItem( divider=True )
	mc.menuItem( label='Help', enable=False )
Esempio n. 46
0
def initialize_plugin():
    cmds.setParent("MayaWindow")
    cmds.menu("surume", l=u"surume", to=True)
    cmds.menuItem(l=u"Check Layout", c=CheckLayoutWindow.main)
    cmds.menuItem(l=u"Convert Color Code", c=ConvertColorCode.show_ui)
    cmds.menuItem(l=u"Convert BlendShape Pre-Deformation",
                  c=convert_all_pre_deformation)
    cmds.setParent("..")
Esempio n. 47
0
    def __createUI(self):
        self.win = CurveToolUI.win_name
        
        if not cmds.uiTemplate('CurveToolsUITemplate', exists=True):
            cmds.uiTemplate('CurveToolsUITemplate')
            
        if cmds.window(self.win, exists=True):
            cmds.deleteUI(self.win)
            
        self.win = cmds.window(self.win, t=CurveToolUI.win_title, 
                               mb=True, w=656, h=385)
        
        self.main_menu = cmds.menu(label="Menu", parent=self.win)
        #cmds.menuItem(label="Refresh List", c=self.handleRefreshMenu)
        
        self.help_menu = cmds.menu(label="Help", parent=self.win)
        #cmds.menuItem(label="Help", c=self.handleHelpMenu)
        
        self.mainLayout = cmds.rowColumnLayout(nc=2, cw=[(1, 292), (2, 360)])
        self.leftLayout = cmds.rowColumnLayout(nr=3, parent=self.mainLayout,
                                               rh=[(1, 48), (2, 256), (3, 48)])
        self.topRow = cmds.rowColumnLayout(nc=3, parent=self.leftLayout)
        
        self.shapesList = cmds.textScrollList(parent=self.leftLayout, nr=24)
        
        self.btmRow = cmds.rowColumnLayout(nc=3, parent=self.leftLayout, w=128)
        
        self.createBtn =  cmds.button(l="Create",  w=96, h=48, parent=self.topRow)
        self.replaceBtn = cmds.button(l="Replace", w=96, h=48, parent=self.topRow)
        self.appendBtn =  cmds.button(l="Append",  w=96, h=48, parent=self.topRow)

        self.saveBtn = cmds.button(l="Save", w=96, h=48, parent=self.btmRow)
        self.overwriteBtn = cmds.button(l="Overwrite", w=96, h=48, parent=self.btmRow)
        self.deleteBtn = cmds.button(l="Delete", w=96, h=48, parent=self.btmRow)
        
        self.paneLayout = cmds.paneLayout(parent=self.mainLayout)            
        self.viewport = cmds.modelPanel(mbv=False, 
                                        parent=self.paneLayout)
        
        #------------------------------------------- install click handlers ---
        cmds.button(self.createBtn,  e=True, c=self.__handleCreateClick)
        cmds.button(self.replaceBtn, e=True, c=self.__handleReplaceClick)
        cmds.button(self.appendBtn,  e=True, c=self.__handleAppendClick)
        
        cmds.button(self.saveBtn,  e=True, c=self.__handleSaveClick)
        cmds.button(self.overwriteBtn, e=True, c=self.__handleOverwriteClick)
        cmds.button(self.deleteBtn,  e=True, c=self.__handleDeleteClick)   
        
        cmds.textScrollList(self.shapesList, e=True, 
                            sc=self.__handleShapeListSelection)
        
        #----------------------------------------- setup UiDeleted callback ---
        self.__uiCallback = OpenMayaUI.MUiMessage.addUiDeletedCallback(
            self.win, 
            self.__handleUIClosed
        )
        
        cmds.showWindow(self.win)
Esempio n. 48
0
def createScriptsMenu():
    if cmds.menu('Jeeves', exists=1):
        cmds.deleteUI('Jeeves')

    scriptsMenu = cmds.menu('Jeeves', p='MayaWindow', to=1, aob=1, l='Jeeves')
    cmds.menuItem(p=scriptsMenu,
                  l="Launch Jeeves",
                  c='import core.ui.jeeves_ui;reload(core.ui.jeeves_ui)')
    cmds.menuItem(p=scriptsMenu, l="Deadline", c=cmd)
Esempio n. 49
0
 def buildMenu(self):
     mMenuLayout = 'MayaWindow'
     cmds.setParent(mMenuLayout)
     if cmds.menu(self.NAME_MENU, q=1, ex=1):
         cmds.deleteUI(self.NAME_MENU)
     cmds.menu(self.NAME_MENU, to=1, l=self.NAME_LABEL)
     for menu in self.LIST_MENUS:
         cmds.menuItem(c=self.wrapIm(menu[0]), l=menu[1])
     print('buildMenu')
Esempio n. 50
0
    def main(self, *args):
        #global gMainWindow
        #gMainWindow = mel.eval('global string $gMainWindow;global string $tempMelVar;$tempMelVar=$gMainWindow')
        gMainWindow = mel.eval('$tempMelVar=$gMainWindow')
        if cmds.menu("fantaboxwd", q=1, ex=1):
            cmds.deleteUI("fantaboxwd")
        cmds.menu("fantaboxwd", p=gMainWindow, to=1, label=r"FantaBox")
        commonmn = cmds.menuItem(label='通用', to=1, sm=1)
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        modelmn = cmds.menuItem(label='模型', to=1, sm=1)
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        rigmn = cmds.menuItem(label='设置',c = "fb.rig.AR_optionwindow().creat()")
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        animatmn = cmds.menuItem(label='动画', to=1, sm=1)
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        fxmn = cmds.menuItem(label='特效', to=1, sm=1)
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        rendermn = cmds.menuItem(label='组装', to=1, sm=1)
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        cammn = cmds.menuItem(label='相机', to=1, sm=1)
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        checkmn = cmds.menuItem(label='提交规范检查工具',c='fb.loadcheckNode()' )
        cmds.setParent("..", menu=True)
        cmds.menuItem(d=1)
        #refreshmn = cmds.menuItem(label='刷新',c='import FantaBoxMenu;reload(fb.FantaBoxMenu);fb.FantaBoxMenu.FantaBoxMenu().main()' )

        cmds.setParent("..", menu=True)

        ##通用子面板:
        self.menubuild(self.commenus,commonmn)
           
        ##模型子面板:
        self.menubuild(self.modmenus,modelmn)
        '''
        ##设置子面板:
        rigFile = open(u'%s/rigpath.json'%(self.rigpath), 'r').read()
        rigData = json.loads(rigFile)
        self.automenu(rigmn, self.rigpath, rigData["name"], rigData["path"][0], rigData["path"][1])
        '''
        ##动画子面板:
        self.menubuild(self.animenus,animatmn)
            
        ##特效子面板:
        self.menubuild(self.fxmenus,fxmn)

        ##组装子面板:
        self.menubuild(self.renmenus,rendermn)

        ##相机子面板:
        self.menubuild(self.cammenus,cammn)
Esempio n. 51
0
    def createCustomMenu(self, path, parent=None, depth=0, mainMenu=False):
        """
        Recurse through a tool directory, creating tools and menus
        """

        if os.path.isdir(path):
            # recursive subMenu
            subItems = os.listdir(path)
            # if there's stuff in the folder, create a menu item
            if subItems:
                subItems = sorted(subItems)

                # do directories first, then files
                # generate menu name
                menuPrefix = "mlSubMenu"
                if mainMenu:
                    menuPrefix = MAIN_MENU_NAME_PREFIX
                menuName = os.path.basename(path)
                menuName = menuPrefix + menuName
                if mc.menu(menuName, exists=True):
                    mc.deleteUI(menuName)

                # generate menu label
                label = labelFromPath(path)
                if self.verbose:
                    printMenu(label, depth)

                # create the menu
                if mainMenu:
                    menuName = mc.menu(menuName, parent=parent, to=True, label=label, allowOptionBoxes=True)
                else:
                    menuName = mc.menuItem(menuName, label=label, subMenu=True, parent=parent, allowOptionBoxes=True)

                # and recurse!
                # do directories first
                filePaths = list()
                for each in subItems:
                    eachPath = posixpath.join(path, each)
                    if os.path.isdir(eachPath):
                        # if its a directory, recurse
                        self.createCustomMenu(eachPath, parent=menuName, depth=depth + 1)
                    else:
                        filePaths.append(eachPath)

                # now go through the files
                for each in filePaths:
                    if not each.endswith("__init__.py") and ((each.endswith(".py") or each.endswith(".mel"))):
                        tool = Tool(each, depth=depth)
                        self.classifyTool(tool)
                        if not tool.errors:
                            if self.verbose:
                                print (depth + 1) * "\t" + label
                            tool.createMenuItem(parent=menuName, italicized=False)
                        elif self.verbose:
                            print (depth + 1) * "\t", label, " <-- has errors and was unable to be imported."

                mc.setParent("..", menu=True)
Esempio n. 52
0
	def buildCmdEditorMenu( self, *a ):
		previewMode = self.UI_previewCheck.getValue()
		selTrigger = self.getHighlightedTrigger()
		if selTrigger:
			cmd.menu( self.MENU_cmdEditor, e=True, dai=True )
			for presetName, presetContents in CMD_PRESETS.iteritems():
				MelMenuItem( self.MENU_cmdEditor, l=presetName, en=not previewMode, c=Callback( self.UI_cmdEditor.setValue, presetContents ) )

			MelMenuItem( self.MENU_cmdEditor, l='setAttr cmd', en=not previewMode, c=lambda *a: self.UI_cmdEditor.setValue( writeSetAttrCmd( selTrigger ) ) )
Esempio n. 53
0
    def create_menu(self, *args):
        """
        Render the entire Shotgun menu.
        In order to have commands enable/disable themselves based on the enable_callback,
        re-create the menu items every time.
        """
        cmds.menu(self._menu_path, edit=True, deleteAllItems=True)

        # now add the context item on top of the main menu
        self._context_menu = self._add_context_menu()
        cmds.menuItem(divider=True, parent=self._menu_path)

        # now enumerate all items and create menu objects for them
        menu_items = []
        for (cmd_name, cmd_details) in self._engine.commands.items():
            menu_items.append(AppCommand(cmd_name, cmd_details))

        # sort list of commands in name order
        menu_items.sort(key=lambda x: x.name)

        # now add favourites
        for fav in self._engine.get_setting("menu_favourites"):
            app_instance_name = fav["app_instance"]
            menu_name = fav["name"]
            # scan through all menu items
            for cmd in menu_items:
                if (cmd.get_app_instance_name() == app_instance_name
                        and cmd.name == menu_name):
                    # found our match!
                    cmd.add_command_to_menu(self._menu_path)
                    # mark as a favourite item
                    cmd.favourite = True

        cmds.menuItem(divider=True, parent=self._menu_path)

        # now go through all of the menu items.
        # separate them out into various sections
        commands_by_app = {}

        for command in menu_items:

            if command.get_type() == "context_menu":
                # context menu!
                command.add_command_to_menu(self._context_menu)

            else:
                # normal menu
                app_name = command.get_app_name()
                if app_name is None:
                    # un-parented app
                    app_name = "Other Items"
                if not app_name in commands_by_app:
                    commands_by_app[app_name] = []
                commands_by_app[app_name].append(command)

        # now add all apps to main menu
        self._add_app_menu(commands_by_app)
Esempio n. 54
0
def build():
    """build zfused maya menu 
    """
    # ===============================================================
    # main menu
    cmds.menu("zfused_outsource",
              parent="MayaWindow",
              label="zFused outsource",
              tearOff=True)
    _menu_data = menu.get_menu_data()
    cmds.menuItem(label=u"", divider=True, parent="zfused_outsource")
    _company_id = record.current_company_id()
    if _company_id:
        _company_name = zfused_api.company.Company(_company_id).name()
    else:
        _company_name = u"未设置公司"
    cmds.menuItem(
        "zfused_company",
        label=u"{}".format(_company_name),
        command=
        "from zfused_maya.interface import menubar;menubar.change_company();",
        parent="zfused_outsource")
    cmds.menuItem(label=u"", divider=True, parent="zfused_outsource")

    for _menu_title in menu.MENU_KEY:
        cmds.menuItem(_menu_title,
                      label=_menu_title,
                      parent="zfused_outsource",
                      subMenu=True,
                      tearOff=True)
        if _menu_title in _menu_data.keys():
            # load menu
            category = []
            category_cmds = {}
            menu_data = _menu_data[_menu_title]
            for data in menu_data:
                cate = data["category"]
                if not cate in category:
                    category.append(cate)
                if not cate in category_cmds:
                    category_cmds[cate] = []
                category_cmds[cate].append(data)
            for ca in category:
                cmds.menuItem(label=ca, divider=True, parent=_menu_title)
                for data in category_cmds[ca]:
                    cmds.menuItem(data["name"],
                                  label=data["title"],
                                  parent=_menu_title,
                                  command=data["cmd"])
        cmds.menuItem(divider=True, parent="zfused_outsource")
    cmds.menuItem("about",
                  label=u"关于zFused",
                  command="",
                  parent="zfused_outsource")

    # project menu
    _build_project_menu()
Esempio n. 55
0
def main():
    configfile = get_menu_data (yaml_path)
    if configfile:
        if cmds.menu ('Beam_menu', exists = True):
            cmds.deleteUI ('Beam_menu')
        cmds.menu ('Beam_menu', label = configfile.keys () [0], to = True, p = 'MayaWindow')
        createmenu(configfile,'Beam_menu')
#a = get_menu_data(yaml_path)
#print a
Esempio n. 56
0
    def makeMenuBtn(self):
        self.fileMenu = cmds.menu(label="File")
        self.saveMenu = cmds.menuItem(label="Save a animation",
                                      command=self.saveCmd)
        self.loadMenu = cmds.menuItem(label="Load a animation",
                                      command=self.loadCmd)

        self.helpMenu = cmds.menu(label="Help")
        self.helpItem = cmds.menuItem(label="Don't rely on Help!!")
Esempio n. 57
0
 def commandMenu(self):
     self.editMenu = mc.menu(label="Edit")
     self.editMenuSave = mc.menuItem(label="Save Settings",
                                     command=self.editMenuSaveCmd)
     self.editMenuReset = mc.menuItem(label="Reset Settings",
                                      command=self.editMenuResetCmd)
     self.helpMenu = mc.menu(label="Help")
     self.helpMenuItem = mc.menuItem(label="Help on %s" % (self.title),
                                     command=self.helpMenuCmd)
Esempio n. 58
0
 def __init__(self, label, helpMenu = False, parent = False, tearOff = False ):
     """
     Start a new menu with the gIven options.
     """
     
     if parent == False:
         self.mName = cmds.menu( label = label, helpMenu = helpMenu, tearOff = tearOff )
     else:
         self.mName = cmds.menu( label = label, helpMenu = helpMenu, tearOff = tearOff, parent = parent )