Connector Class

From TouchDesigner 099 Wiki

The Connector class describes the input or output connection point of an operator. There are two types of connections: those between Components, and those between regular operators. Connections between regular operators can be accessed through the OP.inputConnectors and OP.outputConnectors members. Connections between components can be accessed through the COMP.inputCOMPConnectors and COMP.outputCOMPConnectors members.


Members

index (Read Only) The numeric index of this connector.
isInput (Read Only) True when the connector is an input.
isOutput (Read Only) True when the connector is an output.
inOP (Read Only) Will return any input operators (e.g. inSOP, inCHOP) associated with this connector. This only applies to regular operator connections attached to components.
outOP (Read Only) Will return any output operators (e.g. outSOP, outCHOP) associated with this connector. This only applies to regular operator connections attached to components.
owner (Read Only) The OP to which this object belongs.
connections (Read Only) The list of connector objects connected to this object.



Methods

connect(target)

Wire this connector to a target location. The target may be an operator or another connector.
When the connector is an input, its connection is replaced with the target.
When the connector is an output, a new connection is appended to the target.
  • target - The OP or connector you want to connect to.
   #connect noise1 to lag1
   op('noise1').outputConnectors[0].connect(op('lag1'))
   #connect chop_to_top1 to 2nd input of displace
   op('chop_to_top').outputConnectors[0].connect( op('displace').inputConnectors[1] )
   #connect geo1 to geo2, two equivalent methods:
   op('geo1').outputCOMPConnectors[0].connect(op('geo2'))
   op('geo2').inputCOMPConnectors[0].connect(op('geo1')) 


disconnect()

Disconnect this connector.
   op('lag1').inputConnectors[0].disconnect()
   op('lag1').outputConnectors[0].disconnect()
   #disconnect geo2 from geo1, two equivalent methods
   op('geo1').outputCOMPConnectors[0].disconnect()
   op('geo2').inputCOMPConnectors[0].disconnect()