3ds Max comes with one pre-defined IMenuBarContext
, which is used to obtain the menu used on 3ds Max's main menu bar. Its context id is kMenuContextMenuBar
. When a plugin wants to add items or sub-menus to the main menu bar, it should get the menu from the main menu bar context as follows:
IMenuBarContext* pMenuBarContext = ( IMenuBarContext*) \
GetCOREInterface()->GetMenuManager->GetContext(kMenuContextMenuBar);
IMenu* pMenu = pMenuBarContext->GetMenu();
The program can then use the IMenu
class methods to add items or sub-menus to the main menu. It is recommended that plugins add their own top-level menu rather than adding items to existing menus.
The other use of the IMenuBar
context is mentioned above. Plug-ins can register a menu bar context with its own ID to determine whether it should extend the main menu or not.