Resource group "General" is a must-have?

alfvir

25-02-2009 04:49:18

Hi guys!
Purely accidentally today I came across a really weird bug/feature/whatever_else. Basically, it seems like MyGUI only works correctly, if it resources are stored within the ResourceGroup "General". First, I thought the problem was in my code, but it turned out, that it exists in demos too. Basically, whatever other name you give to your resource group, be be even if it is "General2", MyGUI would simply not "see" it, despite the resources being loaded.
This bug/feature seems to be so insane, as it seems to be impossible to exist. Honestly, I tried to find where in code is it hardcoded to "General", but failed... :(
Please, shine some light on this matter :)

KorgKeys

25-02-2009 05:08:18

I was just trying to track this problem down also. I recently upgraded to the svn version (1773) and now my StaticImage textures don't show up. The log from MyGUI shows the following:


23:50:30 | General | Error | Texture 'Ogre-logo.gif' not found in group 'General' | MyGUI_SkinManager.cpp | 273
23:50:30 | General | Error | Texture 'etl_logo_small.png' not found in group 'General' | MyGUI_SkinManager.cpp | 273
23:50:30 | General | Error | Texture 'MyGUI_logo.png' not found in group 'General' | MyGUI_SkinManager.cpp | 273
23:50:30 | General | Error | Texture 'sharp_circular.png' not found in group 'General' | MyGUI_SkinManager.cpp | 273
23:50:30 | General | Error | Texture 'splatting0.png' not found in group 'General' | MyGUI_SkinManager.cpp | 273
23:50:49 | General | Error | Texture 'sharp_circular.png' not found, set default texture | MyGUI_RenderItem.cpp | 181
23:50:49 | General | Error | Texture 'Default' not found, set default texture | MyGUI_RenderItem.cpp | 181
23:50:49 | General | Error | Texture 'Default' not found, set default texture | MyGUI_RenderItem.cpp | 181


Note the error message for texture 'Default' at the end; the default texture (yellow/black lines) actually gets drawn in the StaticImage object (instead of the 'sharp_circular.png' texture) but the error message gets logged in an infinite loop. The 'sharp_circular.png' texture is in resource group ET and is being loaded. If I load it as resource group General then it gets drawn correctly with no error messages.

alfvir

25-02-2009 05:14:32

Phew... at least I'm not completely insane yet :P Been tracking this problem for a few hours now, and it just doesn't make sense (or at least didn't make sense, until it became obvious, that it is something to do with MyGUI). I'll post any results as soon as I get them

KorgKeys

25-02-2009 05:35:26

Well, right there were I said the error message loops (MyGUI_RenderItem.cpp, line 181) doesn't look too good.

It calls Gui::getInstance().getResourceGroup() to get the resource name (which returns a single string) and uses
it to look for the texture. It appears to be a single check for a single resource group. Note that for the loop I saw
it states that it can't find texture 'Default" but draws it anyway. So it seems that each time this function (_render)
gets called, it:

o Tries to find texture 'Default' in group 'General'
o Fails to find it and logs an error message
o Changes the items texture name to 'Default'
o Uses 'Default' to draw the texture.

This same process occurs every time _render() gets called.

Note that the check (for this widget instance) is getting its resource group from a singleton.

I tried using the setGroup() call to set a group name for my StaticImage object but it didn;t seem to
have any effect. Perhaps the original intent was to get the resource group name from this object
instance instead of from the GUI singleton?

alfvir

25-02-2009 06:15:17

Well, my part of the "bug" turned out to be a simple ignorance of core.xml. I've completely forgotten, that it overrides the settings... Well, at least I had a chance to get used to MyGUI's internals :roll:
As far as this looping goes, I'd assume it has something to do with variable clashes. But I'll check up on that later on today thou ;)

Five_stars

25-02-2009 06:31:15

Method from MyGUI::Gui:
void Gui::initialise(Ogre::RenderWindow* _window, const std::string& _core, const Ogre::String & _group, Ogre::String _logFileName)

group variable sets to ResourceManager. This is a name of resource group. I'm not sure, but try to change it to your resource group name.

alfvir

25-02-2009 07:03:18

@ Five_stars
Thanks! It just appears, that in the _core file, there can be overrides (i.e. the resourceGroup can be set to something different on a per settings file basis. hence, if used, those need to be adjusted manually) ;) Something I completely forgot about, assuming that _group overrides those, whereas it doesn't.

KorgKeys

25-02-2009 18:22:42

Hmm, in my case everything worked fine under 2.2.0_RC1; the StaticImage object found the correct texture regardless of which resource group it was loaded under.

For the svn version, the StaticImage object is *not* searching through all loaded resources. It is searching in one specific resource group and ignoring any others.

Altren

25-02-2009 20:08:12

Now we store and load all MyGUI resources in/from resource group that was used in Gui initialise method. May be you right and we also need to add possibility to load from custom resource group.

Altren

26-02-2009 11:44:32

If you want to load from all resource groups you can use Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME as your gui group.