@Range(min=value_1, max=value_2, stepsize=0, restricted=true)

Sets the numeric range of an attribute by parameters min and max (inclusive). Parameter stepsize is optional (default is 0). If set to >0, possible values are set in respective steps starting from the minimum value. Sliders in the Inspector respect the step size. Parameter restricted is optional (default is true). If set to true any numerical input value is set to the nearest possible value in the Inspector.


@Range(min=5, max=50)
attr height = 20

@Range(min=0, max=45, stepsize=15, restricted=false)
attr angle = 30

If the @Range annotation is applied to an array attribute, the range is defined for the elements of the array.


@Range(min=2.5, max=7)
attr floorHeights = [4, 5.5, 5.5]

Was this article helpful?