

#this will be matched against tool directories MainWindowMenus = mc.window(gMainWindow, query=True, menuArray=True) #get all the menus that are children of the main menu GMainWindow = mm.eval('$temp=$gMainWindow') # don't edit any space or syntax here as this is what Maya # can put Maya's original dag menu command in mel # this will return the original menu parent so that we # we call the mGear_dag_menu_callback with the future state If "mgear_dagmenu_callback" in menu_cmd.func._name_: # to get the function name by using partial.func # here because we override original function we need # we now check if the command override is one from us # back the default state of Maya's dag menuĮlif not state and type(menu_cmd) = partial: # this we need to do some small hack on mGear_dag_menu_callback to give # The override part uses a python function partial call and because of # This is tricky because Maya's default menu command is a MEL call

# If state is set to False then put back Maya's dag menu # Override dag menu with custom command callĬmds.menu(maya_menu, edit=True, postMenuCommand=partial(

# Maya's dag menu post command has the parent menu in it If "buildObjectMenuItemsNow" in menu_cmd: # If state is set top True then override Maya's dag menu Menu_cmd = nu(maya_menu, query=True, postMenuCommand=True) or # We now get the menu's post command which is a command used for # First loop on Maya menus as Maya's dag menu is a menu State (bool): Whether or not to override Maya's dag menu with mGear's When turned on this will interact with dag nodes that This function is responsible for turning ON or OFF mgear's right click """Set on or off the mgear dag menu override Mc.menuItem(label='Submit a Bug or Request', command=(_showHelpCommand(WEBSITE_URL+'/about/'))) Mc.menuItem(label='Python Command Documentation', command=(_showHelpCommand(TOOL_URL+'#\%5B\%5B'+self.name+'\%20Python\%20Documentation\%5D\%5D'))) Mc.menuItem(label='Documentation', command=(_showHelpCommand(TOOL_URL+self.name+'/'))) Mc.menuItem(label='About', command=self.about) Tool.createMenuItem(parent=self.mainMenus, labelPrefix=MENU_ITEM_PREFIX+' ', italicized=True)Ĭommand='import ml_utilities ml_utilities.createShelfButton("import '+module+' '+module+'.ui()", name="'+self.name+'", description="Open the UI for '+self.name+'."'+argString+')')Ĭommand=(_showHelpCommand(ICON_URL+self.name+'.png')))Ĭommand=(_showHelpCommand(WEBSITE_URL+'/tools/'))) Pmc = mc.menu(self.mainMenus, query=True, postMenuCommand=True)ĮachLabel = mc.menuItem(each, query=True, label=True) #if this menu hasn't been built yet, run the post menu command to build it MenuItemArray = mc.menu(self.mainMenus, query=True, itemArray=True) FormatLabel = menuLabel.replace(' ','').lower()
