Example #1
0
NodeGadget *GraphGadget::addNodeGadget( Gaffer::Node *node )
{	
	NodeGadgetPtr nodeGadget = NodeGadget::create( node );
	if( !nodeGadget )
	{
		return NULL;
	}
	
	addChild( nodeGadget );
	
	NodeGadgetEntry nodeGadgetEntry;
	nodeGadgetEntry.inputChangedConnection = node->plugInputChangedSignal().connect( boost::bind( &GraphGadget::inputChanged, this, ::_1 ) );
	nodeGadgetEntry.plugSetConnection = node->plugSetSignal().connect( boost::bind( &GraphGadget::plugSet, this, ::_1 ) );	
	nodeGadgetEntry.gadget = nodeGadget.get();
	
	m_nodeGadgets[node] = nodeGadgetEntry;
	
	// place it if it's not placed already.	
	if( !node->getChild<Gaffer::V2fPlug>( "__uiPosition" ) )
	{
		m_layout->positionNode( this, node );
	}
	
	updateNodeGadgetTransform( nodeGadget.get() );
	
	return nodeGadget;
}
Example #2
0
NodeGadget *GraphGadget::addNodeGadget( Gaffer::Node *node )
{
	NodeGadgetPtr nodeGadget = NodeGadget::create( node );
	if( !nodeGadget )
	{
		return NULL;
	}

	addChild( nodeGadget );

	NodeGadgetEntry &nodeGadgetEntry = m_nodeGadgets[node];
	nodeGadgetEntry.inputChangedConnection = node->plugInputChangedSignal().connect( boost::bind( &GraphGadget::inputChanged, this, ::_1 ) );
	nodeGadgetEntry.plugSetConnection = node->plugSetSignal().connect( boost::bind( &GraphGadget::plugSet, this, ::_1 ) );
	nodeGadgetEntry.gadget = nodeGadget.get();

	// highlight to reflect selection status
	if( m_scriptNode && m_scriptNode->selection()->contains( node ) )
	{
		nodeGadget->setHighlighted( true );
	}

	// place it if it's not placed already.
	if( !node->getChild<Gaffer::V2fPlug>( g_positionPlugName ) )
	{
		setNodePosition( node, V2f( 0 ) );
	}

	updateNodeGadgetTransform( nodeGadget.get() );

	return nodeGadget.get();
}