OMH::SelectionNodeList Class Reference

Detailed Description

Provides the selected nodes.

Public Member Functions

OMC::node * operator[] (int idx) const
 Returns a string that represents the flavor of the application. e.g. Harmony.
 
bool contains (OMC::Node *) const
 Identifies if the list contains the node (or subnode).
 
virtual std::vector< OMC::Node * > list () const override
 Converts the dynamic list into a concrete list of node objects.
 
virtual OMC::Nodeoperator() (const QVariant &searchString) const
 Search for a node in the selection with a specialized search object. More...
 
virtual OMC::Nodefind (const QVariant &searchString) const
 Search for a node in the selection with a specialized search object. More...
 
virtual void add (const QVariant &node)
 Add a node to the selection. More...
 
virtual void remove (const QVariant &node)
 Remove a node from the selection. More...
 
void select_all ()
 Selects all nodes in the scene.
 
void select_none ()
 Removes all nodes from the selection.
 

Member Function Documentation

◆ add()

virtual void OMH::SelectionNodeList::add ( const QVariant &  node)
virtual

Add a node to the selection.

Returns
True if successfully added to the selection.

◆ find()

virtual OMC::Node* OMH::SelectionNodeList::find ( const QVariant &  searchString) const
virtual

Search for a node in the selection with a specialized search object.

See OMH::SelectionNodeList::operator()(const QVariant& searchString)

◆ operator()()

virtual OMC::Node* OMH::SelectionNodeList::operator() ( const QVariant &  searchString) const
virtual

Search for a node in the selection with a specialized search object.

Using the same approach as the OMC::NodeList::find, uses a custom object to find nodes within the selection.

Using a custom search object in form:

{
"name" : "NameOfNode" # or ["PotentialNameOfNode", "PotentialNameOfNode"],
"path" : "PathOfNode" # or ["PotentialPathOfNode", "PotentialPathOfNode"],
"type" : "TypeOfNode" # or ["PotentialTypeOfNode", "PotentialTypeOfNode"],
}

Each property in the map is optional. Providing a specific property will search the node list for nodes that match that property.
The matching type can be a string type, or a regular expression and can be provided as a list of potential matches.
Finding all Pegs:

from ToonBoom import harmony
sess = harmony.session()
scn = sess.project.scene
nodes = scn.nodes
#Find all nodes named "Drawing-P"
nodes.find( {"name":"Drawing-P"})
#Find all nodes of type "Peg"
nodes.find( {"type":"PEG"})
#Find all nodes that are one group deep
nodes.find( {"path":"^Top/.+?/.*$"} )
#Find all pegs that are one group deep
nodes.find( {"path":"^Top/.+?/.*$", "type":"PEG"} )
#Find all READ and PEG nodes
nodes.find( { "type" : ["READ", "PEG"] } )
#Find all nodes that end with _TEXTURE, case insensitive
from PySide6 import QtCore
nodes.find( { "name" : QtCore.QRegularExpression("^.+_TEXTURE$", QtCore.QRegularExpression.CaseInsensitiveOption) } )
Returns
The node(s) found based on the provided search object.

◆ remove()

virtual void OMH::SelectionNodeList::remove ( const QVariant &  node)
virtual

Remove a node from the selection.

Returns
True if successfully removed from the selection.
Inheritance diagram for OMH::SelectionNodeList:
Collaboration diagram for OMH::SelectionNodeList: