Connecting Nodes
Simple syntax
The syntax is an extension of an idea introduced in pymel
and allows to write intuitive, easy to read statements.
Connect
Connections can be made using >>
operator
control.spin >> joint.rx
Additionally channels can be connected to multiple outputs at once using <<
operator.
Imagine a node with multiple output connections going outwards that is reflected in the operator shape.
control.twist << [joint1.rx, joint2.rx, joint3.rx]
Disconnect
Connected channels can be disconnected using !=
operator
control.spin != joint.rx
or using <>
operator in Python 2
control.spin <> joint.rx
Alternatively all connections can be broken using the .disconnect() method
control.twist.disconnect()
List connections
Get an input
joint.rx.input()
Get outputs
control.twist.outputs()
Connections method
This is using the nc.listConnections function that operates on the called channel, thus using the same kwargs.
control.twist.connections()
Using nod.cmds
nc.listConnections(control.twist)
Check connection status
There are two ways of checking if two channels are connected.
control.rx >> joint.rx
control.rx.isConnectedTo(joint.rx)
# True
joint.rx.isConnectedTo(control.rx)
# False
control.rx >> joint.rx
control.rx in joint.rx
# True
joint.rx in control.rx
# False