diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-30 07:39:03 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-30 07:39:03 +0300 |
commit | e26c89cd767ce0f14a52ee112e1124a092744c10 (patch) | |
tree | 02447d9a56e543d97487c3783b4fb1e4070cbf18 /source/blender/blenkernel/intern/curve_catmull_rom.cc | |
parent | e74880a659270c91db721e9490a2fe15df837760 (diff) |
Fix: Failing curves test after recent commit
87e9451d660e8288d missed updating the behavior for Catmull Rom curves.
Diffstat (limited to 'source/blender/blenkernel/intern/curve_catmull_rom.cc')
-rw-r--r-- | source/blender/blenkernel/intern/curve_catmull_rom.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/curve_catmull_rom.cc b/source/blender/blenkernel/intern/curve_catmull_rom.cc index ea3672dd56b..2db183eea3e 100644 --- a/source/blender/blenkernel/intern/curve_catmull_rom.cc +++ b/source/blender/blenkernel/intern/curve_catmull_rom.cc @@ -13,7 +13,7 @@ int calculate_evaluated_size(const int points_num, const bool cyclic, const int { const int eval_size = resolution * curve_segment_size(points_num, cyclic); /* If the curve isn't cyclic, one last point is added to the final point. */ - return (cyclic && points_num > 2) ? eval_size : eval_size + 1; + return cyclic ? eval_size : eval_size + 1; } /* Adapted from Cycles #catmull_rom_basis_eval function. */ @@ -58,8 +58,14 @@ static void interpolate_to_evaluated(const Span<T> src, return; } if (src.size() == 2) { - evaluate_segment(src.first(), src.first(), src.last(), src.last(), dst); - dst.last() = src.last(); + evaluate_segment(src.first(), src.first(), src.last(), src.last(), dst.take_front(resolution)); + if (cyclic) { + evaluate_segment( + src.last(), src.last(), src.first(), src.first(), dst.take_back(resolution)); + } + else { + dst.last() = src.last(); + } return; } |