Questions about removing statically managed window names

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Leftium
Just popping in
Just popping in
Posts: 12
Joined: Sat Feb 05, 2011 19:48
Contact:

Questions about removing statically managed window names

Postby Leftium » Tue Jul 26, 2011 04:28

I noticed changeset 2520 removes statically managed window names and associated functions such as WindowManager::getWindow():
MOD: Initial iteration of code to remove statically managed window names. This basically means that WindowManager can create multiple windows with the same name, although it also no longer tracks windows by name (so WindowManager::getWindow and such functions are removed).

I'm curious about the reasoning behind this.

Also, what is the new way to accomplish tasks originally done with WindowManager::getWindow()? For example:
- Load a window layout twice (for instance: VanillaConsole.layout), then set/get a property on one of those windows or their child-windows.
- Load a window layout from C++ CEGUI, then modify the resulting windows from Python PyCEGUI.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Questions about removing statically managed window names

Postby Kulik » Tue Jul 26, 2011 08:33

This is a debatable change and I am sure it will infuriate some but we believe it's a good one. Let me explain:

In 0.7, all windows have absolute (and terribly long) names. Root/Inventory/Panel/DropGoldButton or such. You can never have 2 windows with the same name. This makes cloning and loading layout repeatedly very annoying.
In 0.8, all windows have short relative names. You have window Root, window Inventory inside it, etc... if you want DropGoldButton and you have a pointer to the Root you simply do:

Code: Select all

root.getChild("Inventory/Panel/DropGoldButton")


You can always load any layout without any fear of clashing with anything. You can of course only have unique child names in one parent window but that's a weaker constraint and it's easy to manage it.

We are thinking about adding relative ".." and "/Something" to get the Something child of GUISheet and so on but so far it hasn't been decided whether that's a good thing.

The first one is definitely possible, the second one gets trickier with this change. You either attach the needed window and get it using getGUISheet or (yet better) you design your code differently to store the necessary reference. It would be possible to add something like "Anchor" to the window so that that's absolute (if it's there) and you can get it using WindowManager but it seems like such an ad-hoc solution and wouldn't force people to make better code.

HTH

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Questions about removing statically managed window names

Postby Jamarr » Tue Jul 26, 2011 16:06

Kulik wrote:In 0.7, all windows have absolute (and terribly long) names. Root/Inventory/Panel/DropGoldButton or such. You can never have 2 windows with the same name. This makes cloning and loading layout repeatedly very annoying. In 0.8, all windows have short relative names.


I always hated the window naming system in CEGUI. The very first layout I ever made I thought why the hell does CEGUI not use a relative naming/lookup system? Argh! So I just ended up mimicking this form with long-hand; eg continuously prepending the name of parents to children. This is of course a huge PITA to manually maintain. I am happy this change was made. It will save me some headache ;)
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests