Curves: Don't allow resolutions less than 1

While this worked, the result for curves with a resolution of zero was
just a single evaluated point, which isn't useful or intuitive. Using
the attribute validation from 8934f00ac5, make sure users
can't set values 0 or less.
This commit is contained in:
Hans Goudey
2022-09-17 21:12:04 -05:00
parent 0bdb5239c1
commit 641bbc820f
2 changed files with 2 additions and 2 deletions

View File

@@ -218,7 +218,7 @@ class CurvesGeometry : public ::CurvesGeometry {
/**
* How many evaluated points to create for each segment when evaluating Bezier,
* Catmull Rom, and NURBS curves. On the curve domain. Values must be zero or greater.
* Catmull Rom, and NURBS curves. On the curve domain. Values must be one or greater.
*/
VArray<int> resolution() const;
/** Mutable access to curve resolution. Call #tag_topology_changed after changes. */

View File

@@ -548,7 +548,7 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
static const fn::CustomMF_SI_SO<int, int> resolution_clamp{
"Resolution Validate",
[](int value) { return std::max<int>(value, 0); },
[](int value) { return std::max<int>(value, 1); },
fn::CustomMF_presets::AllSpanOrSingle()};
static BuiltinCustomDataLayerProvider resolution("resolution",
ATTR_DOMAIN_CURVE,