OMC::PortList Class Reference

Detailed Description

A list of ports on a node.

The PortList is provided from a Node – and can either be the InPortList or PortList depending if it is intended for In or Out ports. Certain types of OMC::Node provide a PortList that can have ports added dynamically, and a MultiPortList or MultiInPortList will be provided to support the dynamic addition and removal of these ports. The port lists are iterable, provide a size and can be accessed with the list[] operator.
The generic PortList – see also OMC::InPortList, OMC::MultiPortList, and OMC::MultiInPortList. Also see OMC::Node::ports_in and OMC::Node::ports_out.

Identify all In Ports on a Node

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 In-Ports on a Peg
ports_in = peg.ports_in #The in-port list for the node.
for idx,port in enumerate(ports_in):
connection = "NONE"
if port.source_node: #Check if this port is connected to anything.
connection = port.source_node.path
print( "Port %s : %s"%(idx, connection) )


Identify all Out-Ports on a Node

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) )


Public Member Functions

virtual std::vector< OMC::Port * > list () const override
 Converts the dynamic list into a concrete list of Port objects.
 

Public Attributes

OMC::Portoperator[int idx]
 Provides the Port at the given index.
 
bool dynamic
 Identifies if ports can be created on this portlist and the node.
 
Inheritance diagram for OMC::PortList:
Collaboration diagram for OMC::PortList: