On this page | |
Inheritence |
|
Overview
You can get a list of NodeConnection
objects from a hou.Node instance
using hou.Node.inputConnections() and hou.Node.outputConnections().
Note
It is probably easier to use the hou.Node..inputs and hou.Node.outputs() methods (which return the endpoints of a node’s connections) to traverse the network, rather than dealing with the connections themselves.
This object is "read-only". To create or edit connections, use methods on the node, such as hou.Node.setNamedInput(), hou.Node.setInput(), hou.Node.setFirstInput(), hou.Node.setNextInput(), hou.Node.createInputNode(), and hou.Node.createOutputNode().
Input and Output meaning
The hou.NodeConnection.outputNode() and hou.NodeConnection.inputNode() are named in relation to the nodes, not the "input" and "output" ends of the connector.
So, outputNode()
returns the node whose output is this connector.
In the diagram, outputNode()
on the highlighted connection would return
node "A". inputNode()
returns the node whose input
is this connector.
In the diagram, inputNode()
on the highlighted connection would return
node "C".
Connection indexes
Some nodes have multiple inputs and/or multiple outputs. For example, most VOPs have several inputs and outputs. The Split DOP has multiple outputs.
A node with a multi-input, such as the Merge SOP, has multiple "inputs" for each connection, even though in the network editor it is drawn with one "connection point" at the top.
Inputs and outputs are always addressed by their position (index).
Methods
outputNode()
→ hou.Node
Return the node on the output side of this connection. This is the node that the connection goes to, in the direction of data flow. If this connection has a network dot as its output, this method returns None.
outputItem()
→ hou.NetworkMovableItem
Return the node or network dot on the output side of this connection. This is the node or dot that the connection goes to, in the direction of data flow. This method should never return None.
inputNode()
→ hou.Node
Return the node on the input side of this connection. This is the node
that the connection comes from, in the direction of data flow. If this
connection goes through an indirect input, this will return the node
connected to the parent node (or None
if nothing is connected).
outputIndex()
→ int
Returns the index of the output connection on the node that the input
side of this connections connects to. If this connection goes through an
indirect input, this will return the index of the output connected to the
parent node (or 0
if nothing is connected).
inputIndex()
→ int
Returns the index of the input connection on the node that the output side of this connections connects to.
outputName()
→ str
Returns the name of the output connection on the node that the input side of this connections connects to.
outputLabel()
→ str
Returns the label of the output connection on the node that the input side of this connections connects to.
outputDataType()
→ str
Returns the data type of the output connection on the node that the input side of this connections connects to.
This method only applies to VOP node connections. Raises hou.OperationFailed if invoked on a non VOP node connection.
The string returned by this method can be used to set the Type parameter on a Parameter or Constant VOP.
inputName()
→ str
Returns the name of the input connection on the node that the output side of this connections connects to.
inputLabel()
→ str
Returns the label of the input connection on the node that the output side of this connections connects to.
inputDataType()
→ str
Returns the data type of the input connection on the node that the output side of this connections connects to.
This method only applies to VOP node connections. Raises hou.OperationFailed if invoked on a non VOP node connection.
The string returned by this method can be used to set the Type parameter on a Parameter or Constant VOP.
subnetIndirectInput()
→ hou.SubnetIndirectInput
If this connection has a subnet indirect input connected to it instead of
a node, return the corresponding object. Otherwise, return None
. See
hou.SubnetIndirectInput for information on subnet indirect inputs.
inputItem()
→ hou.NetworkMovableItem
If this connection has a subnet indirect input connected to it,
return the corresponding hou.SubnetIndirectInput object.
If this connection has a node connected to it, return the corresponding
hou.Node object. Otherwise, return None
. This method is
essentially equivalent to the following:
def getInputItem(node_connection): if node_connection.subnetIndirectInput() is not None: return node_connection.subnetIndirectInput() return node_connection.inputNode()
inputItemOutputIndex()
→ int
Returns zero if this connection has a subnet indirect input connected to
it. Otherwise return the index of the output connection on the node that
the input side of this connections connects to. In combination with the
inputItem
method, node and subnet indirect inputs can be processed
through a common code path for many use cases.
isSelected()
→ bool
Return True
if this connection is selected.
setSelected(selected, clear_all_selected = False)
Selects or de-selects this connection. If the clear_all_selected
parameter is set to True
, all other selections (both connections,
and nodes, network boxes, etc.) will be cleared before this connection
is selected.
Methods from hou.NetworkItem
networkItemType()
→ hou.networkItemType
Return an enum value indicating what type of network item is represented
by this object. This value is equivalent to using the isinstance
built in
Python function with the matching class
(for example hou.networkItemType.Connection is equivalent to
hou.NodeConnection).