How to dynamically create a radial menu in viewer state

   397   0   0
User Avatar
Member
10 posts
Joined: 4月 2020
Offline
I know self.scene_viewer.displayRadialMenu('name of an registered radial menu') can show menu on the screen
What I want is dynamically bind action callback for the items in an exist radial menu or make an temp radial menu.
I have noticed that I can get radial menu by rm = hou.ui.radialMenu('menu name'). Then get item on top by top_it=rm.root().item(hou.radialItemLocation.Top). But it looks like that top_it.setActionCallback(func) don't work. In the document it says setActionCallback only works on temporary items created via hou.ui.createRadialItem, which mean I have to create temporary radial menu.
The document also mentioned about hou.ui.injectRadialItem and hou.ui.injectRadialMenu. I may need to create a temporary radial menu by these methods. However I tried those methods and nothing happens. I guess maybe they have been deprecated now.
Is there anyone knows how to use these methods?
  • Quick Links