View Full Version : Menus in Max
ramesh03 07-23-2007, 03:52 AM Hi Everybody,
How to create and attach menus and menu items to the main window in 3Ds Max through Max-Scripting.
ThanX.
|
|
RustyKnight
07-23-2007, 07:31 AM
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
ypuech
07-23-2007, 08:11 AM
You have full access to menu modification and creation trough scripting. See Menu Manager in the MAXScript Reference.
Mr-BlueSummers
07-24-2007, 06:12 PM
Indeed you can do quite a lot with MenuMan.
ramesh03
07-25-2007, 03:19 AM
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.
ypuech
07-25-2007, 07:53 AM
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.
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.
ramesh03
07-25-2007, 08:13 AM
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.......
ypuech
07-25-2007, 08:32 AM
But i dont want to add my menu through "under MAXScript Tools and Interaction with 3ds Max > Interacting with the 3ds Max User Interface" i want all the things through script.
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.)
ramesh03
07-25-2007, 10:49 AM
OOHHHH,
Sorry Yar,I am sorry. Now its fine .Its working very good.Many many thanks for this help.
Now my doubt clear.
Thanksssss.
RustyKnight
09-03-2007, 06:40 AM
I do so like been proved wrong :). I have even discovered that you can "convert" a rollup into a toolbar item.
Shane
ramesh03
09-10-2007, 07:36 AM
Hi Everybody.
Actually this Script working for me.But when i run this script first time its ok.When i change my menu name its not updating.and also how to add menu items here.i want to add 4 or 5 menu items.If anybody help with code greate for me.
if menuMan.registerMenuContext 0x6d2f869 then
(
-- Get the main menu bar
local mainMenuBar = menuMan.getMainMenuBar()
-- Create a new menu
local subMenu = menuMan.createMenu "Gameshastra"
-- Create a menu item that calls the sample macroScript
local testItem = menuMan.createActionItem "Add Char" "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()
)
macroScript MyTest
category:"Menu Test"
tooltip:"Test Menu Item"
(
on execute do print "Hello World!"
)
CGTalk Moderation
09-10-2007, 07:36 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.