Fix of #9809: Crash after splitting an object into parts.

Now after splitting an object into parts, custom supports, seams, and multimaterial painting are removed, and the user is notified about it.

Also, this commit fixed the text of the notification about removing custom supports, seams, and multimaterial painting by Simplify gizmo. And it also fixed that info about custom supports, seams, and multimaterial painting was still shown in the right panel after the model simplification event when custom supports, seams, and multimaterial were removed.
This commit is contained in:
Lukáš Hejl 2023-02-21 13:48:16 +01:00
parent a41dd8eeed
commit db60d23c18
4 changed files with 22 additions and 6 deletions

View File

@ -2175,6 +2175,10 @@ void ObjectList::split()
take_snapshot(_(L("Split to Parts")));
// Before splitting volume we have to remove all custom supports, seams, and multimaterial painting.
wxGetApp().plater()->clear_before_change_mesh(obj_idx, _u8L("Custom supports, seams and multimaterial painting were "
"removed after splitting the object."));
volume->split(nozzle_dmrs_cnt);
(*m_objects)[obj_idx]->input_file.clear();
@ -2186,6 +2190,10 @@ void ObjectList::split()
changed_object(obj_idx);
// update printable state for new volumes on canvas3D
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_object(obj_idx);
// After removing custom supports, seams, and multimaterial painting, we have to update info about the object to remove information about
// custom supports, seams, and multimaterial painting in the right panel.
wxGetApp().obj_list()->update_info_items(obj_idx);
}
void ObjectList::merge(bool to_multipart_object)
@ -4682,7 +4690,8 @@ void ObjectList::fix_through_netfabb()
msg += "\n";
}
plater->clear_before_change_mesh(obj_idx);
plater->clear_before_change_mesh(obj_idx, _u8L("Custom supports, seams and multimaterial painting were "
"removed after repairing the mesh."));
std::string res;
if (!fix_model_by_win10_sdk_gui(*(object(obj_idx)), vol_idx, progress_dlg, msg, res))
return false;

View File

@ -540,7 +540,11 @@ void GLGizmoSimplify::apply_simplify() {
const Selection& selection = m_parent.get_selection();
auto plater = wxGetApp().plater();
plater->take_snapshot(_u8L("Simplify ") + create_volumes_name(m_volume_ids, selection));
plater->clear_before_change_mesh(selection.get_object_idx());
plater->clear_before_change_mesh(selection.get_object_idx(), _u8L("Custom supports, seams and multimaterial painting were "
"removed after simplifying the mesh."));
// After removing custom supports, seams, and multimaterial painting, we have to update info about the object to remove information about
// custom supports, seams, and multimaterial painting in the right panel.
wxGetApp().obj_list()->update_info_items(selection.get_object_idx());
for (const auto &item: m_state.result) {
const ObjectID &id = item.first;

View File

@ -3127,6 +3127,10 @@ void Plater::priv::split_object()
Model new_model = model;
ModelObject* current_model_object = new_model.objects[obj_idx];
// Before splitting object we have to remove all custom supports, seams, and multimaterial painting.
wxGetApp().plater()->clear_before_change_mesh(obj_idx, _u8L("Custom supports, seams and multimaterial painting were "
"removed after splitting the object."));
wxBusyCursor wait;
ModelObjectPtrs new_objects;
current_model_object->split(&new_objects);
@ -7338,7 +7342,7 @@ bool Plater::set_printer_technology(PrinterTechnology printer_technology)
return ret;
}
void Plater::clear_before_change_mesh(int obj_idx)
void Plater::clear_before_change_mesh(int obj_idx, const std::string &notification_msg)
{
ModelObject* mo = model().objects[obj_idx];
@ -7356,8 +7360,7 @@ void Plater::clear_before_change_mesh(int obj_idx)
get_notification_manager()->push_notification(
NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("Custom supports, seams and multimaterial painting were "
"removed after repairing the mesh."));
notification_msg);
// _u8L("Undo the repair"),
// [this, snapshot_time](wxEvtHandler*){
// // Make sure the snapshot is still available and that

View File

@ -273,7 +273,7 @@ public:
void reslice_FFF_until_step(PrintObjectStep step, const ModelObject &object, bool postpone_error_messages = false);
void reslice_SLA_until_step(SLAPrintObjectStep step, const ModelObject &object, bool postpone_error_messages = false);
void clear_before_change_mesh(int obj_idx);
void clear_before_change_mesh(int obj_idx, const std::string &notification_msg);
void changed_mesh(int obj_idx);
void changed_object(int obj_idx);