Jump to content

find string selections automatically for custom subnet


tagosaku

Recommended Posts

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:

menu_script.png.4b9c3c7358621984c91f2dbcb0f9b5da.png

Example:

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:

group_and_name_menu.png.bc4edf88b676fd6c4c8ccac2b924c42a.png

 

group_and_name_menu.hipnc

Edited by f1480187
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...