Example #1
0
void Node::disconnect( const NodeRef &output )
{
	if( ! output )
		return;

	for( auto weakOutIt = mOutputs.begin(); weakOutIt != mOutputs.end(); ++weakOutIt ) {
		if( weakOutIt->lock() == output ) {
			mOutputs.erase( weakOutIt );
			break;
		}
	}

	output->disconnectInput( shared_from_this() );
	output->notifyConnectionsDidChange();
}
Example #2
0
void Node::connect( const NodeRef &output )
{
	// make a reference to ourselves so that we aren't deallocated in the case of the last owner
	// disconnecting us, which we may need later anyway
	NodeRef thisRef = shared_from_this();

	if( ! output || ! output->canConnectToInput( thisRef ) )
		return;

	if( checkCycle( thisRef, output ) )
		throw NodeCycleExc( thisRef, output );

	mOutputs.push_back( output ); // set output first, so that it is visible in configureConnections()
	output->connectInput( thisRef );

	output->notifyConnectionsDidChange();
}