Connect Subnet 1 output to Subnet 2 input using parmname

   759   3   1
User Avatar
Member
63 posts
Joined: Jan. 2016
Offline
Hey all,
Is there a way to do this in python?
Trying to script some connections between subnets. The only way I'm currently able to connect inputs and outputs is via index. This isnt ideal -- it doesn't allow for any name based connection logic. Example, subnet connector output "color" inside subnet mat_1 is defined as 'color' in the parmname. The mat_1 subnet shows this visually as 'color', but I can only connect to this by its index, in this case 0.
Is there a way to drive connections by this parmname itself, or at least determine which index is connected to which internal output?

thank you!

Attachments:
Nodes.png (18.3 KB)

User Avatar
Member
243 posts
Joined: May 2017
Offline
Hi

try setNameInput [www.sidefx.com]:
subnet1 = hou.node('/obj/geo1/pointvop1/subnet1')
subnet2 = hou.node('/obj/geo1/pointvop1/subnet2')
subnet2.setNamedInput('mat_1_color', subnet1, 'color')
User Avatar
Member
63 posts
Joined: Jan. 2016
Offline
little bit of help from chatgpt got it sorted
the indexing is dynamic but an enumerate query fill correctly return the index value connected to each parameter. If the output is color for example as index 0 and then you delete this, specular which was 1 now becomes 0 and roughness which was 2 now becomes 1. add color back and it becomes index 3. the enumerate will successfully monitor these changes.
cheers.
User Avatar
Member
63 posts
Joined: Jan. 2016
Offline
vikus
Hi

try setNameInput [www.sidefx.com]:
subnet1 = hou.node('/obj/geo1/pointvop1/subnet1')
subnet2 = hou.node('/obj/geo1/pointvop1/subnet2')
subnet2.setNamedInput('mat_1_color', subnet1, 'color')
Thank you Vikus!!!!
  • Quick Links