Page 1 of 1

CELayoutUpgrader - upgrade your layouts to unified dims

Posted: Tue Aug 01, 2006 17:41
by ice
Do you have a bunch of layout files that use the old coordinate system?
Now you have no excuse not to upgrade to CEGUI 0.5.0 :).

I wrote a python script to upgrade layout files to the new Unified Coordinate System. It is available on the wiki:

The code is GPL, so feel free to make modifications and release them.


P.S. would be nice if someone ran py2exe to package it up nice for windows users.

Posted: Tue Aug 01, 2006 19:54
by scriptkid
Hey Ice,

how convenient is that? Thanks a bunch! :-)

Posted: Wed Aug 02, 2006 04:39
by dermont
Very useful but shouldn't the script also remove the MetricsMode property?

Posted: Wed Aug 02, 2006 07:26
by dermont
Here's an example of the above.

Existing layout:

Code: Select all

<Window Type="DefaultGUISheet" Name="root">
    <Window Type="DefaultGUISheet" Name="FacialDemo">
   <Property Name="Size" Value="w:0.25 h:1" />

   <Window Type="TaharezLook/FrameWindow" Name="OgreGuiDemo/WindowPropertiesWindow">
      <Property Name="MetricsMode" Value="Absolute" />
      <Property Name="Size" Value="w:200 h:400" />
               <Property Name="Position" Value="x:0 y:0.02" />

After Running LayoutUpgrader:

Code: Select all

<Window Type='DefaultGUISheet' Name='root'>
   <Window Type='DefaultGUISheet' Name='FacialDemo'>
      <Property Name='UnifiedSize' Value='{{0.250000,0.000000},{1.000000,0.000000}}'/>
      <Window Type='TaharezLook/FrameWindow' Name='OgreGuiDemo/WindowPropertiesWindow'>
         <Property Name='UnifiedSize' Value='{{200.000000,0.000000},{400.000000,0.000000}}'/>
         <Property Name='UnifiedPosition' Value='{{0.000000,0.000000},{0.020000,0.000000}}'/>
         <Property Name='MetricsMode' Value='Absolute'/>

The MetricsMode property shows an Exception in the CEGUI.log. Updating the layout and removing the MetricsMode lines the demo runs but only the main Frame window is shown. Updating all the Unified sizes to between 0 and 1.0 and everything shows correctly.

Code: Select all

      <Property Name="UnifiedPosition" Value="{{0.05,0},{0.02,0}}" />
       <Property Name="UnifiedSize" Value="{{0.40,0},{0.15,0}}" />

Posted: Fri Aug 04, 2006 05:59
by ice
Hi dermont,

The MetricsMode property controls how the regular properties (Position, Size, etc) are interpreted, do I understand correctly?

If that is the case, I can update the script so it detects the MetricsMode and converts those properties correctly. At the moment it just assumes they are relative.

Posted: Fri Aug 04, 2006 08:28
by dermont
Hi ice,

Thanks for replying. AFAIK that's the purpose of the Metrics Mode. One of the developers may be able to offer more insight.

Here's a link to the original layout (Ogre's facial) I'm using: ... iew=markup

Here's a pic of the layout after running the script updater: ... atenh4.jpg

Here's a link shows expected results of ogre's facial animation demo running under pycegui. To update the original layout I opened then saved in the CELayoutEditor. Maybe comparing the original layout vs CELayoutEditor output would identify what needs to be updated in the script.

The Cegui log still shows exceptios for 'BackgroundFrame/Left/Right/TopImage' property named and 'MetricsMode' Exceptions but runs OK.