HOM - Connecting nodes input to subnetwork

   5379   9   1
User Avatar
Member
66 posts
Joined: Feb. 2017
Offline
I'm having a hard time trying to do the following things in HOM-

1. Identify that a node inside of a subnet has it's input connected into on of the four indirect connectors of the subnet (all inside the subnet). I tried my hand at using the node.connections() information, but cannot seem to figure out a sure-fire way to have houdini tell me that the node's input I'm querying is connected to the subnet indriect, internal input.

2. Making a connection from a nodes input to one of the four subnet indirect, internal inputs.

In the examples above, it should be assumed that the subnet is not wired into anything external of the subnet. Just internal wiring, waiting for the outside four inputs of the subnet to be connected to take.

Any help, examples or guidance to the specific documentation would be most appreciated. If I didn't give a understandable enough explanation above, let me know and I'll reiterate and add pictures tomorrow.

Thank you,
Clayton
User Avatar
Member
106 posts
Joined: June 2011
Offline
Hi there!

You need to use SubnetIndirectInputs to access them. Please refer here:

http://www.sidefx.com/docs/houdini/hom/hou/SubnetIndirectInput.html [www.sidefx.com]

# Get the subnet node
sub = hou.node("/obj/subnet1")

# Get subnet indirect inputs
sub.indirectInputs()
>> (<hou.SubnetIndirectInput, index=0 at /obj/subnet1>, <hou.SubnetIndirectInput, index=1 at /obj/subnet1>, <hou.SubnetIndirec
tInput, index=2 at /obj/subnet1>, <hou.SubnetIndirectInput, index=3 at /obj/subnet1>)

# Get the geometry node inside the subnet
geo = hou.node("/obj/subnet1/geo1")

# Connect the input of geo node to the first subnet indirect input 
geo.setInput(0, sub.indirectInputs()[0])

# check the output of first internal input
sub.indirectInputs()[0].outputs()
>> (<hou.ObjNode of type geo at /obj/subnet1/geo1>,)

Hope it helps

Cheers
-J
User Avatar
Member
66 posts
Joined: Feb. 2017
Offline
Originally I was trying to work from the subnet internal SOP node's input to query if it was connected to the indirect output of the subnet. Checking from the subnet's indirect output to see if it's connected to any internal SOP seems to work out well. Thank you for taking the time to reply. One of those silly things to get stuck on, so I'm happy you dropped a line.


Cheers,
Clayton
User Avatar
Member
66 posts
Joined: Feb. 2017
Offline
Just to add to to this for anyone learning this down the road -

To query if a node's input is connected to a subnet's indirectInput, you can return the item and check the network item type-

sub = hou.node("/obj/subnet1")
null = hou.node("/obj/subnet1/null1")
 
# grabbing the first input connection of the null - Should only be one input connection since null has only one input
con = null.inputConnections()[0]

# return input item type name
con.inputItem().networkItemType().name()

>>>SubnetIndrectInput
User Avatar
Member
4 posts
Joined: Oct. 2021
Offline
Does anyone know how to do this in HAPI? Create a subnetwork and then connect the children to a subnetwork input? I've tried a few things but no luck.
User Avatar
Member
311 posts
Joined: Oct. 2016
Offline
Sorry I do not understand exactly what you want to accomplish. Anyway, you can use the built in documentation. Basically like this.

Subnet

Add a null to the output of the subnet

However, if you know how the network should look it is easier to build it manually then export the nodes.
Edited by SWest - Aug. 4, 2023 16:17:24

Attachments:
output.gif (4.3 MB)
output_null.gif (4.3 MB)

Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
User Avatar
Member
4 posts
Joined: Oct. 2021
Offline
Create something like this, but with only HAPI calls (I'm using c++). I have tried different ways of using ConnectNodeInput. I'm not sure that hapi exposes the concept of SubNetworkIndirect inputs.

Attachments:
houdini_subnetwork_input.PNG (19.6 KB)

User Avatar
Member
311 posts
Joined: Oct. 2016
Offline
Okay, seems cool with C++. Do you need to compile for several platforms or just target one?

Anyway I think emulating manual things that can be done with the UI is suitable to do with the built in HOM. It is a pleasure to use 90% of cases (automation especially)

If something become too complicated usually the technique or method should be replaced.

Anyway, this is beyond my knowledge about Houdini.

Cheers!
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
User Avatar
Member
122 posts
Joined: June 2019
Offline
matthew.p.albert
Create something like this, but with only HAPI calls (I'm using c++). I have tried different ways of using ConnectNodeInput. I'm not sure that hapi exposes the concept of SubNetworkIndirect inputs.

yeah, I think hapi wasn't designed to author complex networks. it's not the main use case

it's not unusual actually for hapi to expose inputs as Object Merge nodes so you can do the same inside your subnetwork. basically create Object Merge and instead making a connection just set the path on Object Merge

Another workaround is probably to create your own subnet as hda with editable subnet and this configuration:



with this HAPI_ComposeChildNodeList() should return nulls that you can use for connections
it's basically explicit emulation of indirect inputs

Attachments:
subnethda.png (38.5 KB)

User Avatar
Member
4 posts
Joined: Oct. 2021
Offline
Ah this gives me some good alternatives. Thanks so much!
  • Quick Links