Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Adding a Custom Menu to Main menu Bar C++ SDK

Adding a Custom Menu to Main menu Bar C++ SDK

Anonymous
Not applicable
2,315 Views
6 Replies
Message 1 of 7

Adding a Custom Menu to Main menu Bar C++ SDK

Anonymous
Not applicable

Hello, 

 

I'm quite confused about the Global Utility Plugin not having a User Interface:

I need to write a plugin that puts every python tools my project has in a menu in the main menu bar where they are easily accessible.

 

- first off do I really need to run maxscript from C++ in order to execute my python script? the API doesn't seem to make a method available for running python files and using the python GUP is too complex for what I need to do.

 

- second I need to make the menu independent of any UI files (that means registering and unregistering menus), I work with codev and don't have access to their computer to deploy stuff myself (and they don't all have the same kind of setup) so I need something they can just drop into stdplug folder and forget about. so unless there is something that works as nicely for this as a GUP plugin I kind of need it.

 

-third I looked at the UtilityObj Class but I can't seem to get it to work nicely with GUP. it does compile but nothing shows up, I also try doing all the menu setup in a python script so the interaction between c++ and python would be a little less awkward meaning I just run this script at startup. the script does run well and prints what it is supposed to in the console but menus don't show up. (can't post code unfortunately because of NDA)

 

I'm looking into system plugins doc and I have read the recommended samples and Howto but I'm kind of at the end of the rope here, and wondering if there isn't something simpler that could be done. 

 

UPDATE:

found this while going over the doc again (doclink😞

"If a plugin wants to add menus and items to 3ds Max's existing menus, or create its own quad menu context, it should be done when 3ds Max starts. This is best done with a global utility plugin (GUP). These plug-ins have a GUP::Start(), method that is called when 3ds Max's first starts up. It is in that method that plugins should register new contexts and add menus and items." 

So now I wonder why it doesn't work. Especially from a python script?

 

0 Likes
Accepted solutions (1)
2,316 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Accepted solution

I don't know what version of Max you are using, but maybe my answer in my other post could help you : 
https://forums.autodesk.com/t5/3ds-max-programming/net-custom-menu-in-3dsmax-2018/m-p/7952860/highli...

Message 3 of 7

Anonymous
Not applicable

Thanks!

I do work with 3dsmax 2018.2, I tried your solution, unfortunately, it seems the notification doesn't get executed.

since I work with c++ it's a static method instead of a delegate but it should work (docNotify)

as always it compiles fine, doesn't send errors but I'm not breaking in my method. 

I use NOTIFY_SYSTEM_STARTUP as an event, and pass my GUP object as a param. 

Would you have any Idea why that is?

0 Likes
Message 4 of 7

Anonymous
Not applicable

Okay, I had another problem that had nothing to do with it! it does work now : )

Thanks a lot for your help I would never have found out otherwise!

0 Likes
Message 5 of 7

Anonymous
Not applicable

Hi, wysk9. Ill remember you: about your attempts to setup your menu item to MenuBar of 3ds MAX. So, had you come to a solution to this problem with RegisterNotification(*someFuncToStartUp*, this, NOTIFY_SYSTEM_STARTUP)? Or did you solve this problem somehow differently?

 

0 Likes
Message 6 of 7

chrisdawlud
Enthusiast
Enthusiast

You can check out how it's done in Houdini Engine for 3ds Max.

0 Likes
Message 7 of 7

Anonymous
Not applicable

I did exactly the same thing. Let me explain the problem. When you first start in the first seconds of loading max plugin appears. Then all the loading to the end takes place and it disappears. As I understand it, in the main stage max reads data from the menu file (it can be obtained using the getmenufile () menu Manager method), and all changes made to the menu by the plugin are removed. In subsequent launches this does not happen. By the way, my plugin adds a position in the rendering menu, I do not need to create anything in the main menu.

0 Likes