Menu and CUI Loading

Topic: version 4 MAXScript Language Improvements /User Interface

You can now load a menu file in MAXScript as follows:

menuMan.loadMenuFile "MaxModelingMenu.mnu"

The full path should not be specified. It will look in the appropriate directories for menu files. The default is the "ui" directory.

You can set the main menu in max as follows:

menuMan.setMainMenuBar "Menu Bar1"

To restore MAX's default main menu:

menuMan.setMainMenuBar "Main Menu Bar"

The function returns true of it succeeds and false if it can't find the named menu.

You can set the quad right-click menu that MAX uses in the viewports using the following MAXScript:

menuMan.setViewportRightClickMenu #nonePressed "Modeling 2"

Sets the default (no keys pressed) quad menu to "Modeling 2". The menu name must be a quad menu that is listed in the "Quads" customization dialog, and the name must match exactly, including capitalization.

For the first parameter, you can use one of the following 8 values:

#nonePressed

#shiftPressed

#altPressed

#controlPressed

#shiftAndAltPressed

#shiftAndControlPressed

#controlAndAltPressed

#shiftAndAltAndControlPressed

Here are two macroScripts that set and reset two of the right-click menus:

Example:

macroScript SetQuads

category:"Custom UI"

tooltip:"Set Quad"

(

on execute do

(

menuMan.setViewportRightClickMenu #nonePressed "Modeling 2"

menuMan.setViewportRightClickMenu #controlPressed "Sample 4x1"

)

)

------------------------------

macroScript ResetQuads

category:"Custom UI"

tooltip:"Reset Quads"

(

on execute do

(

menuMan.setViewportRightClickMenu #nonePressed "Default Viewport Quad"

menuMan.setViewportRightClickMenu #controlPressed "Modeling 1 [Cntrl+RMB]"

)

)

You can display a quad menu like this:

menuMan.trackQuadMenu "Default Viewport Quad"

The menu name must be a quad menu that is listed in the "Quads" customization dialog, and the name must match exactly, including capitalization.

You can load a CUI file from MAXScript as follows:

maxOps.loadCUIFile "ModelingCUI.cui"

It will search the appropriate UI directory for the .cui file.

cui.expertModeOff() -- Turns expert mode on

cui.expertModeOff() -- Turns expert mode off

cui.getExpertMode() -- returns true of expert mode is on

cui.commandPanelOpen

Lets you get and set whether the command panel is displayed. A Boolean value - true if the command panel is displayed, false if not displayed.

See also