Is there a need for a skin editor? (1 Viewer)

NoBugS

Portal Pro
August 22, 2009
91
54
Hoover, AL
Home Country
United States of America United States of America
sound interesting.... do you have an example that show what you desrcibed? since I'm not a skinner I somehow got lost in the middle....
 

arion_p

Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    I am not a skinner either, I am a developer :D but I will try to elaborate a bit more.

    Case 1:
    User wants to add a new screen (xml) file. He is presented with a dialog that contains the list of windows (defined in MP's own and installed window plugins) that have not been already mapped to other screens/xml files. The user may also specify a window ID by hand.

    Case 2:
    User has just created a screen and wishes a quick start. He chooses auto-insert window controls and he is presented with a dialog having a list of all controls defined in code for the window with the same ID as the screen being edited. For each control he sees its name (variable name in code) its ID and its type. He selects the controls to insert, and controls are inserted into the screen xml using names, IDs and control types from the above list. He can then proceed to move / resize controls to the right place.

    Case 2a:
    User want to see if he missed some controls (that exist in the window but not in the xml). He opens up the same dialog as in case 2. He is presented only with controls not already in the xml. He can proceed to insert any or all of those in the xml just like in case 2

    Case 3:
    User has finished working a screen xml and wants to validate that it will bind correctly to the window it was designed for. He presses the "Validate IDs" button/option and the skin editor matches the IDs in the control in the xml to the IDs of the controls in the window. The user is presented with a dialog containing three lists:

    • one lists the control IDs in the xml that do not exist in the window (code)
    • the second lists control IDs in the window (code) that do not exist in the xml
    • the third lists control ID that exist in both but the control type specified in the xml is not appropriate for the control type declared in the window (code). E.g. xml specifies a control as Label but in the code it is declared as GUIImage
    Hope this makes it more clear.
    It would be nice if a skinner could comment if such functionality is needed and/or helpful.
     

    Dadeo

    Docs Group Manager
  • Premium Supporter
  • November 26, 2006
    5,340
    3,321
    Himalayas, India
    Home Country
    Canada Canada
    I am not a great or very experienced skinner, but I can tell you this functionality would be invaluable to me. Every case you described I have wished for!

    I would add the fact that IDs for any xml imported into the window must be included in the list of control ids, this is most often where I run into conflicts. For example, if you define your own media overlays (for when media is playing) and you have controls with IDs in the overlay xml which is imported into many other xmls, then the overlay control IDs can conflict with those used in that window. Hope that is clear! The worst is when you start adding controls to common.window xmls which apply to almost all windows. Suddenly a button somewhere stops working since it uses that ID.

    The one point I am not sure about is
    list of all controls defined in code for the window with the same ID as the screen being edited
    What I really need is a list of controls AND GuI properties supported by MP or the plugin in that window. I am forever trying to use a fadelabel only to discover that window does not support it. That is rare, but it happens more frequently with controls like textbox or texboxscrollup, and even selectedthumb! And then there are the tags. Sometimes you cannot even use <align> tags on a label! If there is a way to access MP supported properties for a window, then this would be heaven for skinners!
     

    NoBugS

    Portal Pro
    August 22, 2009
    91
    54
    Hoover, AL
    Home Country
    United States of America United States of America
    mh, I think I'm too far away from being a skinner :). Sounds like a nice and helpful feature. However: how should I find out about the defined IDs of a window?
    How to query that? I there an API function for that? Cause if not I really don't know how to find out about that? Maybe somebody knows an answer.
     

    Dadeo

    Docs Group Manager
  • Premium Supporter
  • November 26, 2006
    5,340
    3,321
    Himalayas, India
    Home Country
    Canada Canada
    Start here: Wiki Window IDs. I think all MP core.xmls IDs are documented. For Plugins you have to check the Window ID at the top of the xml. (e.g. <window> <id>35</id> for BasicHome.xml). I never heard of an API to just extract it from the window IDs of each XML used in the skin you are working on. But that would be ideal! There was a previous attempt at a skin editor, as I'm sure you know, but I don't know if they got that working.
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    I was actually thinking of getting the IDs from the code itself (documentation can be out of date, and does not include 3rd party plugins).

    The way to get the window IDs is the following:

    1. Enumerate all assemblies (dlls) in Plugins\Windows directory of MP
    2. Load each assembly and enumerate all types defined in the assembly
    3. For each type that is a descendant of GUIWindow create and instance of that type
    4. For each instance created call the GetID method to the the window ID and store it in your list of known windows along with the type name.
    5. Optionally get controls IDs and types contained in the windows (see below)
    To get the control IDs for a given type:

    1. Enumerate all members (including inherited) using Type.GetMembers(BindingFlags)
    2. For each MemberInfo returned call GetCustomAttributes passing the type of Mediaportal.GUI.Library.SkinControlAttribute
    3. If the previous call returns a non empty array, the member is a skin control. Cast the first (and only) element as SkinControlAttribute and get the control ID from the SkinControlAttribut.ID property.
    4. Get the control name from MemberInfo.Name
    5. Depending on whether the member is a field or a property (MemberInfo.MemberType) get the control type from either FieldInfo.FieldType or PropertyInfo.PropertyType
    You can get the xml element names and xml attribute names of control types in a dimilar way by looking for fields / properties having one of the XmlSkinAttribute or XmlSkinElementAttribute attributes.

    Getting supported skin properties is not possible in this way, unless the code is extended to include perhaps a SkinPropertyAttribute applpied multiple time on each GUIWindow derived class to declare available properties.
     

    NoBugS

    Portal Pro
    August 22, 2009
    91
    54
    Hoover, AL
    Home Country
    United States of America United States of America
    funny but thats basically what I was working on today. And it works somehow.
    The challenge is that my tool is in JAVA!!! Meaning I also need a wrapper dll which I did today.
    So I'm on the right track :)

    ::tnx::
     

    NoBugS

    Portal Pro
    August 22, 2009
    91
    54
    Hoover, AL
    Home Country
    United States of America United States of America
    ok, me again,

    here a screenshot of the current alpha showing a list of windows extracted out of the dlls.
    Lets see what we can do with it. For now I think I will focus back to the more basic features (like supporting all controls). After that is done I'm sure I can do the proposed features.

    Btw: hope the WIKI is growing.... I really need that input!!! :)
     

    Attachments

    • screen3.JPG
      screen3.JPG
      113.2 KB

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    :D for your work.

    Btw, these are the class names. Unfortunately there is currently no way to find the actual filename of the xml loaded by each class. It is usually loaded in method Init() using something like:
    Code:
    Load(GUIGraphicsContext.Skin + @"\MyMusicPlayingNowAnVu.xml");
    What is worse is that there are windows that conditionally choose the xml to load at runtime (see for e.g GUIMusicPlayingNow.cs) and thus map to multiple xmls. The only way to vercome this would be to add some attribute to the classes that declare the related xml filenames. That could be done later when the skin editor is more mature.:)
     

    Users who are viewing this thread

    Top Bottom