def _load_ogre_plugins(self, config): """ This loads the plugins Ogre needs to run based on the config file. An example:: Plugins: # Where to search for the plugins search_path: [ C:\Libraries\Python-Ogre-0.7\plugins, C:\Developement\Python-Ogre\Python-Ogre-0.7\plugins] # The plugins to load plugins: [ RenderSystem_GL, Plugin_ParticleFX, Plugin_OctreeSceneManager ] """ import platform plugins = config.get('plugins', defaults.ogre_plugins) if 'Darwin' == platform.system(): for plugin in plugins: self._ogre_root.loadPlugin(plugin) else: # Filter out non-existant paths from search, this keeps windows # paths out of unix and unix paths out of windows search_path = config.get('search_path', defaults.ogre_plugin_search_path) # Run Environment varialbe replacement search_path = \ [os.path.normpath(environmentSub(p)) for p in search_path] search_path = [p for p in search_path if os.path.exists(p)] if len(search_path) == 0: raise GraphicsError('All plugin directories do not exist') #self.logger.info('Loadings Ogre Plugins on path:') #for path in search_path: # self.logger.info('\t%s' % path ) extension = '.so' if 'nt' == os.name: extension = '.dll' for plugin in plugins: plugin_name = plugin + extension #self.logger.info('\tSearching for: %s' % plugin_name) found = False for dir in search_path: plugin_path = os.path.join(dir, plugin_name) # Only the plugin once if not found and os.path.exists(plugin_path): self._ogre_root.loadPlugin(plugin_path) found = True if not found: raise GraphicsError('Could not load plugin: %s' % plugin_name)
def create_all_scenes(self): """ This load all scenes present in the config file. """ scene_path = self._config.get('scene_path', defaults.scene_search_path) # Interpolate scene path scene_path = [os.path.normpath(environmentSub(p)) for p in scene_path] for name, scene_file in self._config.get('Scenes', {}).iteritems(): self.create_scene(name, scene_file, scene_path)