mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +00:00
overrode MyGUI::DataManager::isDataExist
Created a override of MyGUI::DataManager::isDataExist to fix a performance issue with MyGUI startup. This required moving the functionality of MyGUI::OgrePlatform into OEngine::GUI::MyGUIManager so that a new version of the MyGUI::DataManager could be created.
This commit is contained in:
parent
fbb59302d9
commit
3c91f7793b
2 changed files with 47 additions and 11 deletions
|
@ -6,6 +6,19 @@
|
||||||
|
|
||||||
using namespace OEngine::GUI;
|
using namespace OEngine::GUI;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* As of MyGUI 3.2.0, MyGUI::OgreDataManager::isDataExist is unnecessarily complex
|
||||||
|
* this override fixes the resulting performance issue.
|
||||||
|
*/
|
||||||
|
class FixedOgreDataManager : public MyGUI::OgreDataManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool isDataExist(const std::string& _name)
|
||||||
|
{
|
||||||
|
return Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup (_name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging, const std::string& logDir)
|
void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging, const std::string& logDir)
|
||||||
{
|
{
|
||||||
assert(wnd);
|
assert(wnd);
|
||||||
|
@ -25,11 +38,18 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
||||||
if(!logDir.empty())
|
if(!logDir.empty())
|
||||||
theLogFile.insert(0, logDir);
|
theLogFile.insert(0, logDir);
|
||||||
|
|
||||||
// Set up OGRE platform. We might make this more generic later.
|
// Set up OGRE platform (bypassing OgrePlatform). We might make this more generic later.
|
||||||
mPlatform = new OgrePlatform();
|
mLogManager = new LogManager();
|
||||||
LogManager::getInstance().setSTDOutputEnabled(logging);
|
mRenderManager = new OgreRenderManager();
|
||||||
mPlatform->initialise(wnd, mgr, "General", theLogFile);
|
mDataManager = new FixedOgreDataManager();
|
||||||
|
|
||||||
|
LogManager::getInstance().setSTDOutputEnabled(logging);
|
||||||
|
|
||||||
|
if (!theLogFile.empty())
|
||||||
|
LogManager::getInstance().createDefaultSource(theLogFile);
|
||||||
|
|
||||||
|
mRenderManager->initialise(wnd, mgr);
|
||||||
|
mDataManager->initialise("General");
|
||||||
|
|
||||||
// Create GUI
|
// Create GUI
|
||||||
mGui = new Gui();
|
mGui = new Gui();
|
||||||
|
@ -40,11 +60,22 @@ void MyGUIManager::shutdown()
|
||||||
{
|
{
|
||||||
mGui->shutdown ();
|
mGui->shutdown ();
|
||||||
delete mGui;
|
delete mGui;
|
||||||
if(mPlatform)
|
if(mRenderManager)
|
||||||
{
|
{
|
||||||
mPlatform->shutdown();
|
mRenderManager->shutdown();
|
||||||
delete mPlatform;
|
delete mRenderManager;
|
||||||
|
mRenderManager = NULL;
|
||||||
|
}
|
||||||
|
if(mDataManager)
|
||||||
|
{
|
||||||
|
mDataManager->shutdown();
|
||||||
|
delete mDataManager;
|
||||||
|
mDataManager = NULL;
|
||||||
|
}
|
||||||
|
if (mLogManager)
|
||||||
|
{
|
||||||
|
delete mLogManager;
|
||||||
|
mLogManager = NULL;
|
||||||
}
|
}
|
||||||
mGui = NULL;
|
mGui = NULL;
|
||||||
mPlatform = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
|
|
||||||
namespace MyGUI
|
namespace MyGUI
|
||||||
{
|
{
|
||||||
class OgrePlatform;
|
|
||||||
class Gui;
|
class Gui;
|
||||||
|
class LogManager;
|
||||||
|
class OgreDataManager;
|
||||||
|
class OgreRenderManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
|
@ -18,12 +20,15 @@ namespace GUI
|
||||||
{
|
{
|
||||||
class MyGUIManager
|
class MyGUIManager
|
||||||
{
|
{
|
||||||
MyGUI::OgrePlatform *mPlatform;
|
|
||||||
MyGUI::Gui *mGui;
|
MyGUI::Gui *mGui;
|
||||||
|
MyGUI::LogManager* mLogManager;
|
||||||
|
MyGUI::OgreDataManager* mDataManager;
|
||||||
|
MyGUI::OgreRenderManager* mRenderManager;
|
||||||
Ogre::SceneManager* mSceneMgr;
|
Ogre::SceneManager* mSceneMgr;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyGUIManager() : mPlatform(NULL), mGui(NULL) {}
|
MyGUIManager() : mLogManager(NULL), mDataManager(NULL), mRenderManager(NULL), mGui(NULL) {}
|
||||||
MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string(""))
|
MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string(""))
|
||||||
{
|
{
|
||||||
setup(wnd,mgr,logging, logDir);
|
setup(wnd,mgr,logging, logDir);
|
||||||
|
|
Loading…
Reference in a new issue