Initialize custom SOP with current selection pattern

   1690   1   0
User Avatar
Member
19 posts
Joined: 5月 2016
Offline
I can create a group node based on a current geometry selection. Doing so creates a group node instance with a pattern initialized to the selection.

I would like to use the same mechanism for my custom SOP. That is, I would like to intialize the SOP with the current selection pattern.

I have no idea where the group nodes pull this initialization data from. Can anyone point me in the right direction?

Thanks.
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
This is all happening in the Tool python HOM scripts that are initialized when you invoke the tool.

Many SOPs inherit a default tool behaviour where if you have a parameter string called “group” that is identically set up to any SOPs group parameter, that new SOP will inherit the viewport selection and add that selection to it's group parameter. That would be the soptoolutils.genericSopNodeFilterTool() HOM python function.


RMB on any of the shelf tools for any SOP and choose Edit to see the HOM python code used to set the viewport interactive set-up behaviour.

For example the Loft SOP has this as a tool script:

import soptoolutils
u_selector_only = [0]
node = soptoolutils.genericSopNodeFilterTool(kwargs, 'skin', 'loft1', False, False, True, u_selector_only)
There's at least one school like the old school!
  • Quick Links