@Enum

Syntax

Annotations are used to add additional information to a rule or an attribute. Annotations are optional and do not affect the semantics of a rule and thus have no influence on the model generation. Annotations are mostly used to give additional hints for user interface elements such as the Inspector on how to present attributes or rules.

 

@Enum(value_1, value_2, …, restricted=true)

Sets an enumeration with specific values. Values can be float or string. Parameter restricted is optional (default is true). If true no other values can be entered in the inspector or set by a handle.

Example:

 
@Enum("low", "mid", "high")
attr lod = "low"

@Enum(10, 20, 30, restricted = false)
attr height = 20

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

Example:

 
@Enum("Residential", "Commercial")
attr floorUsage = ["Residential"]

@Enum(valuesAttr=name, restricted=true)

Sets an enumeration with specific values. The values are dynamically set by an attribute with name valuesAttr(of type float, float[], string or string[]). Parameter restricted is optional (default is true). If true no other values can be entered in the inspector or set by a handle.

Examples:

 
@Enum(valuesAttr = lods)
attr lod = lods[0]
@Hidden
attr lods = ["low", "mid", "high"]

@Enum(valuesAttr = heights, restricted = false)
attr height = heights[1]
@Hidden
attr heights = [10, 20, 30]

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

Examples:

 
@Enum(valuesAttr = usage)
attr floorUsage = [usage[0]]

@Hidden
attr usage = ["Residential", "Commercial"]
 

Was this article helpful?