Here is semi-major attribute refactoring.
I would be happy if someone review code and/or test changes before I push it.
https://github.com/urho3d/Urho3D/pull/2091
- Arbitrary attribute metadata was added.
Attribute metadata is per-attribute
VariantMap
with custom values.
The only way to set metadata is to call
SetMetadata
on
URHO3D_ATTRIBUTE
-like macros.
SetMetadata
calls may be chained.
Metadata may be acquired via
AttributeInfo::GetMetadata
or
AttributeInfo::GetMetadata<T>
. It is also exposed to Angel Script.
- Offset-based attributes were removed due to unsafety.
URHO3D_ATTRIBUTE
and
URHO3D_ENUM_ATTRIBUTE
are aliased to accesor attributes now. So, offset can’t be used to identify attribute anymore. Use attribute name or metadata. See
Constraint
for example.
Attribute type hacking will get broken. If you lied with attribute type, code won’t compile. E.g.
Light::CascadeParameters::splits_
were
float[4]
and serialized like
Vector4
. Don’t lie to your compiler anymore.
- Vector structure elements and corresponding defines were removed, @KonstantTom .
Use metadata variable
AttributeMetadata::P_VECTOR_STRUCT_ELEMENTS
instead. It shall be initialized with
StringVector
instead of
const char*[]
, no trailing zero is needed.