Resource loading problem

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
gcarlton
Just can't stay away
Just can't stay away
Posts: 149
Joined: Wed Jan 12, 2005 12:06

Resource loading problem

Postby gcarlton » Fri Feb 18, 2005 00:09

Hi, I got latest this morning and the resource loading stuff (while looking very cool) did break my build. The problem for me is that I load up schemes, imagesets, etc in subdirectories. For example, I load the scheme with this:

Code: Select all

CEGUI::SchemeManager::getSingleton().loadScheme("gui/schemes/TaharezLook.scheme" );


The GUIScheme.xsd sits in the same directory. This used to work fine, but now it fails to find the xsd, probably because its looking in the root directory. In my build, I got around this by adding the following code to the scheme, imageset, and font loading:

Code: Select all

String sSchemaFileName;
size_t pos = filename.rfind("/" );
if (pos == String::npos)     pos = filename.rfind("\\" );
if (pos != String::npos)    sSchemaFileName.assign(filename, 0, pos+1);
sSchemaFileName += GUISchemeSchemaName;


and then use that to load the file:

Code: Select all

loadRawDataContainer(sSchemaFileName, ...)


I'm not sure how it is supposed to work, but these couple of lines fixed it for me. I didn't make up a patch 'cause I'm feeling lazy today.

btw, even when I click no smileys, it still puts in smileys in the final post!

Edit: ok, [code] does work! :D

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Resource loading problem

Postby CrazyEddie » Fri Feb 18, 2005 09:34

The .xsd thing is a pain in the rectum. The new code only looks in the working directory, the old code looked there and also in the directory containing the xml doc being loaded.

I might use something similar to your code in a helper method to load & set the schema used. If I do this I'll also recreate the original behavior of checking both locations.

I noticed the smiley thing the other day.

Code: Select all

But code tags work okay!

User avatar
toysnob
Just popping in
Just popping in
Posts: 13
Joined: Fri Feb 18, 2005 01:15

Re: Resource loading problem

Postby toysnob » Wed Feb 23, 2005 03:33

This might be the same problem I've had. But your fix is not helpful without filenames and rough line numbers of where to insert your patch.

Can you please post these?

User avatar
gcarlton
Just can't stay away
Just can't stay away
Posts: 149
Joined: Wed Jan 12, 2005 12:06

Re: Resource loading problem

Postby gcarlton » Wed Feb 23, 2005 23:18

Search for "loadRawDataContainer". Its referenced throughout CEGUI, but there are only about 4 or 5 times it is done using a schema name. For Scheme it loads GUISchemeSchemaName, for Font its something like GUIFontSchemaName, etc.

Once you have found those half-dozen cases, apply the code to just before the loadRawDataContainer call, and replace the schema string argument with the sSchemaFileName. Oh, and don't forget to put the correct GUIBlahSchemaName in that code you paste in each time.

Sorry if that sounds long winded, but its the way I did it and I don't have time to track down exact line numbers right now. :)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Resource loading problem

Postby CrazyEddie » Sun Feb 27, 2005 19:34

XML loading was totally refactored earlier on today, so 99% of the code repetition that was previously present in the XML reading code has been elimiated.

I have just finished adding gcarlton's code which restores the previous behavior of trying to load the .xsd from the same location as the xml file if loading using the .xsd name alone fails. This will take a few hours before anon access syncs though.

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 4 guests