Problem with implementing scriptMenuStripDynamicRadio

   98   0   1
User Avatar
Member
19 posts
Joined: March 2022
Offline
I'm trying to create a menu using scriptMenuStripDynamicRadio to replicate a menu with a list of available Desktops. This menu will have a custom implementation that I’ll omit for now to avoid confusion. However, it’s not covered how to use scriptMenuStripDynamicRadio in the official documentation Customize Menu documentation [www.sidefx.com]. I did some research and I found the menu.xsd file that at location in C:\Program Files\Side Effects Software\Houdini20.5\houdini\menu.xsd, it seems that Houdini supports this type of menu.

Here is explanation from the file
<xs:element name="scriptMenuStripDynamicRadio" 
	type="scriptDynamicMenuStripRadio_type"> 
      <xs:annotation><xs:documentation>  
        Defines a composite menu item (i.e, the strip) consisting of a set of
	radio items, where only one such item can be selected in a strip.
	The contents items are defined by a custom script.
      </xs:documentation></xs:annotation>

I’ve attempted to adapt the approach described for scriptMenuStripDynamic, but I can't get it to work. Has anyone else successfully used the Radio version? Any advice or suggestions would be greatly appreciated!

<?xml version="1.0" encoding="UTF-8"?>
<menuDocument>
        <menu>
                <scriptMenuStripDynamicRadio id="my_desktop_strip">
                <insertAtIndex>0</insertAtIndex>
                <contentsScriptCode>
<![CDATA[
import hou
menu_items = [name for desktop in hou.ui.desktops() for name in (desktop.name(), desktop.name())]
return menu_items
]]>
                </contentsScriptCode>
                
                <scriptCode>
                </scriptCode>
                </scriptMenuStripDynamicRadio>
</menu>
</menuDocument>
Edited by timurproko - today 07:48:17
  • Quick Links