Changes between Version 1 and Version 2 of GUI_-_Repeat


Ignore:
Timestamp:
Dec 10, 2014, 9:15:51 PM (9 years ago)
Author:
leper
Comment:

Nested repeat object support was added in r16034.

Legend:

Unmodified
Added
Removed
Modified
  • GUI_-_Repeat

    v1 v2  
     1[[TOC]]
     2
    13= Repeat =
    24The repeat object is designed to simplify cases where you have a large number of very similar objects nearby each other.
    35== Explanation ==
    46The repeat object generates "count" copies of any objects nested within it. Since you can not have multiple copies of the same named object you insert "[n]" somewhere in the name. After parsing, the "n" is replaced with the index of the generated object in the repeat.
     7
     8You can also specify the variable that is replaced as the value of the `var` attribute. This is useful if you need nested repeat objects.
    59
    610'''Important:''' The repeat element does not automatically adjust child element sizing.
     
    2024</repeat>
    2125}}}
     26
     27== Example - Nested ==
     28For example, the following XML could be simplified by using a repeat element.
     29{{{
     30#!xml
     31<object name="myObj[0][0]" type="sprite" sprite="mySprite"/>
     32<object name="myObj[0][1]" type="sprite" sprite="mySprite"/>
     33<object name="myObj[1][0]" type="sprite" sprite="mySprite"/>
     34<object name="myObj[1][1]" type="sprite" sprite="mySprite"/>
     35}}}
     36The next snippet uses the repeat element to create the same result.
     37{{{
     38#!xml
     39<repeat count="2">
     40    <repeat count="2" var="m">
     41        <object name="myObj[n][m]" type="sprite" sprite="mySprite"/>
     42    </repeat>
     43</repeat>
     44}}}