Removed an obscure "clip_multipart_objects" option, which caused more

harm than good and it is not compatible with the new layer island
Z graph.
Partial fix of #9679
This commit is contained in:
Vojtech Bubnik 2023-02-16 16:23:03 +01:00
parent b2138dd348
commit edd6c7c9d9
6 changed files with 24 additions and 43 deletions

View file

@ -237,9 +237,6 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
const PrintObjectRegions &print_object_regions,
const std::vector<float> &zs,
std::vector<VolumeSlices> &&volume_slices,
// If clipping is disabled, then ExPolygons produced by different volumes will never be merged, thus they will be allowed to overlap.
// It is up to the model designer to handle these overlaps.
const bool clip_multipart_objects,
const std::function<void()> &throw_on_cancel_callback)
{
model_volumes_sort_by_id(model_volumes);
@ -308,7 +305,7 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
}
tbb::parallel_for(
tbb::blocked_range<size_t>(0, zs_complex.size()),
[&slices_by_region, &print_object_regions, &zs_complex, &layer_ranges_regions_to_slices, clip_multipart_objects, &throw_on_cancel_callback]
[&slices_by_region, &print_object_regions, &zs_complex, &layer_ranges_regions_to_slices, &throw_on_cancel_callback]
(const tbb::blocked_range<size_t> &range) {
float z = zs_complex[range.begin()].second;
auto it_layer_range = layer_range_first(print_object_regions.layer_ranges, z);
@ -359,7 +356,7 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
if (next_region_same_modifier)
// To be used in the following iteration.
temp_slices[idx_region + 1].expolygons = std::move(source);
} else if ((region.model_volume->is_model_part() && clip_multipart_objects) || region.model_volume->is_negative_volume()) {
} else if (region.model_volume->is_model_part() || region.model_volume->is_negative_volume()) {
// Clip every non-zero region preceding it.
for (int idx_region2 = 0; idx_region2 < idx_region; ++ idx_region2)
if (! temp_slices[idx_region2].expolygons.empty()) {
@ -388,10 +385,7 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
merged = true;
}
}
// Don't unite the regions if ! clip_multipart_objects. In that case it is user's responsibility
// to handle region overlaps. Indeed, one may intentionally let the regions overlap to produce crossing perimeters
// for example.
if (merged && clip_multipart_objects)
if (merged)
expolygons = closing_ex(expolygons, float(scale_(EPSILON)));
slices_by_region[temp_slices[i].region_id][z_idx] = std::move(expolygons);
i = j;
@ -696,7 +690,6 @@ void PrintObject::slice_volumes()
slice_volumes_inner(
print->config(), this->config(), this->trafo_centered(),
this->model_object()->volumes, m_shared_regions->layer_ranges, slice_zs, throw_on_cancel_callback),
m_config.clip_multipart_objects,
throw_on_cancel_callback);
for (size_t region_id = 0; region_id < region_slices.size(); ++ region_id) {