Exemplo n.º 1
0
Expression::EnginePtr Expression::Engine::create( const std::string engineType, const std::string &expression )
{
	const CreatorMap &m = creators();
	CreatorMap::const_iterator it = m.find( engineType );
	if( it == m.end() )
	{
		return 0;
	}
	return it->second( expression );
}
Exemplo n.º 2
0
Renderer::Ptr Renderer::create( const IECore::InternedString &type, RenderType renderType, const std::string &fileName )
{
	const CreatorMap &c = creators();
	CreatorMap::const_iterator it = c.find( type );
	if( it == c.end() )
	{
		return nullptr;
	}
	return it->second( renderType, fileName );
}
Exemplo n.º 3
0
NodeGadgetPtr NodeGadget::create( Gaffer::NodePtr node )
{
    const CreatorMap &cr = creators();

    IECore::TypeId typeId = node->typeId();
    while( typeId != IECore::InvalidTypeId )
    {
        const CreatorMap::const_iterator it = cr.find( typeId );
        if( it != cr.end() )
        {
            return it->second( node );
        }
        typeId = IECore::RunTimeTyped::baseTypeId( typeId );
    }

    return NULL;
}
Exemplo n.º 4
0
NodulePtr Nodule::create( Gaffer::PlugPtr plug )
{
	if( !plug->getFlags( Gaffer::Plug::AcceptsInputs ) )
	{
		return 0;
	}

	Gaffer::ConstNodePtr node = plug->node();
	if( node )
	{
		std::string plugPath = plug->relativeName( node );
		const NamedCreatorMap &m = namedCreators();
		IECore::TypeId t = node->typeId();
		while( t!=IECore::InvalidTypeId )
		{
			NamedCreatorMap::const_iterator it = m.find( t );
			if( it!=m.end() )
			{
				for( RegexAndCreatorVector::const_reverse_iterator nIt = it->second.rbegin(); nIt!=it->second.rend(); nIt++ )
				{
					if( boost::regex_match( plugPath, nIt->first ) )
					{
						return nIt->second( plug );
					}
				}
			}
			t = IECore::RunTimeTyped::baseTypeId( t );
		}
	}
	
	CreatorMap &m = creators();
	IECore::TypeId t = plug->typeId();
	while( t!=IECore::InvalidTypeId )
	{
		CreatorMap::const_iterator it = m.find( t );
		if( it!=m.end() )
		{
			return it->second( plug );
		}
		t = IECore::RunTimeTyped::baseTypeId( t );
	}
	
	return 0;
}
Exemplo n.º 5
0
ConnectionGadgetPtr ConnectionGadget::create( NodulePtr srcNodule, NodulePtr dstNodule )
{
	const Gaffer::Plug *plug = dstNodule->plug();

	if( const Gaffer::Node *node = plug->node() )
	{
		std::string plugPath = plug->relativeName( node );
		const NamedCreatorMap &m = namedCreators();
		IECore::TypeId t = node->typeId();
		while( t!=IECore::InvalidTypeId )
		{
			NamedCreatorMap::const_iterator it = m.find( t );
			if( it!=m.end() )
			{
				for( RegexAndCreatorVector::const_reverse_iterator nIt = it->second.rbegin(); nIt!=it->second.rend(); nIt++ )
				{
					if( boost::regex_match( plugPath, nIt->first ) )
					{
						return nIt->second( srcNodule, dstNodule );
					}
				}
			}
			t = IECore::RunTimeTyped::baseTypeId( t );
		}
	}

	CreatorMap &m = creators();
	IECore::TypeId t = plug->typeId();
	while( t!=IECore::InvalidTypeId )
	{
		CreatorMap::const_iterator it = m.find( t );
		if( it!=m.end() )
		{
			return it->second( srcNodule, dstNodule );
		}
		t = IECore::RunTimeTyped::baseTypeId( t );
	}

	return NULL;
}