Fix for SPE-1822. Added "Apply to all..." checkbox for question dialog, when loading models looks like multiparts objects

This commit is contained in:
YuSanka 2023-08-29 17:02:36 +02:00
parent d652f15e48
commit 695c08e0e7

View File

@ -2469,6 +2469,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
int answer_convert_from_meters = wxOK_DEFAULT; int answer_convert_from_meters = wxOK_DEFAULT;
int answer_convert_from_imperial_units = wxOK_DEFAULT; int answer_convert_from_imperial_units = wxOK_DEFAULT;
int answer_consider_as_multi_part_objects = wxOK_DEFAULT;
bool in_temp = false; bool in_temp = false;
const fs::path temp_path = wxStandardPaths::Get().GetTempDir().utf8_str().data(); const fs::path temp_path = wxStandardPaths::Get().GetTempDir().utf8_str().data();
@ -2650,14 +2651,21 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
} }
if (model.looks_like_multipart_object()) { if (model.looks_like_multipart_object()) {
MessageDialog msg_dlg(q, _L( if (answer_consider_as_multi_part_objects == wxOK_DEFAULT) {
RichMessageDialog dlg(q, _L(
"This file contains several objects positioned at multiple heights.\n" "This file contains several objects positioned at multiple heights.\n"
"Instead of considering them as multiple objects, should \n" "Instead of considering them as multiple objects, should \n"
"the file be loaded as a single object having multiple parts?") + "\n", "the file be loaded as a single object having multiple parts?") + "\n",
_L("Multi-part object detected"), wxICON_WARNING | wxYES | wxNO); _L("Multi-part object detected"), wxICON_QUESTION | wxYES_NO);
if (msg_dlg.ShowModal() == wxID_YES) { dlg.ShowCheckBox(_L("Apply to all multiple objects being loaded."));
model.convert_multipart_object(nozzle_dmrs->values.size()); int answer = dlg.ShowModal();
if (dlg.IsCheckBoxChecked())
answer_consider_as_multi_part_objects = answer;
if (answer == wxID_YES)
model.convert_multipart_object(nozzle_dmrs->size());
} }
else if (answer_consider_as_multi_part_objects == wxID_YES)
model.convert_multipart_object(nozzle_dmrs->size());
} }
} }
if ((wxGetApp().get_mode() == comSimple) && (type_3mf || type_any_amf) && model_has_advanced_features(model)) { if ((wxGetApp().get_mode() == comSimple) && (type_3mf || type_any_amf) && model_has_advanced_features(model)) {