LayoutManager not initialized and MyGUI can't find the image

Alekiel

27-04-2010 19:11:56

Hello. I've got 2 problems; 1 that is only presenting in Windows and the other than is presenting in both, Windows and Linux.

Problem 1: MyGUI crashes when trying to load a .layout. Upon checking the log, it says something along the lines (Sorry, I don't have the log in hand right now; I'll post it tonight) "Critical | LayoutManager was not initialized". But when you look at the log, the message "Core | LayoutManager successfully initialized".

Any ideas of that this is? The code that crashes on Windows because of this works just fine in Linux (although the GUI is not shown, I assume because of issue #2).

Problem 2: This one is showing up on both OSes and its about resources. When I tried to load a layout in Linux, it seemingly worked but the GUI never showed up. Upon checking the log, I found these lines:

| Core | Error | Texture 'core_micro_font.PNG' not found |
| Platform | Error | Texture 'core_micro_font.PNG' not found, set default texture |
| Core | Error | Texture 'core.png' not found |
| Core | Error | Texture 'core_pointer.png' not found |


However, all these images are kept in an already initialized ResourceGroup in media/gui. It also seems to find the .xml files just fine. I saw this thread (viewtopic.php?f=17&t=12094) which seemed to have the same issue, and a solution but upon seeing the code, I am already doing something similar for the whole resource initialization.

Any ideas?

Altren

27-04-2010 20:23:57

Well, second issue is clear:

Check that MyGUI_Media folder in default resource group General
For loading MyGUI from another resource group write this
mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mWindow, mSceneManager, "MyResourceGroupName");

Alekiel

28-04-2010 04:00:01

Hello, I am back.

Thanks Altren, that worked perfectly as far as the issue of not finding the images go. However, I am still having issue number 1, the layout I am loading doesn't seem to be rendering. Is there anything in particular I need to do after starting up the GUI+Platform and loading the layout?

Here is the log I promised

----------------------------------------------------------------------------------------------------------------------------------

loging report for : 04/28/2010 00:10:37

----------------------------------------------------------------------------------------------------------------------------------



00:10:37 | Platform | Info | * Initialise: OgreRenderManager | H:\MyGUI\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreRenderManager.cpp | 34

00:10:37 | Platform | Info | OgreRenderManager successfully initialized | H:\MyGUI\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreRenderManager.cpp | 62

00:10:37 | Platform | Info | * Initialise: OgreDataManager | H:\MyGUI\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreDataManager.cpp | 23

00:10:37 | Platform | Info | OgreDataManager successfully initialized | H:\MyGUI\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreDataManager.cpp | 27

00:10:37 | Core | Info | * Initialise: Gui | H:\MyGUI\MyGUIEngine\src\MyGUI_Gui.cpp | 77

00:10:37 | Core | Info | * MyGUI version 3.1.0 | H:\MyGUI\MyGUIEngine\src\MyGUI_Gui.cpp | 81

00:10:37 | Core | Info | * Initialise: ResourceManager | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 42

00:10:37 | Core | Info | ResourceManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 50

00:10:37 | Core | Info | * Initialise: LayerManager | H:\MyGUI\MyGUIEngine\src\MyGUI_LayerManager.cpp | 43

00:10:37 | Core | Info | LayerManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_LayerManager.cpp | 51

00:10:37 | Core | Info | * Initialise: WidgetManager | H:\MyGUI\MyGUIEngine\src\MyGUI_WidgetManager.cpp | 68

00:10:37 | Core | Info | WidgetManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_WidgetManager.cpp | 110

00:10:37 | Core | Info | * Initialise: InputManager | H:\MyGUI\MyGUIEngine\src\MyGUI_InputManager.cpp | 55

00:10:37 | Core | Info | InputManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_InputManager.cpp | 69

00:10:37 | Core | Info | * Initialise: SubWidgetManager | H:\MyGUI\MyGUIEngine\src\MyGUI_SubWidgetManager.cpp | 43

00:10:37 | Core | Info | SubWidgetManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_SubWidgetManager.cpp | 63

00:10:37 | Core | Info | * Initialise: SkinManager | H:\MyGUI\MyGUIEngine\src\MyGUI_SkinManager.cpp | 44

00:10:37 | Core | Info | SkinManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_SkinManager.cpp | 52

00:10:37 | Core | Info | * Initialise: FontManager | H:\MyGUI\MyGUIEngine\src\MyGUI_FontManager.cpp | 42

00:10:37 | Core | Info | FontManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_FontManager.cpp | 51

00:10:37 | Core | Info | * Initialise: ControllerManager | H:\MyGUI\MyGUIEngine\src\MyGUI_ControllerManager.cpp | 40

00:10:37 | Core | Info | ControllerManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_ControllerManager.cpp | 50

00:10:37 | Core | Info | * Initialise: PointerManager | H:\MyGUI\MyGUIEngine\src\MyGUI_PointerManager.cpp | 58

00:10:37 | Core | Info | PointerManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_PointerManager.cpp | 73

00:10:37 | Core | Info | * Initialise: ClipboardManager | H:\MyGUI\MyGUIEngine\src\MyGUI_ClipboardManager.cpp | 81

00:10:37 | Core | Info | ClipboardManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_ClipboardManager.cpp | 95

00:10:37 | Core | Info | * Initialise: LayoutManager | H:\MyGUI\MyGUIEngine\src\MyGUI_LayoutManager.cpp | 51

00:10:37 | Core | Info | LayoutManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_LayoutManager.cpp | 57

00:10:37 | Core | Info | * Initialise: DynLibManager | H:\MyGUI\MyGUIEngine\src\MyGUI_DynLibManager.cpp | 35

00:10:37 | Core | Info | DynLibManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_DynLibManager.cpp | 39

00:10:37 | Core | Info | * Initialise: PluginManager | H:\MyGUI\MyGUIEngine\src\MyGUI_PluginManager.cpp | 35

00:10:37 | Core | Info | PluginManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_PluginManager.cpp | 39

00:10:37 | Core | Info | * Initialise: LanguageManager | H:\MyGUI\MyGUIEngine\src\MyGUI_LanguageManager.cpp | 39

00:10:37 | Core | Info | LanguageManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_LanguageManager.cpp | 43

00:10:37 | Core | Info | * Initialise: FactoryManager | H:\MyGUI\MyGUIEngine\src\MyGUI_FactoryManager.cpp | 33

00:10:37 | Core | Info | FactoryManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_FactoryManager.cpp | 36

00:10:37 | Core | Info | * Initialise: ToolTipManager | H:\MyGUI\MyGUIEngine\src\MyGUI_ToolTipManager.cpp | 49

00:10:37 | Core | Info | ToolTipManager successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_ToolTipManager.cpp | 53

00:10:37 | Core | Info | Load ini file 'core_theme.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:37 | Core | Info | Load ini file 'core_language.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | Load ini file 'core_font.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.17' using texture size 512 x 256 | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceTrueTypeFont.cpp | 202

00:10:38 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.17' using real height 17 pixels | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceTrueTypeFont.cpp | 203

00:10:38 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.14' using texture size 256 x 256 | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceTrueTypeFont.cpp | 202

00:10:38 | Core | Info | ResourceTrueTypeFont 'font_DejaVuSans.14' using real height 14 pixels | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceTrueTypeFont.cpp | 203

00:10:38 | Core | Info | Load ini file 'core_resource.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | Load ini file 'core_skin.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | Load ini file 'core_pointer.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | Load ini file 'core_layer.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | Load ini file 'core_settings.xml' | H:\MyGUI\MyGUIEngine\src\MyGUI_ResourceManager.cpp | 119

00:10:38 | Core | Info | Gui successfully initialized | H:\MyGUI\MyGUIEngine\src\MyGUI_Gui.cpp | 126

00:10:38 | Core | Critical | Singleton instance LayoutManager was not created | ..\..\..\..\MyGUI\MyGUIEngine\include/MyGUI_Singleton.h | 55

Altren

28-04-2010 14:46:10

Show your code please. Looks like you trying to load layout, but LayoutManager is not valid for some reason. Do you trying to load layout from different thread (just guessing).

Alekiel

28-04-2010 18:05:49

We have a class specially made for GUI related stuff. Upon construction, it creates the MyGUI platform and GUI manager and destroys them in destruction.

aeGUIManager::aeGUIManager(RenderWindow *rWindow, SceneManager *rScnMgr)
{
ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup(aeRenderManager::RSC_GUI);

// Initialise the platform for the GUI
guiPlatform = new OgrePlatform();
guiPlatform->initialise(rWindow,rScnMgr,aeRenderManager::RSC_GUI);

// Initialise the GUI
guiRoot = new Gui();
guiRoot->initialise();

guiDebug = new aeDebugPanel();
}

aeGUIManager::~aeGUIManager()
{
delete guiDebug;

guiRoot->shutdown();
delete guiRoot;

guiPlatform->shutdown();
delete guiPlatform;

ResourceGroupManager::getSingletonPtr()->unloadResourceGroup(aeRenderManager::RSC_GUI);
}

void aeGUIManager::update()
{
guiDebug->update();
}

void aeGUIManager::unloadLayout(VectorWidgetPtr &rRootPtr)
{
LayoutManager::getInstance().unloadLayout(rRootPtr);
}

void aeGUIManager::injectKeyPressed(const OIS::KeyEvent &rEvent)
{
guiRoot->injectKeyPress(KeyCode::Enum(rEvent.key), rEvent.text);
}

void aeGUIManager::injectKeyReleased(const OIS::KeyEvent &rEvent)
{
guiRoot->injectKeyRelease(KeyCode::Enum(rEvent.key));
}

void aeGUIManager::injectMouseMoved(const OIS::MouseEvent &rEvent)
{
guiRoot->injectMouseMove(rEvent.state.X.abs, rEvent.state.Y.abs, rEvent.state.Z.abs);
}

void aeGUIManager::injectMouseButtonPressed(const OIS::MouseEvent &rEvent, OIS::MouseButtonID rId)
{
guiRoot->injectMousePress(rEvent.state.X.abs, rEvent.state.Y.abs, MouseButton::Enum(rId));
}

void aeGUIManager::injectMouseButtonReleased(const OIS::MouseEvent &rEvent, OIS::MouseButtonID rId)
{
guiRoot->injectMouseRelease(rEvent.state.X.abs, rEvent.state.Y.abs, MouseButton::Enum(rId));
}

VectorWidgetPtr &aeGUIManager::loadLayout(const std::string &rLayoutName)
{
return LayoutManager::getInstance().load(rLayoutName);
}

MyGUI::Gui *aeGUIManager::getGUI()
{
return guiRoot;
}

MyGUI::OgrePlatform *aeGUIManager::getPlatform()
{
return guiPlatform;
}


guiDebug is an encapsulation of a small debug panel showing basic stuff for now (Average FPS count, Triangle count and batch count).

aeDebugPanel::aeDebugPanel()
{
dpRenWin = aeRenderManager::getSingletonPtr()->getRenderWindow();
dpGUIMgr = aeGUIManager::getSingletonPtr();

dpRootVector = dpGUIMgr->loadLayout("Debug.layout");

dpFPS = dpGUIMgr->getGUI()->findWidget<StaticText>("DebugFPS");
dpTris = dpGUIMgr->getGUI()->findWidget<StaticText>("DebugTris");
dpBatch = dpGUIMgr->getGUI()->findWidget<StaticText>("DebugBatch");

setVisibility(true);
}

aeDebugPanel::~aeDebugPanel()
{
dpGUIMgr->unloadLayout(dpRootVector);
dpFPS = 0;
dpTris = 0;
dpBatch = 0;
}

void aeDebugPanel::update()
{
if(dpIsVisible)
{
dpFPS->setCaption("FPS: " + aeUtilities::toString(dpRenWin->getAverageFPS()));
dpTris->setCaption("Tris: " + aeUtilities::toString(dpRenWin->getTriangleCount()));
dpBatch->setCaption("Bactch: " + aeUtilities::toString(dpRenWin->getBatchCount()));
}
}

void aeDebugPanel::setVisibility(bool rValue)
{
dpFPS->setVisible(rValue);
dpTris->setVisible(rValue);
dpBatch->setVisible(rValue);
dpIsVisible = rValue;
}


As you can see, the GUIManager starts up the DebugPanel in the constructor after it already has initialized the GUI and platform.

I honestly wish I could answer your threading question, but my understanding on the topic is pretty poor and I don't really know.

my.name

28-04-2010 19:25:00

try
LayoutManager::getInstancePtr()

Alekiel

29-04-2010 03:53:33

You mean, replacing getInstance() with getInstancePtr()? All that really changed was that now the log doesn't say there was a critical error.

Alekiel

10-05-2010 03:41:04

So, nobody has any ideas on this?

lorkness

25-01-2012 22:52:01

Did you fix it, I think I've got the same problem. Layoutmanager dont seem to be initialized when I initialise MyGUI in Enginemanager.
When I initialise MyGUI in the level it loads fine.

DOES NOT WORK:
{
mRoot = new Root(pluginFileName, configFileName, logFileName);
SetupResources();
Configure())
mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "SCENE");
mWindow = mRoot->getAutoCreatedWindow();
LEVELMANAGER.Startup();

InitialiseGui(); // initialise MyGUI and MyGUI Ogre Platform
LEVELMANAGER.BeginLevel1(); => {LoadLayout();}


LEVELMANAGER.StartListen();
mRoot->startRendering();
}

THIS WORKS:
{
mRoot = new Root(pluginFileName, configFileName, logFileName);
SetupResources();
Configure())

mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "SCENE");
mWindow = mRoot->getAutoCreatedWindow();

LEVELMANAGER.Startup();

LEVELMANAGER.BeginLevel1(); => { InitialiseGui(); LoadLayout(); }
LEVELMANAGER.StartListen();

mRoot->startRendering();
}

There might be something wrong with my resource management,
but it doesn't make sence why it should work on initialization in level since both projects work on same resources.
In both projects i add all resources to Ogre::ResourceGroupManager, perhaps I must use seperate mygui resource manager?