Classes that derive from Serializable can perform automatic serialization to binary or XML format by defining attributes. Attributes are stored to the Context per class. Scene load/save and network replication are both implemented by having the Node and Component classes derive from Serializable.

The supported attribute types are all those supported by Variant, excluding pointers and custom values.

Attributes can either refer to a member of the object or define setter & getter functions. Member attributes can also have post-set action: member function without arguments that is called every time when value is assigned to the attribute.

Zero-based enumerations are also supported, so that the enum values can be stored as text into XML files instead of just numbers.

The folowing macros can be used to define an attribute:

To implement side effects to attributes, the default attribute access functions in Serializable can be overridden. See OnSetAttribute() and OnGetAttribute().

Each attribute can have a combination of the following flags:

The default flags are AM_FILE and AM_NET. Note that it is legal to define neither AM_FILE or AM_NET, meaning the attribute has only run-time significance (perhaps for editing.)

See the existing engine classes e.g. in the Scene or Graphics subdirectories for examples on registering attributes using the DRY_ATTRIBUTE family of helper macros.