diff options
author | Hans Goudey <h.goudey@me.com> | 2021-10-23 01:13:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-10-23 01:13:26 +0300 |
commit | 1d9e2dc954ff837737c0bbc00ef8ae4b841f2427 (patch) | |
tree | c84fa6f67a10926d97461249685eaeae28dfa081 /source/blender/nodes | |
parent | cfc64261c12e90bf3219cb377d4fe7c008407850 (diff) |
Fix: Cyclic single point bezier splines have multiple evaluated points
Because `segment_is_vector` didn't handle the combined cyclic and
single control point case, it returned false, that the "segment" should
have the resolution evaluated point count. To avoid checking the size in
every call, add an assert for the size and check it elsewhere.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/legacy/node_geo_curve_subdivide.cc | 8 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_curve_subdivide.cc index f32a68bc042..61165902028 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_curve_subdivide.cc @@ -308,8 +308,12 @@ static SplinePtr subdivide_spline(const Spline &spline, const VArray<int> &cuts, const int spline_offset) { - /* Since we expect to access each value many times, it should be worth it to make sure the - * attribute is a real span (especially considering the note below). Using the offset at each + if (spline.size() <= 1) { + return spline.copy(); + } + + /* Since we expect to access each value many times, it should be worth it to make sure count + * of cuts is a real span (especially considering the note below). Using the offset at each * point facilitates subdividing in parallel later. */ Array<int> offsets = get_subdivided_offsets(spline, cuts, spline_offset); const int result_size = offsets.last() + int(!spline.is_cyclic()); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc index a856d593bc2..5a79fcffd4d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc @@ -283,8 +283,12 @@ static SplinePtr subdivide_spline(const Spline &spline, const VArray<int> &cuts, const int spline_offset) { - /* Since we expect to access each value many times, it should be worth it to make sure the - * attribute is a real span (especially considering the note below). Using the offset at each + if (spline.size() <= 1) { + return spline.copy(); + } + + /* Since we expect to access each value many times, it should be worth it to make sure count + * of cuts is a real span (especially considering the note below). Using the offset at each * point facilitates subdividing in parallel later. */ Array<int> offsets = get_subdivided_offsets(spline, cuts, spline_offset); const int result_size = offsets.last() + int(!spline.is_cyclic()); |