[Closed] Menus in Max
Hi Everybody,
How to create and attach menus and menu items to the main window in 3Ds Max through Max-Scripting.
ThanX.
I don’t think you can change menu bars, menu items, toolbars or toolbar items from within maxscript…but I certainly could be wrong
Shane
You have full access to menu modification and creation trough scripting. See Menu Manager in the MAXScript Reference.
Hi
Thanks for you valuable suggestions.What i need is, when i open Max it read all the scripts from server(i know how to read) and executes Max with my Menu(What i created through script).And it must attached to the Main Window.In Maya i am doing like this through MEL-Scripting.But here i dont know to add my Menu to the main window through Script.
Regards,
Ramesh Chowdary.
As said before, look at Menu Manager in MAXScript Reference (under MAXScript Tools and Interaction with 3ds Max > Interacting with the 3ds Max User Interface). There’s some script examples showing how to do that.
Yah Good,But i dont want to add my menu through “Custom > User Interface ” i want all the things through script.In Menu Manager i foung some useful things,Now i am searching…
I think you’ve misunderstood what I said. I’ve mentionned that to just tell you where the doc about Menu Manager is.
As written in the MAXScript Reference here is an example showing how to add a new entry menu in the main window :
-- This example adds a new sub-menu to MAX's main menu bar.
-- It adds the menu just before the "Help" menu.
-- Register a menu context. This returns true the first time it
-- is registered, and we can add things to the menu. If
-- it returns false, then the context is already registered,
-- and the items are already in the menu.
-- The number 0x1ee76d8e is random, and can be generated
-- using the genClassID() function.
if menuMan.registerMenuContext 0x1ee76d8e then
(
-- Get the main menu bar
local mainMenuBar = menuMan.getMainMenuBar()
-- Create a new menu
local subMenu = menuMan.createMenu "Test Menu"
-- Create a menu item that calls the sample macroScript
local testItem = menuMan.createActionItem "MyTest" "Menu Test"
-- Add the item to the menu
subMenu.addItem testItem -1
-- Create a new menu item with the menu as it's sub-menu
local subMenuItem = menuMan.createSubMenuItem "Test Menu" subMenu
-- Compute the index of the next-to-last menu item in the main menu bar
local subMenuIndex = mainMenuBar.numItems() - 1
-- Add the sub-menu just at the second to last slot
mainMenuBar.addItem subMenuItem subMenuIndex
-- Redraw the menu bar with the new item
menuMan.updateMenuBar()
)
And here is the small macroscript “MyTest” called when clicking the menu item “Menu Test” :
-- Sample menu extension script
-- If this script is placed in the "stdplugs\stdscripts"
-- folder, then this will add the new items to MAX's menu bar
-- when MAX starts.
-- A sample macroScript that we will attach to a menu item
macroScript MyTest
category:"Menu Test"
tooltip:"Test Menu Item"
(
on execute do print "Hello World!"
)
Read the reference to understand what each function are doing (menuMan.registerMenuContext, menuMan.createSubMenuItem etc.)
OOHHHH,
Sorry Yar,I am sorry. Now its fine .Its working very good.Many many thanks for this help.
Now my doubt clear.
Thanksssss.
I do so like been proved wrong :). I have even discovered that you can “convert” a rollup into a toolbar item.
Shane