Example #1
0
void ObjectManager::loadFactories(const String& factoriesfile)
{
	String pluginDir;
	Ogre::StringVector pluginList;	
	Ogre::ConfigFile cfg;
	
	try {
		cfg.load( factoriesfile );
	}
	catch (Ogre::Exception)
	{
		Ogre::LogManager::getSingleton().logMessage(factoriesfile + " not found, automatic object factories loading disabled.");
		return;
	}

	pluginDir = cfg.getSetting("ObjectFactoryFolder"); // Ignored on Mac OS X, uses Resources/ directory
	pluginList = cfg.getMultiSetting("ObjectFactory");

	char last_char = pluginDir[pluginDir.length()-1];
	if (last_char != '/' && last_char != '\\')
	{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
		pluginDir += "\\";
#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
		pluginDir += "/";
#endif
	}

	for( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
	{
		this->loadFactory(pluginDir + (*it));
	}

}
Example #2
0
bool OgreSubsystem::LoadOgrePlugins(Ogre::String const & pluginsfile)
{
	Ogre::StringVector pluginList;
	Ogre::String pluginDir;
	Ogre::ConfigFile cfg;

	try
	{
		cfg.load( pluginsfile );
	}
	catch (Ogre::Exception)
	{
		Ogre::LogManager::getSingleton().logMessage(pluginsfile + " not found, automatic plugin loading disabled.");
		return false;
	}

	pluginDir = cfg.getSetting("PluginFolder"); // Ignored on Mac OS X, uses Resources/ directory
	pluginList = cfg.getMultiSetting("Plugin");

#if OGRE_PLATFORM != OGRE_PLATFORM_APPLE && OGRE_PLATFORM != OGRE_PLATFORM_IPHONE
	if (pluginDir.empty())
	{
		// User didn't specify plugins folder, try current one
		pluginDir = ".";
	}
#endif

	char last_char = pluginDir[pluginDir.length()-1];
	if (last_char != '/' && last_char != '\\')
	{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
		pluginDir += "\\";
#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
		pluginDir += "/";
#endif
	}

	for ( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
	{
		Ogre::String pluginFilename = pluginDir + (*it);
		try
		{
			m_ogre_root->loadPlugin(pluginFilename);
		} 
		catch(Ogre::Exception &e)
		{
			LOG("failed to load plugin: " + pluginFilename + ": " + e.getFullDescription());
		}
	}
	return true;
}
Example #3
0
bool OgreSubsystem::LoadOgrePlugins(Ogre::String const & pluginsfile)
{
    Ogre::ConfigFile cfg;

    try
    {
        cfg.load( pluginsfile );
    }
    catch (Ogre::Exception e)
    {
        Ogre::LogManager::getSingleton().logMessage(pluginsfile + " not found, automatic plugin loading disabled. Message: " + e.getFullDescription());
        return false;
    }

    Ogre::String pluginDir = cfg.getSetting("PluginFolder");
    Ogre::StringVector pluginList = cfg.getMultiSetting("Plugin");

    if (pluginDir.empty())
    {
        pluginDir = RoR::App::sys_process_dir.GetActive();
    }

    for ( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
    {
        Ogre::String pluginFilename = pluginDir + PATH_SLASH + (*it);
        try
        {
            m_ogre_root->loadPlugin(pluginFilename);
        }
        catch (Ogre::Exception &e)
        {
            LOG("failed to load plugin: " + pluginFilename + ": " + e.getFullDescription());
        }
    }
    return true;
}