Exemplo n.º 1
0
void StandardNodule::connection( const DragDropEvent &event, Gaffer::PlugPtr &input, Gaffer::PlugPtr &output )
{
	Gaffer::PlugPtr dropPlug = IECore::runTimeCast<Gaffer::Plug>( event.data );
	if( dropPlug )
	{
		Gaffer::PlugPtr thisPlug = plug();
		if( thisPlug->node() != dropPlug->node() && thisPlug->direction()!=dropPlug->direction() )
		{
			if( thisPlug->direction()==Gaffer::Plug::In )
			{
				input = thisPlug;
				output = dropPlug;
			}
			else
			{
				input = dropPlug;
				output = thisPlug;
			}

			if( input->acceptsInput( output.get() ) )
			{
				// success
				return;
			}
		}
	}

	input = output = 0;
	return;
}
Exemplo n.º 2
0
NodulePtr StandardNodeGadget::addNodule( Gaffer::PlugPtr plug )
{
	if( plug->getName().string().compare( 0, 2, "__" )==0 )
	{
		return 0;
	}
	
	NodulePtr nodule = Nodule::create( plug );
	if( !nodule )
	{
		return 0;
	}
	
	if( plug->direction()==Gaffer::Plug::In )
	{
		inputNoduleContainer()->addChild( nodule );
	}
	else
	{
		outputNoduleContainer()->addChild( nodule );
	}
	
	m_nodules[plug.get()] = nodule.get();
	
	return nodule;
}