[Python-ogre-commit] SF.net SVN: python-ogre:[819] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2008-11-26 06:01:37
|
Revision: 819 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=819&view=rev Author: andy_miller Date: 2008-11-26 06:01:27 +0000 (Wed, 26 Nov 2008) Log Message: ----------- Fixed sampleframework to look for platform specific plugin files It still defaults to plugins.cfg howeve rwill fall back to something more useful Modified Paths: -------------- trunk/python-ogre/demos/ogreode/resources.cfg trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py Added Paths: ----------- trunk/python-ogre/demos/plugins.cfg.linux trunk/python-ogre/demos/plugins.cfg.nt Removed Paths: ------------- trunk/python-ogre/demos/plugins.cfg Modified: trunk/python-ogre/demos/ogreode/resources.cfg =================================================================== --- trunk/python-ogre/demos/ogreode/resources.cfg 2008-11-26 04:04:08 UTC (rev 818) +++ trunk/python-ogre/demos/ogreode/resources.cfg 2008-11-26 06:01:27 UTC (rev 819) @@ -11,7 +11,7 @@ FileSystem=../media/materials/scripts FileSystem=../media/materials/textures #FileSystem=../media/models -#FileSystem=../media/overlays +FileSystem=../media/overlays #FileSystem=../media/particle #FileSystem=../media/gui #Zip=../media/packs/cubemap.zip Deleted: trunk/python-ogre/demos/plugins.cfg =================================================================== --- trunk/python-ogre/demos/plugins.cfg 2008-11-26 04:04:08 UTC (rev 818) +++ trunk/python-ogre/demos/plugins.cfg 2008-11-26 06:01:27 UTC (rev 819) @@ -1,19 +0,0 @@ -# Defines plugins to load - -## Use this for Windows -# Define plugin folder -PluginFolder=../../plugins -Plugin=RenderSystem_GL.dll -Plugin=RenderSystem_Direct3D9.dll -Plugin=Plugin_ParticleFX.dll -Plugin=Plugin_BSPSceneManager.dll -Plugin=Plugin_OctreeSceneManager.dll -Plugin=Plugin_CgProgramManager.dll - -## -## NOTE use this for MacOS or Linux -# Plugin=RenderSystem_GL -# Plugin=Plugin_ParticleFX -# Plugin=Plugin_BSPSceneManager -# Plugin=Plugin_OctreeSceneManager -# Plugin=Plugin_CgProgramManager Added: trunk/python-ogre/demos/plugins.cfg.linux =================================================================== --- trunk/python-ogre/demos/plugins.cfg.linux (rev 0) +++ trunk/python-ogre/demos/plugins.cfg.linux 2008-11-26 06:01:27 UTC (rev 819) @@ -0,0 +1,13 @@ +# Defines plugins to load + +## Use this for Windows + + +## +## NOTE use this for MacOS or Linux +PluginFolder=/home/andy/development/root/usr/lib/OGRE +Plugin=RenderSystem_GL +Plugin=Plugin_ParticleFX +Plugin=Plugin_BSPSceneManager +Plugin=Plugin_OctreeSceneManager +Plugin=Plugin_CgProgramManager Added: trunk/python-ogre/demos/plugins.cfg.nt =================================================================== --- trunk/python-ogre/demos/plugins.cfg.nt (rev 0) +++ trunk/python-ogre/demos/plugins.cfg.nt 2008-11-26 06:01:27 UTC (rev 819) @@ -0,0 +1,13 @@ +# Defines plugins to load + +# Define plugin folder +PluginFolder=../../plugins + +# Define D3D rendering implementation plugin +Plugin=RenderSystem_GL.dll +Plugin=RenderSystem_Direct3D9.dll +Plugin=Plugin_ParticleFX.dll +Plugin=Plugin_BSPSceneManager.dll +Plugin=Plugin_OctreeSceneManager.dll +Plugin=Plugin_CgProgramManager.dll + Modified: trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py =================================================================== --- trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py 2008-11-26 04:04:08 UTC (rev 818) +++ trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py 2008-11-26 06:01:27 UTC (rev 819) @@ -22,13 +22,16 @@ ###import OgreRefApp def getPluginPath(): - """Return the absolute path to a valid plugins.cfg file.""" + """ Return the absolute path to a valid plugins.cfg file. + look in the current directory for plugins.cfg followed by plugins.cfg.nt|linux + If not found look one directory up + """ paths = [os.path.join(os.getcwd(), 'plugins.cfg'), + os.path.join(os.getcwd(), 'plugins.cfg.'+os.name), os.path.join(os.getcwd(), '..','plugins.cfg'), - '/etc/OGRE/plugins.cfg', - os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'plugins.cfg')] + os.path.join(os.getcwd(), '..','plugins.cfg.'+os.name), + ] for path in paths: if os.path.exists(path): return path @@ -37,7 +40,7 @@ "** Warning: Unable to locate a suitable plugins.cfg file.\n" "** Warning: Please check your ogre installation and copy a\n" "** Warning: working plugins.cfg file to the current directory.\n\n") - raise ogre.Exception(0, "can't locate the 'plugins.cfg' file", "") + raise ogre.Exception(0, "can't locate a suitable 'plugins' file", "") # def isUnitTest(): # """Looks for a magic file to determine if we want to do a unittest""" @@ -113,18 +116,18 @@ if not self.root.renderOneFrame(): break - - def _setUp(self): """This sets up the ogre application, and returns false if the user hits "cancel" in the dialog box.""" - if self.unittest: - if os.path.isfile('ogre.cfg'): - self.root = ogre.Root(getPluginPath()) - else: - self.root = ogre.Root(getPluginPath(), '../ogre.cfg') + + pluginFile = getPluginPath() ## option here to switch to manually loading file if it doesn't exist + if self.unittest: + if os.path.isfile('ogre.cfg'): + self.root = ogre.Root( pluginFile ) + else: + self.root = ogre.Root( pluginFile, '../ogre.cfg') else: - self.root = ogre.Root(getPluginPath()) + self.root = ogre.Root( pluginFile ) self.root.setFrameSmoothingPeriod (5.0) self._setUpResources() @@ -438,14 +441,17 @@ # return True def frameEnded(self, frameEvent): - self._updateStatistics() + if self.statisticsOn: + self._updateStatistics() return True def showDebugOverlay(self, show): """Turns the debug overlay (frame statistics) on or off.""" overlay = ogre.OverlayManager.getSingleton().getByName('POCore/DebugOverlay') if overlay is None: - raise ogre.Exception(111, "Could not find overlay POCore/DebugOverlay", "SampleFramework.py") + self.statisticsOn = False + ogre.LogManager.getSingleton().logMessage( "ERROR in sf_OIS.py: Could not find overlay POCore/DebugOverlay" ) + return if show: overlay.show() else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |