Interface: menuMan

Interfaces > Core Interfaces > menuMan

 

   

Core Interfaces - Quick Navigation

The MenuMan Core Interface provides access to the Menu Manager and allows the user to create new and access existing menus and QuadMenus and their sub-menus and menu items as well as load, save, register and unregister them.

For details and examples of using this interface, see also the topic Menu Manager

Menu Loading And Saving

<boolean>menuMan.loadMenuFile <filename>file 		

This method allows you to load a menu file from disk and automatically update the UI accordingly. Returns true if the menu file was loaded, otherwise false .

<string>file: The path and filename of the menu file to load.

   

<boolean>menuMan.saveMenuFile <filename>file 	 

This method allows you to save a menu file to disk. Returns true if the menu file was saved, otherwise false .

<string>file: The path and filename of the menu file to save.

   

<string>menuMan.getMenuFile()   

This method returns the file name of the currently loaded and active menu file.

   

Finding Menus

<Interface>menuMan.findMenu <string>menuName 

This method will return a pointer to a menu based on its name. Returns a menu MixinInterface to the menu or undefined if the menu was not found.

<string>menuName: The name of the menu to return.

   

<Interface>menuMan.findQuadMenu <string>menuName 

This method will return a pointer to a quad menu based on its name. Returns a quadMenu MixinInterface to the quad menu or undefined if the menu was not found.

<string>menuName: The name of the menu to return.

   

Querying Menu Count

<integer>menuMan.numMenus() 

Returns the total number of menus in registered with the menu manager.

   

<integer>menuMan.numQuadMenus() 

Returns the total number of quad menus registered with the menu manager.

   

Getting Menus

<Interface>menuMan.getMenu <index>index 

Retrieves the indexed menu in the menu manager. This is a 1-based index. Returns a menu MixinInterface.

   

<Interface>menuMan.getQuadMenu <index>index 

Retrieves the indexed quad menu in the menu manager. This is a 1-based index. Returns a quadMenu MixinInterface.

   

Creating Menus

<Interface>menuMan.createMenu <string>name 

This method creates a new, empty menu with the given name and returns a menu MixinInterface.

   

<Interface>menuMan.createQuadMenu <string>name <string>quad1Name <string>quad2Name <string>quad3Name <string>quad4Name 

This method creates a new, empty quad menu. It contains 4 empty menus, one for each quad. Returns a quadMenu MixinInterface.

   

<Interface>menuMan.createSubMenuItem <string>name <Interface>subMenu 

This method creates a new sub-menu item that can be added to a menu. It uses the given "name" and it displays the given sub-menu. Returns a MenuItem MixinInterface.

   

<Interface>menuMan.createSeparatorItem() 

This creates a new menu separator that can be added to a menu. Returns a MenuItem MixinInterface.

   

<Interface>menuMan.createActionItem <string>macroScriptName <string>macroScriptCategory 

This method creates a new menu item that can be added to a menu. The item is an action that executes the macro script with the given name and category. Returns a MenuItem MixinInterface when successful, or "undefined" if there is no macroScript with the given name and category.

   

<Interface>menuMan.createMenuItemFromAction <string>group <string>action category:<string> 

category default value: undefined

This method creates a new menu item from an action and returns a menu MixinInterface.

Available in 3ds Max 2008 and higher.

   

Viewport Right Click Menus

<boolean>menuMan.setViewportRightClickMenu <enum>which <Interface>menu 

which enums: {#nonePressed | #shiftPressed | #altPressed | #controlPressed | #shiftAndAltPressed | #shiftAndControlPressed | #controlAndAltPressed | #shiftAndAltAndControlPressed} 		  

This method method allows you to set the viewport right-click menu to the specified quad menu. Returns true if it was set successfully.

<enum>which : See the List of Right-Click Contexts above.

<Interface>menu: A pointer to the quad menu you wish to set.

   

<Interface>menuMan.getViewportRightClickMenu <enum>which 

which enums: {#nonePressed | #shiftPressed | #altPressed | #controlPressed | #shiftAndAltPressed | #shiftAndControlPressed | #controlAndAltPressed | #shiftAndAltAndControlPressed}

This method returns a quadMenu MixinInterface to the current viewport right-click quad menu.

<enum>which: See the List of Right-Click Contexts.

   

Main Menu Bar

<Interface>menuMan.getMainMenuBar() 

This method returns a menu MixinInterface to the main menu bar.

   

<boolean>menuMan.setMainMenuBar <Interface>menu 

This method allows you to set the main menu bar. Returns true if it was set successfully.

<Interface>menu: A menu MixinInterface to the menu you wish to set as the main menu bar.

   

QuadMenu Settings

<bool>menuMan.getShowAllQuads <Interface>quadMenu 

This method checks if the "Show All Quads" flag is set for a specific QuadMenu. This method will return true if the flag is set or false if the flag is not set.

<Interface>quadMenu: A quadMenu MixinInterface to the QuadMenu you wish to check the flag for.

   

<void>menuMan.setShowAllQuads <Interface>quadMenu <bool>value 

This method sets the "Show All Quads" flag for a specific QuadMenu.

<Interface>quadMenu : A quadMenu MixinInterface to the QuadMenu you wish to set the flag for.

<bool>value: True to set the flag to on, false to set the flag off.

   

<string>menuMan.getQuadMenuName <Interface>quadMenu 

This method returns the name given to a specific QuadMenu as a string.

<Interface>quadMenu: A quadMenu MixinInterface to the QuadMenu for which you wish to retrieve the name.

   

<void>menuMan.setQuadMenuName <Interface>quadMenu <string>name 

This method allows you to set the name of a specific QuadMenu.

<Interface>quadMenu : A quadMenu MixinInterface to the QuadMenu for which you wish to set the name.

<string>name: The string containing the name for the QuadMenu.

   

Update Menu

<void>menuMan.updateMenuBar() 

This method can be called to update 3ds Max’ main menu bar after adding sub-menu’s or menu items.

   

<boolean>menuMan.registerMenuContext <integer>contextId 

To add items to 3ds Max’s main menu, the plug-in should check the return value of RegisterMenuContext() , and if it is true , that means that this is the first time it has been registered, and the plug-in can then create new menus, add items to 3ds Max’s main menu and Quad menus.

   

Unregistering Menus

<boolean>menuMan.unRegisterMenu <Interface>menu 

This method allows you to remove a menu form the mananger. Returns false if the menu was not registered, true if successfully unregistered.

<Interface>menu: Points to the menu to unregister.

   

<boolean>menuMan.unRegisterQuadMenu <Interface>quadMenu 

This is like "unregisterMenu" but for quad menus.

   

Mixin Interface: menuMan.getMenu(...)

Interface: menu 

The menu [Mixin Interface] is returned by several methods described earlier on this page.

Methods:

<void><MixinInterface:menu>.setTitle <string>title 

Sets the menu title to the supplied string.

   

<&string><MixinInterface:menu>.getTitle() 

Returns the menu title.

   

<integer><MixinInterface:menu>.numItems() 

Returns the number of menu items.

   

<Interface><MixinInterface:menu>.getItem <index>position 

Returns a menuItem MixinInterface to the indexed menu item.

   

<void><MixinInterface:menu>.addItem <Interface>item <index>position 

Adds a new menu item to the menu at the specified position.

   

<void><MixinInterface:menu>.removeItemByPosition <index>position 

Removes the indexed menu item.

   

<void><MixinInterface:menu>.removeItem <Interface>item 

Removes the specified menu item.

   

Mixin Interface: menuMan.getQuadMenu(...)

Interface: quadMenu 

The quadMenu [Mixin Interface] is returned by several methods described earlier on this page.

Methods:

<Interface><MixinInterface:quadMenu>.getMenu <index>position 

Returns a menu MixinInterface to the indexed menu (1 to 4).

   

<void><MixinInterface:quadMenu>.trackMenu <bool>showAllQuads 

When set to true , forces the quadMenu to show all quads.

   

Mixin Interface: menuMan.createSubMenuItem(...)

Interface: menuItem 

The menuItem [Mixin Interface] is returned by several methods described earlier on this page.

Methods:

<void><MixinInterface:menuItem>.setTitle <string>title 

Sets the menu item title to the supplied string.

   

<&string><MixinInterface:menuItem>.getTitle() 

Returns the menu item title.

   

<bool><MixinInterface:menuItem>.setUseCustomTitle <bool>value 

When true is supplied, forces the menu item to show the custom title.

   

<bool><MixinInterface:menuItem>.getUseCustomTitle() 

Returns true if custom title is enabled, false otherwise.

   

<bool><MixinInterface:menuItem>.setDisplayFlat <bool>value 

When true is supplied, forces the menu item to be displayed as flat.

   

<bool><MixinInterface:menuItem>.getDisplayFlat() 

Returns true if the menu item is set to display as flat.

   

<bool><MixinInterface:menuItem>.getIsSeparator() 

Returns true if the menu item is a separator.

   

<Interface><MixinInterface:menuItem>.getSubMenu() 

Returns a menu MixinInterface to the sub-menu.

   

See Also