MostHated Posted January 26, 2020 Share Posted January 26, 2020 (edited) Hello, I am wondering if it's possible to interact with the main menu via script (File, Edit, Assets, etc)? Such as returning a list of the current menu items at runtime. I say at runtime in case there are custom menu items which are not default, such as the RenderMan menu that shows up when it's installed, etc. Then if it is also possible to open specific menu items, or trigger their functionality via script? I have been searching all day in the help docs and github for examples but the closest things I can find have to do with what looks like simply creating new menu items with MenuParmTemplate(). I have found that there are menu items within MainMenuCommon.xml, but as an example, is there some way to get this info via something like menuList = hou.ui.getMenuNames() and then use hou.ui.openMenu(“h.Asset_Manager”)? I also was trying to see if there was a way to a list of all current hotkeys. I see there are ways to get specific ones if you have the context code or vice versa, but I was trying to see if there was a way to just get all of them that there are currently? Thanks, Edited January 26, 2020 by MostHated Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted January 26, 2020 Share Posted January 26, 2020 I don't think there's an API to read or trigger default menu items but for some of the menus a Python API exists. (for example - opening the Type Property dialog and others). Last time I needed something like this, there was even no HDK access to the menus. Quote Link to comment Share on other sites More sharing options...
MostHated Posted January 26, 2020 Author Share Posted January 26, 2020 (edited) The more I search, the more it seems like that is the case. It seems like most, if not all, of the menu items are present within the hotkey manager under the /Houdini/ context, so if I could figure out a way to dump everything that is in there, that might at least get me the names of everything. Edited January 26, 2020 by MostHated Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted January 26, 2020 Share Posted January 26, 2020 If all you need is just the menu items name, simple read the $HFS/houdini/MainMenuCommon.xml file with Python and you're good to go. Quote Link to comment Share on other sites More sharing options...
MostHated Posted January 27, 2020 Author Share Posted January 27, 2020 Yeah, that would be the fallback I suppose, but I was hoping to get it from within the application, in case there are custom things added or mapped via Houdini.env, it would help to get them all directly from it. It seems like there should be some sort of way to get an active current list. I will just have to keep searching. Quote Link to comment Share on other sites More sharing options...
MostHated Posted January 27, 2020 Author Share Posted January 27, 2020 I think I have an idea worked out for this that should work, I will report back after I give it a go. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.