Skip to content

Instantly share code, notes, and snippets.

@yone80
Last active May 31, 2016 17:19
Show Gist options
  • Save yone80/2917c4bba158666434cd89f270cc6273 to your computer and use it in GitHub Desktop.
Save yone80/2917c4bba158666434cd89f270cc6273 to your computer and use it in GitHub Desktop.
Houdini Python SOP
node = hou.pwd()
menu = []
parmvalues = kwargs['parm'].eval().split()
if node.inputs():
geo = node.inputs()[0].geometry()
typegroups = []
typegroups.append( geo.primGroups() )
typegroups.append( geo.pointGroups() )
typegroups.append( geo.edgeGroups() )
for groups in typegroups:
sepflag = False
for group in groups:
token = group.name()
label = token
if token in parmvalues:
label += ' *'
menu.extend((token, label))
if not sepflag: sepflag = True
if sepflag:
menu.extend(('seperator', ''))
sepflag = False
if len(menu) > 0 and menu[-1] == '':
menu = menu[:-2]
return menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment