Jump to content
MostHated

Possible to interact with main menu via script?

Recommended Posts

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 by MostHated

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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 by MostHated

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I think I have an idea worked out for this that should work, I will report back after I give it a go.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×