Esempio n. 1
0
Nodule *NoduleLayout::nodule( const Gaffer::Plug *plug )
{
	const GraphComponent *plugParent = plug->parent<GraphComponent>();
	if( !plugParent )
	{
		return NULL;
	}

	if( plugParent == m_parent.get() )
	{
		GadgetMap::iterator it = m_gadgets.find( plug );
		if( it != m_gadgets.end() )
		{
			// Cast is safe because we only ever store nodules
			// for plug keys.
			return static_cast<Nodule *>( it->second.gadget.get() );
		}
		return NULL;
	}
	else if( const Plug *parentPlug = IECore::runTimeCast<const Plug>( plugParent ) )
	{
		CompoundNodule *compoundNodule = IECore::runTimeCast<CompoundNodule>( nodule( parentPlug ) );
		if( compoundNodule )
		{
			return compoundNodule->nodule( plug );
		}
	}
	return NULL;
}
Esempio n. 2
0
Nodule *StandardNodeGadget::nodule( const Gaffer::Plug *plug )
{	
	const GraphComponent *parent = plug->parent<GraphComponent>();
	if( !parent || parent == node() )
	{
		NoduleMap::iterator it = m_nodules.find( plug );
		if( it != m_nodules.end() )
		{
			return it->second;
		}
		return 0;
	}
	else if( const Plug *parentPlug = IECore::runTimeCast<const Plug>( parent ) )
	{
		CompoundNodule *compoundNodule = IECore::runTimeCast<CompoundNodule>( nodule( parentPlug ) );
		if( compoundNodule )
		{
			return compoundNodule->nodule( plug );
		}
	}
	return 0;
}