FIX:repairing models during cutting allows cancellation

Jira: STUDIO-6308
Change-Id: I217a8e55c0d5fdcc29a33c7e7c3401cc08307561
This commit is contained in:
zhou.xu 2024-03-06 14:57:13 +08:00 committed by Lane.Wei
parent 210cd5a4fe
commit 983aca7669
2 changed files with 9 additions and 2 deletions

View File

@ -320,9 +320,13 @@ const ModelObjectPtrs &Cut::perform_with_plane()
mo->clone_for_cut(&upper);
ModelObject *lower{nullptr};
if (m_attributes.has(ModelObjectCutAttribute::KeepLower) && !m_attributes.has(ModelObjectCutAttribute::CutToParts))
if (m_attributes.has(ModelObjectCutAttribute::KeepLower) && !m_attributes.has(ModelObjectCutAttribute::CutToParts))
mo->clone_for_cut(&lower);
if (upper && lower &&!m_attributes.has(ModelObjectCutAttribute::CutToParts)) {
upper->name = upper->name + "_A";
lower->name = lower->name + "_B";
}
std::vector<ModelObject *> dowels;
// Because transformations are going to be applied to meshes directly,

View File

@ -904,6 +904,7 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection)
if (is_windows10()) {
bool is_showed_dialog = false;
bool user_fix_model = false;
Plater::TakeSnapshot snapshot(plater, "RepairingModelObjectInCut");
for (size_t i = 0; i < new_objects.size(); i++) {
for (size_t j = 0; j < new_objects[i]->volumes.size(); j++) {
if (its_num_open_edges(new_objects[i]->volumes[j]->mesh().its) > 0) {
@ -928,7 +929,8 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection)
wxString msg = _L("Repairing model object");
msg += ": " + from_u8(model_name) + "\n";
std::string res;
if (!fix_model_by_win10_sdk_gui(*model_object, vol_idx, progress_dlg, msg, res)) return false;
if (!fix_model_by_win10_sdk_gui(*model_object, vol_idx, progress_dlg, msg, res))
return false;
return true;
};
ProgressDialog progress_dlg(_L("Repairing model object"), "", 100, find_toplevel_parent(plater), wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT, true);
@ -936,6 +938,7 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection)
auto model_name = new_objects[i]->name;
if (!fix_and_update_progress(new_objects[i], j, model_name, progress_dlg, succes_models, failed_models)) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "run fix_and_update_progress error";
plater->take_snapshot("RepairingModelObjectInCut");
};
};
}