Skin XML Calculator... (1 Viewer)

TesterBoy

Portal Pro
July 10, 2006
160
3
Lower Hutt
Home Country
New Zealand New Zealand
In an effort to improve the lot of Skinners around the world, I've built an expression parser to help reduce the effort required to maintain both 4x3 and WS versions of a skin. It's currently fairly basic, only allowing numeric calculation (no strings), but I wanted to find out if there's any interest and/or point in taking it further.

It builds on the exiting <define> tag and '#' syntax as follows:

Say you have a skin element tag such as <posx> - you can use the following:

1. Absolute position (current functionality): <posx>120</posx>

2. Specified by a constant (current):

<define>#MyPosX:120</define>
...
<posx>#MyPosX</posx>

3. Absolute offset from right-hand side (120 pixels from the right edge):

<posx>#(#ScreenWidth - 120)</posx>

Sorry - forgot to mention that #ScreenHeight and #ScreenWidth are built-in and taken automatically from GUIGraphicContext.SkinSize

4. (10) Percent of the screen width:

<posx>#(#ScreenWidth*10/100)</posx>

5. You can use defines to create subexpressions:

<define>#TenPercentofWidth: (#ScreenWidth*10/100)</define>
...
<posx>#TenPercentofWidth</posx>

6. and use them in more complex expressions:

<posx>#(#TenPercentofWidth*3/2)</posx> (15% of width (I think!))


7. String expressions - e.g. you can calculate the name of a graphic

#('myHome' + #ScreenWidth + 'x' + #ScreenHeight + '.png') -- myHome1280x720.png

or maybe

#(#ScreenWidth + 'x' + #ScreenHeight + '\myHome' + '.png') -- 1280x720\myHome.png

if you want to put gfx for different sizes/aspect ratios in separate directories.

I need to define some built-in functions (e.g. if(,,) would possibly be useful), and also it currently does integral arithmetic, so floats would be an obvious extension.

That's enough from me. The questions are

1. Is this going to be useful

2. Would anybody use it

and therefore,

3. Should I continue working on it, or find something else to play with? :)

Note that it doesn't (seem to) break any existing skin syntax, but making sure it didn't has made some of the syntax (e.g. "#(...)" a bit clumsy... (Anyway, that's my excuse, and I'm sticking to it...)
 

mofux

Portal Designer
  • Premium Supporter
  • January 27, 2006
    678
    34
    Dresden, Germany
    yeah, that sounds really great! i would use this. it's much nicer and allows to split the screen into "regions", which is good in every case, because it keeps the layout, no matter what screen-resolution is chosen.

    so please go on with that approach, but keep downwards compatiblity in mind!
     

    mzemina

    Retired Team Member
  • Premium Supporter
  • February 23, 2005
    2,065
    14
    Tulsa, OK
    Home Country
    United States of America United States of America
    I think ANY tool which will help people in creating or modifying skins is welcomed! We sure need MORE tools for skins, hopefully when the new skin engine appears some development will go into creating some skin tools. I think it sure would be appreciated!
     

    TesterBoy

    Portal Pro
    July 10, 2006
    160
    3
    Lower Hutt
    Home Country
    New Zealand New Zealand
    ... hopefully when the new skin engine appears ...

    As an aside - are there any threads for discussion, documentation etc of what the new engine will/won't have or do (over and above what the current one does, I suppose...)? I mean, if this capability is being built in, I will need to take that into account when doing a therefore temporary version for the current engine.

    I sort of assumed that my calculator will either be redundant when the new engine arrives, or that it'll be able to hook in somehow - took 3 lines of change in the current code base and everything else is new source files...
     

    mofux

    Portal Designer
  • Premium Supporter
  • January 27, 2006
    678
    34
    Dresden, Germany
    the new gui engine won't be xml-based anymore, it will use xaml, and with that nearly everything is possible (also what you try to include now). introducing that new engine needs us to completely rewrite mediaportal.

    the only problem is that it will take some time till we have that baby in our hands...

    regards, mofux
     

    TesterBoy

    Portal Pro
    July 10, 2006
    160
    3
    Lower Hutt
    Home Country
    New Zealand New Zealand
    mofux & mzemina - thanks for the responses...

    Overall I'm a bit underwhelmed by the reaction - I assume that's effectively two votes for, and 300+ against? :)

    mofux - any idea how long till the new engine is released? Is there a status thread or something to let the rest of us know what's happening/how to help/etc?

    If it's gonna be out in <6 months, then there's probably not much point in this. If it's a year, it becomes more worthwhile.
     

    mofux

    Portal Designer
  • Premium Supporter
  • January 27, 2006
    678
    34
    Dresden, Germany
    hard to say, but it think it will definately will take more than a half year until we have a stable release together, but that's just what i think, could be faster tho'...

    you can have a look on that baby by just checking out the MediaportalNG branch from the svn reopsitory (you need to install .net 3.0 in order to compile)

    regards, mofux
     

    TesterBoy

    Portal Pro
    July 10, 2006
    160
    3
    Lower Hutt
    Home Country
    New Zealand New Zealand
    OK - I might do that shortly. Can I have both versions checked out/compiled/etc (in separate directories, of course) without causing problems on my dev box? (And is there a better place for me to ask this question? :) Getting off topic...)
     

    Users who are viewing this thread

    Top Bottom