Fixed regression bug after PrintRegions refactoring:

Fixed crash if an object is outside the print bed, its modifier inside
the print bed and the modifier gets deleted.
This commit is contained in:
Vojtech Bubnik 2021-06-11 17:29:16 +02:00
parent 6bade1b24a
commit 403bb926c8

View file

@ -1080,7 +1080,8 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
if (solid_or_modifier_differ || model_origin_translation_differ || layer_height_ranges_differ ||
! model_object.layer_height_profile.timestamp_matches(model_object_new.layer_height_profile)) {
// The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects.
model_object_status.print_object_regions_status = model_origin_translation_differ || layer_height_ranges_differ ?
model_object_status.print_object_regions_status =
model_object_status.print_object_regions == nullptr || model_origin_translation_differ || layer_height_ranges_differ ?
// Drop print_objects_regions.
ModelObjectStatus::PrintObjectRegionsStatus::Invalid :
// Reuse bounding boxes of print_objects_regions for ModelVolumes with unmodified transformation.
@ -1092,7 +1093,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
if (model_object_status.print_object_regions_status == ModelObjectStatus::PrintObjectRegionsStatus::PartiallyValid)
// Drop everything from PrintObjectRegions but those VolumeExtents (of their particular ModelVolumes) that are still valid.
print_objects_regions_invalidate_keep_some_volumes(*model_object_status.print_object_regions, model_object.volumes, model_object_new.volumes);
else
else if (model_object_status.print_object_regions != nullptr)
model_object_status.print_object_regions->clear();
// Copy content of the ModelObject including its ID, do not change the parent.
model_object.assign_copy(model_object_new);