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

◆ initialize()

void MayaFlux::Nodes::BinaryOpNode::initialize ( )

Initializes the binary operation node.

This method performs any necessary setup for the binary operation node, such as ensuring both input nodes are properly initialized and registered. It should be called before the node is used for processing to ensure correct operation.

Definition at line 63 of file NodeCombine.cpp.

64{
65 if (!m_is_initialized) {
66
67 if (m_manager) {
68 auto self = shared_from_this();
69 uint32_t lhs_mask = m_lhs ? m_lhs->get_channel_mask().load() : 0;
70 uint32_t rhs_mask = m_rhs ? m_rhs->get_channel_mask().load() : 0;
71 uint32_t combined_mask = lhs_mask | rhs_mask;
72
73 if (combined_mask != 0) {
74 for (auto& channel : get_active_channels(combined_mask, 0)) {
75 m_manager->add_to_root(self, m_token, channel);
76 }
77 } else {
78 m_manager->add_to_root(self, m_token, 0);
79 }
80 m_is_initialized = true;
81 }
82 }
83
84 if (m_manager) {
86 switch (semantics) {
88 if (m_lhs) {
89 for (auto& channel : get_active_channels(m_lhs, 0)) {
91 }
92 }
93 if (m_rhs) {
94 for (auto& channel : get_active_channels(m_rhs, 0)) {
96 }
97 }
98 break;
100 default:
101 break;
102 }
103 }
104}
bool m_is_initialized
Flag indicating whether the binary operator has been properly initialized.
ProcessingToken m_token
The processing token indicating the domain in which this node operates.
NodeGraphManager * m_manager
Reference to the node graph manager for registration and callback management.
std::shared_ptr< Node > m_lhs
The left-hand side node.
std::shared_ptr< Node > m_rhs
The right-hand side node.
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.
@ KEEP
Preserve both nodes in the binary op, add new binary op node to root, i.e doubling the signal.
Definition NodeSpec.hpp:23
@ REPLACE
Unregister both nodes and register with the new binary op node.
Definition NodeSpec.hpp:22
NodeBinaryOpSemantics binary_op_semantics
Definition NodeSpec.hpp:36

References MayaFlux::Nodes::NodeGraphManager::add_to_root(), MayaFlux::Nodes::NodeConfig::binary_op_semantics, MayaFlux::Nodes::get_active_channels(), MayaFlux::Nodes::NodeGraphManager::get_node_config(), MayaFlux::Nodes::KEEP, m_is_initialized, m_lhs, m_manager, m_rhs, m_token, MayaFlux::Nodes::NodeGraphManager::remove_from_root(), and MayaFlux::Nodes::REPLACE.

Referenced by process_sample().

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