Modifiers
Last updated
Last updated
Modifiers allow you to change the values before they are set or retrieved by requesters. Modifiers provide flexibility in manipulating the bound values. Like converters, modifiers are relatively simple to implement and extend.
The modifiers must not change output value type, at most have a value which is of an inherited type relative to input value type.
To add a new modifier, it is sufficient to implement the IReadWriteModifier<T>
interface:
The IReadWriteModifier<T>
interface implements both IReadModifier<T>
and IWriteModifier<T>
. Implement one of them if you need only one-way modifier.
ISmartModifier
gets the bind field it is currently attached to, while its generic version gets as well the possibility to force a value into the pipeline even when there was no request for it.
IObjectModifier
is specifically designed to handle non-value types. It is recomended to implement this interface (or its generic version) for modifiers which intend to modify instance values and their inherited types.
The system will automatically pick up the new modifier and make it available in Bind Menu. To avoid auto registration of the new modifier, add [HideMember]
attribute over the class.
Sometimes the system will need another recompilation round to successfully register the new modifier.
The modifier must have a parameterless constructor.
For new numeric modifiers, we suggest extending NumericModifier
for simplicity. It only requires to implement a simple Modify(double)
method and optionally another Modify(long)
method to cover all numeric modification cases.
Most of the modifiers have their code exposed, this is to allow users to change them at their heart's content.