Jump to content

find string selections automatically for custom subnet

Recommended Posts

When creating subnet and putting strings, I want to create auto string's selection like a attached picture. How can I do it for group, primitive, and volume names?


Share this post

Link to post
Share on other sites

1. Easy way. From the description, it sounds like you need something similar to common Group parameter. Create dummy node inside subnet in a proper place and promote the Group parameter. It will pick the menu script you need. Optionally, remove the code from parameter template's Action Button tab or, alternatively, promote Group Type parameter to make viewport selection button work, if you want.

2. Hard way. When you need something more custom, it is done via Python (or HScript) using Menu tab on selected parameter template in the parameter editor:



from itertools import chain

geo = kwargs['node'].geometry()

groups = [g.name() for g in geo.primGroups()]
group_menu = [(g, g) for g in groups]

names = geo.findPrimAttrib('name').strings()
name_menu = [('@name=' + n, '@' + n) for n in names]

separator = [('sep', '')]

menu = group_menu + separator + name_menu

return list(chain(*menu))

This will add menu for primitive selections:




Edited by f1480187
  • Like 1
  • Thanks 2

Share this post

Link to post
Share on other sites

Hi, I downloaded the file. I think coding is very hardcore, so will take dummy way. Thank you, Master!!

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