Dumping windows and properties to XML

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
fog
Just popping in
Just popping in
Posts: 12
Joined: Wed Jan 12, 2005 12:06
Location: Torino, ITALY
Contact:

Dumping windows and properties to XML

Postby fog » Fri Jan 14, 2005 17:14

As I said in that other thread I am experimenting with CEGUI by writing a very simple GUI designer.

After some hours of work I reached a stage where I need to dump windows (and their properties) to XML. I hate to write code usefull only in my own work so I am thinking about writing in a way that can be incorporated into CEGUI by simply moving it into the right namespace.

My idea is to have two trees of serializer classes rooted at WindowXMLSerializer and PropertyXMLSerializer and two singleton managers that register the instances and associate the right serializer to every window/property at dump time. The tree walking code would be the same (implemented in the root classes) and dumping a new window/property would as easy as subclassing one of the existing classes and registering an instance with the manager.

Associations can be put in the equivalent of scheme files establishing a nice simmetry between loading and dumping the GUI.

Comments?

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

Dumping windows and properties to XML

Postby CrazyEddie » Sat Jan 15, 2005 13:58

scriptkid has a GUI editor project that is able to write XML from Windows and Properties, I'm not sure about the approach he used for that.

Having this ability in the core system is something I've mentioned before, I'd also like to be able to extend it to Fonts and Imagesets as well; this enables the creation of editors for those files as well as for UI layouts.

I have not given over much thought to how any of this would be achieved, having said this, your suggested approach is certainly valid and I'd not be opposed to integrating something using this approach.

One thing that needs to be added to the current system is the ability to get and/or detect defaults for properties. This is basically to get around the need to dump loads of properties which were never changed; so before dumping a property you'd just do a property->isDefault(); or similar and only dump properties that return false. If this would be useful, let me know and I'll do it sooner rather than later.

CE.

User avatar
fog
Just popping in
Just popping in
Posts: 12
Joined: Wed Jan 12, 2005 12:06
Location: Torino, ITALY
Contact:

Dumping windows and properties to XML

Postby fog » Sat Jan 15, 2005 14:33

I know about scriptkid GUI editor and I would be glad to have a look at its source code (hint). Anyway, I needed a "small" project to test CEGUI and maybe (if I don't throw away everything) a working editor for Linux (scriptkid is win32 only from the screenshots.)

I'll finish the serializer classes and then post back for comments and isDefault().

fog

User avatar
fog
Just popping in
Just popping in
Posts: 12
Joined: Wed Jan 12, 2005 12:06
Location: Torino, ITALY
Contact:

Re: Dumping windows and properties to XML

Postby fog » Mon Jan 17, 2005 00:17

Yesss. isDefault() would help a lot in reducing the XML file size (there is no easy way to do that from the "outside" because code has no access to the Property objects, just to the Strings.)

I am working at the properties dialog right now; I'll be back when finished. :D

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

Re: Dumping windows and properties to XML

Postby CrazyEddie » Mon Jan 17, 2005 09:49

Ok, I'll add the isDefault in later on this week :)

CE.

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

Re: Dumping windows and properties to XML

Postby CrazyEddie » Tue Jan 18, 2005 14:50

I have added the defaults system. The defaults used at the moment are largely static information taken from the base classes for the widgets, this means that there will still be a few cases where 'default' values are reported as non-default; this is due to the subclasses having a different defaults than what are in the superclasses. The defaults implementation for properties is sufficiently flexable that these minor issues can be fixed over time.

For your XML dumping, a couple of tips to ensure trouble free behaviour:
Detect the metrics mode in use and only dump one set.
When dumping Window hierarchies, do not dump the auto-generated child windows with '__auto_' in their names.

I've not had a chance to examine the code in your project posted in the Layout Editor thread; I'll try and have a look over the coming weekend :)

CE.

User avatar
fog
Just popping in
Just popping in
Posts: 12
Joined: Wed Jan 12, 2005 12:06
Location: Torino, ITALY
Contact:

Re: Dumping windows and properties to XML

Postby fog » Tue Jan 18, 2005 23:38

Detect the metrics mode in use and only dump one set.
When dumping Window hierarchies, do not dump the auto-generated child windows with '__auto_' in their names.


Both were implemented from the start (you haven't looked at the code, eh? :D )

I've not had a chance to examine the code in your project posted in the Layout Editor thread; I'll try and have a look over the coming weekend


Very kind. Just note that everything is crappy except the XML dumping. I will refine it (and add schema loading and the missing classes) in the next few days and then go on with the builder. at least untill scriptkid ports its very nice project to linux.

Thank you,


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests