Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-18 05:12:04 +0300
committerHans Goudey <h.goudey@me.com>2022-09-18 05:12:25 +0300
commit641bbc820f94668aa0e5beb972d1368475041cc4 (patch)
tree899712f5500756f154e2b34a93f7acf7e2342728 /source/blender/blenkernel
parent0bdb5239c1a55e72adf3d3d7c491df3d86cd0b09 (diff)
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 8934f00ac5701ea34, make sure users can't set values 0 or less.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_curves.hh2
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curves.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 6758e5c268b..b1581e93491 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -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. */
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc
index d8cfe1374dc..4ace68546ac 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -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,