MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ initialize()

void MayaFlux::Nodes::ChainNode::initialize ( )

Initializes the chain node.

If a manager was provided at construction, registers this chain and applies chain semantics (REPLACE_TARGET, ONLY_CHAIN, PRESERVE_BOTH). Without a manager, only sets internal initialization flag.

Definition at line 75 of file NodeChain.cpp.

76{
77 if (!m_is_initialized) {
78 if (m_manager) {
79 auto& last = m_nodes.back();
80 if (last) {
81 for (auto& channel : get_active_channels(last, 0)) {
82 m_manager->add_to_root(shared_from_this(), m_token, channel);
83 }
84 } else {
85 m_manager->add_to_root(shared_from_this(), m_token, 0);
86 }
87 }
88 m_is_initialized = true;
89 }
90
91 if (m_manager) {
92 auto semantics = m_manager->get_node_config().chain_semantics;
93 switch (semantics) {
95 auto& last = m_nodes.back();
96 if (last) {
97 for (auto& channel : get_active_channels(last, 0)) {
98 m_manager->remove_from_root(last, m_token, channel);
99 }
100 }
101 break;
102 }
104 for (auto& node : m_nodes) {
105 if (node) {
106 for (auto& channel : get_active_channels(node, 0)) {
107 m_manager->remove_from_root(node, m_token, channel);
108 }
109 }
110 }
111 break;
113 default:
114 break;
115 }
116 }
117}
std::vector< std::shared_ptr< Node > > m_nodes
NodeGraphManager * m_manager
void add_to_root(const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0)
Add node to specific processing token and channel.
void remove_from_root(const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0)
Remove node from a specific processing token and channel.
NodeConfig & get_node_config()
Gets the current node configuration.
std::vector< uint32_t > get_active_channels(const std::shared_ptr< Nodes::Node > &node, uint32_t fallback_channel)
Extracts active channel list from a node's channel mask.
@ PRESERVE_BOTH
Preserve both nodes in the chain, add new chain node to root, i.e doubling the target signal.
Definition NodeSpec.hpp:13
@ ONLY_CHAIN
Only keep the new chain node, unregistering the source and target.
Definition NodeSpec.hpp:14
@ REPLACE_TARGET
Unregister the target and register with the new chain node.
Definition NodeSpec.hpp:12
NodeChainSemantics chain_semantics
Definition NodeSpec.hpp:35

References MayaFlux::Nodes::NodeGraphManager::add_to_root(), MayaFlux::Nodes::NodeConfig::chain_semantics, MayaFlux::Nodes::get_active_channels(), MayaFlux::Nodes::NodeGraphManager::get_node_config(), m_is_initialized, m_manager, m_nodes, m_token, MayaFlux::Nodes::ONLY_CHAIN, MayaFlux::Nodes::PRESERVE_BOTH, MayaFlux::Nodes::NodeGraphManager::remove_from_root(), and MayaFlux::Nodes::REPLACE_TARGET.

Referenced by process_sample().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: