The curves data type relies on valid values in attributes like
resolution or handle_type_left, and will crash or assert otherwise.
This commit adds clamping when writing to these attributes with the
attribute API (note that the Python/RNA API is still separate for now).
That is done with a virtual array type that applies a function to a value
before writing it to a span. One important detail is that this virtual
array can't tell the rest of the API that it's a span internally, or the
set functions will be bypassed.
The lower level accessors on CurvesGeometry do not have this
clamping, since they mostly have trusted inputs. In order to avoid
the performance cost with the attribute API, in the future a "trusted"
argument could be added to receive a regular "span" virtual array.