Fixed update of PrintRegions after removing an object.

The bug has been introduced during recent PrintRegion refactoring.
This commit is contained in:
Vojtech Bubnik 2021-05-14 11:52:33 +02:00
parent e0dd7edb21
commit 221af991c2

View file

@ -372,6 +372,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
std::set<ModelObjectStatus> model_object_status;
// 1) Synchronize model objects.
bool print_regions_reshuffled = false;
if (model.id() != m_model.id()) {
// Kill everything, initialize from scratch.
// Stop background processing.
@ -383,6 +384,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
delete object;
}
m_objects.clear();
print_regions_reshuffled = true;
m_model.assign_copy(model);
for (const ModelObject *model_object : m_model.objects)
model_object_status.emplace(model_object->id(), ModelObjectStatus::New);
@ -462,6 +464,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
}
for (ModelObject *model_object : model_objects_old)
delete model_object;
print_regions_reshuffled = true;
}
}
}
@ -595,7 +598,6 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
}
// 4) Generate PrintObjects from ModelObjects and their instances.
bool print_regions_reshuffled = false;
{
PrintObjectPtrs print_objects_new;
print_objects_new.reserve(std::max(m_objects.size(), m_model.objects.size()));