[Bf-blender-cvs] [641bbc820f9] master: Curves: Don't allow resolutions less than 1
Hans Goudey
noreply at git.blender.org
Sun Sep 18 04:12:35 CEST 2022
Commit: 641bbc820f94668aa0e5beb972d1368475041cc4
Author: Hans Goudey
Date: Sat Sep 17 21:12:04 2022 -0500
Branches: master
https://developer.blender.org/rB641bbc820f94668aa0e5beb972d1368475041cc4
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.
===================================================================
M source/blender/blenkernel/BKE_curves.hh
M source/blender/blenkernel/intern/geometry_component_curves.cc
===================================================================
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,
More information about the Bf-blender-cvs
mailing list