OMC::OutPort Class Reference

Detailed Description

Represents and provides the methods for a node's out port.

An out port can provide multiple connections to different nodes. These connections are made through the CableList provided by OMC::OutPort::cables. The OutPort must be connected to an InPort of another node. An Outport also maintains the Transformation provided by that port with its transformation( int frame ) method and is useful for transformation-related scripts.

Identify all Out-Ports on a Peg

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
proj = sess.project #Get the active session's currently loaded project.
scene = proj.scene #Get the top scene in the project.
peg = scene.nodes["Top/Peg"] #Find the peg node.
#Identify all Out-Ports on a Peg
ports_out = peg.ports_out #The out-port list for the node.
for idx,port in enumerate(ports_out):
destination_nodes = port.destination_nodes
print( "Port %s :"%(idx) )
for idx2,node in enumerate(destination_nodes):
print( " %s : %s"%(idx2, node.path) )


Connect Some Nodes

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
proj = sess.project #Get the active session's currently loaded project.
scene = proj.scene #Get the top scene in the project.
top = scene.top #The top group.
proj.history.begin( "Test Node Connection" )
peg = top.nodes.create( "PEG", "PEG001" )
read = top.nodes.create( "READ", "DRAWING001" )
#Connect the ports!
peg.ports_out[0].link( read.ports_in[0] )
proj.history.end()


Get the Transformation of a Port

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
proj = sess.project #Get the active session's currently loaded project.
scene = proj.scene #Get the top scene in the project.
peg = scene.nodes["Top/Peg"] #Find the peg node.
#Identify all Out-Ports on a Peg
ports_out = peg.ports_out #The out-port list for the node.
transform = ports_out[0].transformation(1) #The outport can provide a transformation.
print( transform.matrix )

Public Member Functions

virtual OMC::Cablelink (const OMC::InPort *inPort)
 Connect this port to another port.
 
virtual void unlink (const OMC::Cable *cable)
 Disconnects the provided cable object from the port. More...
 
virtual void unlink (const OMC::InPort *port)
 Disconnects this port from the provided port. More...
 
virtual void unlink (const OMC::Node *node)
 Disconnects this port from the provided node. More...
 
OMC::Transformationtransformation (int frame) const
 Gets the transformation that is provided by the outport at the provided frame.
 

Public Attributes

OMC::CableListcables
 Provide the list of cables connected to a port.
 
OMC::CableListcables_flat
 Provide the list of cables connected to a port.
 
OMC::Portdestinations
 Get the destination ports that are connected to this port.
 
OMC::Nodedestination_nodes
 Get the destination nodes that are connected to this port.
 
OMC::Portdestinations_flat
 Get the flat destination ports that are connected to this port.
 
OMC::Nodedestination_nodes_flat
 Get the flat destination nodes that are connected to this port.
 
uint id
 The internal ID of the port.
 
QString type
 The type of the port.
 
uint index
 The index of the port on the node.
 
OMC::Obj node
 The node that owns this port.
 
OMC::Obj node_related
 The node that this port leads to for multiport nodes and groups - the owner node for most node-types, but the the multi-port node for a group, or vice versa.
 
bool inport
 Whether the port is an inport.
 
bool outport
 Whether the port is an outport.
 
OMC::Obj port_related
 The port that this port relates to – itself for most node-types, but the corresponding port on the multi-port node for groups, or vice versa.
 

Member Function Documentation

◆ unlink() [1/3]

virtual void OMC::OutPort::unlink ( const OMC::Cable cable)
virtual

Disconnects the provided cable object from the port.

Returns
True if the cable was properly disconnected.

◆ unlink() [2/3]

virtual void OMC::OutPort::unlink ( const OMC::InPort port)
virtual

Disconnects this port from the provided port.

Returns
True if the cable was properly disconnected.

◆ unlink() [3/3]

virtual void OMC::OutPort::unlink ( const OMC::Node node)
virtual

Disconnects this port from the provided node.

Returns
True if the cable was properly disconnected.
Inheritance diagram for OMC::OutPort:
Collaboration diagram for OMC::OutPort: