Loading multiple layouts - CElayouteditor not working?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

vr
Just popping in
Just popping in
Posts: 19
Joined: Thu Oct 12, 2006 20:57

Loading multiple layouts - CElayouteditor not working?

Postby vr » Wed Dec 20, 2006 10:40

Hi all.

Could someone tell me how to load multiple layouts into one guisheet?

Assume you have two .layout files, one containing projectspecific (menus for the game etc...) stuff and the other contains more general stuff (console, messagewindows etc)

Now if I do:


Window *l1 = loadLayout("game.layout");
Window *l2 = loadLayout("system.layout");

Now I want to merge these two:
I could do:

l1->addChildWindow(l2);
or l2->addChildWIndow(l1);

or

Window *w = new GUISheet()
w->addChildWindow(l1);
w->addChildWindow(l2);

Now all these approaches fails on the following point:

- Only the last added layout can be interacted with.

The content of both layouts is visible, but only the windows in the last added layout reacts to mouse events. That is only the last windows can be made active.


Now I just realized that the reason for this is that the Root window (created by CELayouteditor) is actually of size 1,1, that is it obscures the whole window. This means that the root of the last added window will obscure anything loaded previously.

The root of evil here is then CElayouteditor, which dont allow you to save a layout without a root window (you cant delete the root window).

So layouteditor is a tool to only create full layouts, not partial ones.
If one edit the resulting layoutfiles and removes the root window, it actually works.

It should be possible to store a layout without the root, or just to make it possible to remove the root from the scene in Layouteditor

/A

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Wed Dec 20, 2006 11:46

I've created multiple dialogs in various .layout files. When creating a new one I would start by adding a FrameWindow and then immediately saving and then closing the Layout Editor. I would then open up the .layout file in Notepad and manually remove the Root entry, making the FrameWindow the top level object. Then I reopen the .layout within the Layout Editor and continue designing as you normally would.

One thing to keep in mind when "activating" multiple .layout files is that every widget must have a unique name. The latest version of the Layout Editor makes that bit easy; the name of a new widget has the name of its parent as a prefix, in a hierarchy:
MyFrameWindowName
MyFrameWindowName/ButtonOk
MyFrameWindowName/ButtonCancel

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Dec 20, 2006 13:30

I think that the 'Save Selection' button can be abused to re-save a layout without its root window.

[Edit] As a more constructive reply: would it be an idea to prompt whether you want a root window when you start a new layout? [/edit]

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Dec 20, 2006 13:38

I noticed something else myself. Because of the unique names requirement, you cannot load multiple 'editor' layouts, because they all have a window called 'root'. So maybe it should prompt for a name as well...

vr
Just popping in
Just popping in
Posts: 19
Joined: Thu Oct 12, 2006 20:57

Postby vr » Wed Dec 20, 2006 13:41

You can rename it though.
But I agree, it should be possible to load a layout even if there are windows with the same name.
Its after you have added it to an active root it becomes a problem.

But CEGUI is designed from the core that every window has to have a unique name, otherwise it becomes hard to locate a window created earlier. So I guess this is something that has to be accepted.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Wed Dec 20, 2006 17:26

scriptkid wrote:I think that the 'Save Selection' button can be abused to re-save a layout without its root window.


Jeez, why didn't I think of that...

scriptkid wrote:[Edit] As a more constructive reply: would it be an idea to prompt whether you want a root window when you start a new layout? [/edit]


I would suggest the following instead. Never create a root window and open the Layout Editor blank. Then the user can either create a FrameWindow or a DefaultWindow (to be named Root or root). However I'm not thinking neutrally; I never use the root window so feel hindered by it. I wonder how many enjoy/benefit from having that root DefaultWindow.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 22 guests