Uploaded image for project: 'Snowstorm'
  1. Snowstorm
  2. STORM-1960

Cleanup project for the XUI, remove redunant code attributes, add default attributes

    Details

    • Type: Story
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Finish
    • Affects Version/s: None
    • Fix Version/s: None

      Description

      This cleanup project is meant to clean up the code files and .xml files of the Viewer to enhance modability.\

      Those major tasks are:

      Removing all "double" attributes in code

      Whether it is faster or not to create an UI in XML as far as possible without using any code bits is arguable but it is definitly faster and more efficient to set widget attributes only once, preferably in their creation process e.g the XML file.

      Example of where such cleanup is needed:
      newview/llpanelface.cpp

      mShinyTextureCtrl->setFollowsTop();
      mShinyTextureCtrl->setFollowsLeft();

      those 2 code lines do exactly the same as this line in XML:

      follows="top|left"

      this "follows" tag is a default attribute every widget should have, therefor it is redunant to add this attribute in code as it is already set on creation in the coresponding XML file.

      Exception to this are attributes that change over time or with certain actions or cannot be set via XML file. Examples of this are:

      mCtrlColorTransp->setEnabled(TRUE);
      //Enabling or disabling something because of a certain special action (not a Debug setting)

      mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
      //Setting DnD Permission Filters which is not possible in XML.

      mBumpyTextureCtrl->setOnCloseCallback();
      //Setting special callbacks which are not available in XML.

      Retrofit newer XUI functionaility in older usages

      Since Viewer 2 the XUI system was heavily expanded and can now properly do tasks previously only doable via code. Such functions are:

      enabled_control="DebugName"
      disabled_control="DebugName"

      //functions to enable/disable this widget when Debug X is set to true.

      visibility_control="DebugName"
      invisibility_control="DebugName"

      //functions to show/hide this widget when Debug X is set to true

      <button.init_callback
      function="Button.SetFloaterToggle"
      parameter="env_edit_sky" />
       
      <button.commit_callback
      function="Button.SetFloaterToggle"
      parameter="env_edit_sky" />
       
      <button.validate_callback
      function="X.doY"
      parameter="Z" />
       
      <button.mouseenter_callback
      function="X.doY"
      parameter="Z" />
       
      <button.mouseleave_callback
      function="X.doY"
      parameter="Z" />

      //Callbacks to call an either locally or globally available function.

      filename="floater_test.xml"

      //Attribute to use a existing .xml file for this panel.

      <menu_bar/>
      <menu/>
       
      <menu_item_call/>
      <menu_item_check/>
       
      <menu_item_separator/>
       
      <menu_item_call.on_click/>
      <menu_item_call.on_enable/>
       
      <menu_item_check.on_check/>
      <menu_item_check.on_click/>

      //Widgets to create menus in a floater or panel or container and add functions to them when beeing clicked or enabled or ticked.

      Aligning all XML files to a given standard

      This part of the project aims at improving readability extremly by creating a default layout sheet for all XML files and using it on all XML files.

      Examples of such places where this project is needed:

      <location_input
                              follows="all"
                       halign="right"
      ...
       
      <button
      attributes
      ...
      />
       
      <button
      attributes
      ...>
      </button>
       
      <panel      follows="left|top|right"
                         height="50"
                         mouse_opaque="false"
      ...

      They should look like this at the end:

      <location_input
      follows="all"
      halign="right"
      ...
      <!--// we keep a whole widget with all its attributes in the same height of each other, no different 
      spacings, exception here are functions which are basically contents of the widget, they will need another 
      tab to "split" and highlight them from the rest of that widget-->
       
      <button
      attributes
      .../> 
      <!--// we close it in the same line as the last attribute and dont use an extra line for it-->
       
      <button
      attributes
      .../> 
      <!--// we do not use </button> if this button doesnt contain something, instead we can just save it and 
      close it with /> at the end like the first example-->
       
      <panel
      follows="left|top|right"
      height="50"
      mouse_opaque="false"
      <!--// every widget type definition and every attribute has its own line, widget start and end (close) are 
      always in the same line as the first and last line of that widget, we do not put attributes in the same line 
      as the widget type definition.-->
      ...

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              niranv.dean NiranV Dean
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: