Cleanup: Refactor spline copying functions

Make the virtual functions protected and simpler, so that the logic is
better contained in the base class's implementation. Also introduce a
`copy_without_attributes` method to be used for realizing instances.
This commit is contained in:
2021-06-22 11:32:50 -05:00
parent 026de343e3
commit f3eecfe386
7 changed files with 104 additions and 40 deletions

View File

@@ -329,7 +329,7 @@ static SplinePtr subdivide_spline(const Spline &spline,
* 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());
SplinePtr new_spline = spline.copy_settings();
SplinePtr new_spline = spline.copy_only_settings();
new_spline->resize(result_size);
subdivide_builtin_attributes(spline, offsets, *new_spline);
subdivide_dynamic_attributes(spline, offsets, *new_spline);

View File

@@ -120,7 +120,7 @@ static void copy_dynamic_attributes(const CustomDataAttributes &src,
static SplinePtr spline_delete(const Spline &spline, const IndexMask mask)
{
SplinePtr new_spline = spline.copy_settings();
SplinePtr new_spline = spline.copy_only_settings();
new_spline->resize(mask.size());
spline_copy_builtin_attributes(spline, *new_spline, mask);