def __init__(self, parent): self.parent = parent self.mainWindow = parent.mainWindow self.mmmmTools = self.parent.parent self.mmmm = self.mmmmTools self.ini = self.parent.ini self.conf = self.ini.conf self.ui = self.parent self.menuCount = 0 self.submenus = {} try: pm.deleteUI( self.menu, menu=True ) except: print( 'Not deleting old main MmmmTools menu, probably because Maya is just starting and it does not yet exist. For exception code see: "Ui.MainMenu.__init__" ') #traceback.print_exc() try: ##Turns out that the main window is capable of directly supporting menus, almost as if it is a menuBarLayout. try: pm.deleteUI('MmmmTools') except: doNothing = "MmmmTools isn't in menu" self.menu = pm.menu( 'MmmmTools', parent=self.mainWindow, label = 'MmmmTools', tearOff=True ) ## **** Here we need someway to delete old menus! **** eg: self.mmmmTools.persistent.menusToDelete.append( self.menu ) except: print("MmmmTools Menu could not be created. Perhaps it already exists and this is not a problem.") traceback.print_exc()
def createGUI(self): self.window = pm.window(menuBar=True) menu = pm.menu(label='File', tearOff=True) pm.rowColumnLayout( numberOfColumns=3 ) self.obj.createFormGUI() self.obj._createAttrGUI() self.obj._createScriptGUI() return self.window
def __init__(self, parent): self.parent = parent self.mainWindow = parent.mainWindow self.mmmmTools = self.parent.parent self.mmmm = self.mmmmTools self.ini = self.parent.ini self.conf = self.ini.conf self.ui = self.parent self.menuCount = 0 self.submenus = {} try: pm.deleteUI(self.menu, menu=True) except: print( 'Not deleting old main MmmmTools menu, probably because Maya is just starting and it does not yet exist. For exception code see: "Ui.MainMenu.__init__" ' ) #traceback.print_exc() try: ##Turns out that the main window is capable of directly supporting menus, almost as if it is a menuBarLayout. try: pm.deleteUI('MmmmTools') except: doNothing = "MmmmTools isn't in menu" self.menu = pm.menu('MmmmTools', parent=self.mainWindow, label='MmmmTools', tearOff=True) ## **** Here we need someway to delete old menus! **** eg: self.mmmmTools.persistent.menusToDelete.append( self.menu ) except: print( "MmmmTools Menu could not be created. Perhaps it already exists and this is not a problem." ) traceback.print_exc()
def __new__(cls, name="pymelLoggingControl", parent=None): if pymel.menu(name, ex=1): pymel.deleteUI(name) self = pymel.menu(name, l='Logging Control', aob=True, p=parent) return pymel.Menu.__new__(cls, self)
def curve_points(): import CustomScripts CustomScripts.curve_through_points() return None def insert_joints(): import insertJointsUI insertJointsUI.insert_joints_UI() return None menuName = "Custom_Menu" mainMenu = pm.PyUI( pm.getMelGlobal('string', 'gMainWindow') ) try: if pm.menu(Custom_Tools, query=True, exists=True): pm.deleteUI(Custom_Tools) except: print "Creating New Menu" with mainMenu: if pm.menu(menuName, query=True, exists = True): pm.menu(menuName, edit=True, deleteAllItems=True) #Custom_Tools = pm.menu( label=menuName, tearOff=True ) Custom_Tools = pm.menu(label=menuName) with Custom_Tools: obj_cr_btn = pm.menuItem( label="Object creator",command=lambda x: obj_creat()) cus_tls_btn = pm.menuItem( label="Custom Tools",command=lambda x: cus_tls()) const_btn = pm.menuItem( label="Constraint",command=lambda x: con_tls()) tnk_trd_bth = pm.menuItem( label="Tank Tread Rig (arun)", command=lambda x: tank_trd()) cpy_sdk_btn = pm.menuItem( label="Copy Sdk (arun)", command=lambda x: copy_sdk())