OMC::Cable Class Reference

Detailed Description

Represents and provides the methods for a cable connecting nodes in the node view.

The cable is the representation of a connection between Ports on a Node, and is useful for tracing the connection between nodes.

Follow a Cable

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.
#We'll simply follow this peg's connection downwards via the first available connection to the 0th port.
#Using a method so that it can be called for each node that is followed.
def recursive_cable_follower( node ):
print( "Following : %s "%(node.path) )
try:
port = node.ports_out[0]
cable = port.cables[0] #Use the first attached cable to this port.
next_node = cable.destination_node #Where does this cable connect to next?
recursive_cable_follower( next_node ) #Follow the next node. . .
except:
print( "Failed to continue -- is there any valid connection?" )
recursive_cable_follower( peg )

Public Member Functions

OMC::Cable * insert (const OMC::Node *node, const OMC::inPort *inPort, const OMC::outPort *outPort)
 Insert a node in between the currently connected nodes by this cable.
 
void unlink ()
 Disconnect the cable.
 

Public Attributes

OutPort * source
 Get and set the source port from which this cable is connected.
 
Node * source_node
 Get and set the source node from which this cable is connected.
 
InPort * destination
 Get and set the destination port to which this cable is connected.
 
Node * destination_node
 Get the destination node to which this cable is connected.
 
Node * source_flat_node
 Get the node from which this cable is connected, ignoring all waypoints, groups and multiports.
 
OMC::Port * source_flat
 Get the node from which this cable is connected, ignoring all waypoints, groups and multiports.
 
Inheritance diagram for OMC::Cable:
Collaboration diagram for OMC::Cable: