PDA

View Full Version : menuMan.registerMenuContext


JHN
12-26-2008, 02:55 PM
What is the use of "menuMan.registerMenuContext" exactly, if I register a menu without it, will it be gone the next time I start max? That's what I understand from the docs, but that's not what I'm seeing, I can easily restart max and the menu is still there... is it mandatory? What happens when I don't use it?

Thanks,
Johan "almost finished his comprehensive flexible menu/script system" Boekhoven

Bobo
12-26-2008, 03:40 PM
What is the use of "menuMan.registerMenuContext" exactly, if I register a menu without it, will it be gone the next time I start max? That's what I understand from the docs, but that's not what I'm seeing, I can easily restart max and the menu is still there... is it mandatory? What happens when I don't use it?

Thanks,
Johan "almost finished his comprehensive flexible menu/script system" Boekhoven

Disclaimer: This was written in Max 4, one year before I started messing with the Help.

In short, the idea is that you could define a unique ID integer for your menu and register with the system when adding to the Main Menu of Max. This allows you to "know" whether your menu is already registered next time you decide to add that same menu. Thus, you only have to check whether the return value is true. If it is false, you know the menu is already there and should not be added a second time.

If you add your menus without it, you have to manually scan for a previous version by name, otherwise you can get multiple occurrences of your menu in the Main Menu.

Something along those lines. I don't think anyone uses it. ;)

ZeBoxx2
12-26-2008, 06:07 PM
Indeed... I looked into the menuman bits for our menus and quickly discarded the menu context registering bits and pieces; it will tell you one thing and one thing only - whether you can register another menu with the same ID. It doesn't let you do things like -getting- the menu that has that ID, so if you think that you can update a menu by getting the menu by ID... no such luck. Removing the menu? Same thing. In the end, you'll always have to scan for your specific menu entries yourself and handle them from there. That's assuming you don't dare bother with any custom UI entries made by the user themselves - things get real fun if you do :D

JHN
12-26-2008, 08:55 PM
Alright thanks for the feedback. I'm skipping the registering then... I'm storing the menu and submenu references/names in a ini file and I'm destroying the menu via that, whenever I need to update the menu.

Is there also a way to make sure a macroscript entry is properly cleared besides deleting the mcr? Or is deleting it enough to make sure your rid of it (guess so).

I'd like to take a moment here to express my feelings and how I really think this whole menu system is a big mess and causing me a bit of a headache... There's no (no easy) way to do some proper management... I'd rather have some xml files and walk through that then this really crappy way to assign macroscripts etc... I hate macroscripts too, I would like 1 type of script that I can run or dock and that's it... now I'm wrapping my scripts in a macroscript with fileIn just to register it as a menu entry.. how weird is that. I've never feld very comfortable with macroscripts...
You can make macroscripts in .ms files, or as .mcr. You can create multiple macroscripts per file, different contexts etc... it's all nice and stuff, but I couldn't care really, I want to be able to quickly build/destroy menu's context sensitive, and not in 150+ lines of code just to make sure it's properly registered and or destroyed... it's very uneconomical... ohwell, almost there...

Mumble, ramble...blabla
-Johan

CGTalk Moderation
12-26-2008, 08:55 PM
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.