hom node set output?

   4143   3   1
User Avatar
Member
120 posts
Joined: Feb. 2008
Offline
Hi, I'd like to disconnect the outputs of some selected nodes… but I can't find a hou.Node.setoutput … there's only setinput.

so is the only way to find the node that it is connected to, then run a setinput(None) on that other node's input?
User Avatar
Member
1909 posts
Joined: Nov. 2006
Offline
Take a look at hou.Node.outputConnections(). This returns node connection objects that you can get the input and output nodes, as well as input indices, and thus set your connected nodes input to None.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
1909 posts
Joined: Nov. 2006
Offline
For completeness sake, here's the code to do it:
connections = mynode.outputConnections()

for connection in connections:
output_node = connection.outputNode()
index = connection.inputIndex()
output_node.setInput(index, None)
Depending on exactly what your circumstances are, you could also just call hou.Node.outputs() to get all the nodes connected to the output and then just blindly clear all their inputs or delete them or whatever else. The above code merely just ensures you are only disconnecting the particular input that is connected to the node.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
120 posts
Joined: Feb. 2008
Offline
Thanks, this is really helpful!
  • Quick Links