How to make a dropdown menu of all values of an attribute?

   475   1   0
User Avatar
Member
444 posts
Joined: Aug. 2019
Offline
Character Blend Shapes Add SOP has this neat dropdown menu:



It has always been a mystery to me. The items in this dropdown menu seem to be updated along with the input geometry's name attribute. How could I make something similar for my own HDA?

I checked it's parameter interface, but surprisingly, there isn't a special tag or something:

Attachments:
Screenshot 2023-12-22 175351.png (21.9 KB)
Screenshot 2023-12-22 175654.png (42.5 KB)

User Avatar
Member
8555 posts
Joined: July 2007
Offline
you can for example use this menu script to get menu out of unique values of primitive name attribute of first input geo:
menu = []
geo = kwargs['node'].inputGeometry(0)
if geo:
    attrib = geo.findPrimAttrib("name")
    if attrib:
        for name in attrib.strings():
            menu += [name, name]
return menu
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links