Merge branch 'tm_quickfix_slaimport' into stable

This commit is contained in:
tamasmeszaros 2021-06-29 17:08:12 +02:00
commit 1bf7b0866a

View File

@ -113,13 +113,14 @@ public:
Plater *plater; Plater *plater;
Sel sel = Sel::modelAndProfile; Sel sel = Sel::modelAndProfile;
TriangleMesh mesh; TriangleMesh mesh;
DynamicPrintConfig profile; DynamicPrintConfig profile;
wxString path; wxString path;
Vec2i win = {2, 2}; Vec2i win = {2, 2};
std::string err; std::string err;
ConfigSubstitutions config_substitutions;
priv(Plater *plt): plater{plt} {} priv(Plater *plt): plater{plt} {}
}; };
@ -139,27 +140,22 @@ void SLAImportJob::process()
if (p->path.empty()) return; if (p->path.empty()) return;
std::string path = p->path.ToUTF8().data(); std::string path = p->path.ToUTF8().data();
ConfigSubstitutions config_substitutions;
try { try {
switch (p->sel) { switch (p->sel) {
case Sel::modelAndProfile: case Sel::modelAndProfile:
config_substitutions = import_sla_archive(path, p->win, p->mesh, p->profile, progr); p->config_substitutions = import_sla_archive(path, p->win, p->mesh, p->profile, progr);
break; break;
case Sel::modelOnly: case Sel::modelOnly:
config_substitutions = import_sla_archive(path, p->win, p->mesh, progr); p->config_substitutions = import_sla_archive(path, p->win, p->mesh, progr);
break; break;
case Sel::profileOnly: case Sel::profileOnly:
config_substitutions = import_sla_archive(path, p->profile); p->config_substitutions = import_sla_archive(path, p->profile);
break; break;
} }
} catch (std::exception &ex) { } catch (std::exception &ex) {
p->err = ex.what(); p->err = ex.what();
} }
if (! config_substitutions.empty()) {
show_substitutions_info(config_substitutions, path);
}
update_status(100, was_canceled() ? _(L("Importing canceled.")) : update_status(100, was_canceled() ? _(L("Importing canceled.")) :
_(L("Importing done."))); _(L("Importing done.")));
@ -186,6 +182,7 @@ void SLAImportJob::prepare()
p->path = !nm.Exists(wxFILE_EXISTS_REGULAR) ? "" : path.ToUTF8(); p->path = !nm.Exists(wxFILE_EXISTS_REGULAR) ? "" : path.ToUTF8();
p->sel = dlg.get_selection(); p->sel = dlg.get_selection();
p->win = dlg.get_marchsq_windowsize(); p->win = dlg.get_marchsq_windowsize();
p->config_substitutions.clear();
} else { } else {
p->path = ""; p->path = "";
} }
@ -228,8 +225,11 @@ void SLAImportJob::finalize()
bool is_centered = false; bool is_centered = false;
p->plater->sidebar().obj_list()->load_mesh_object(p->mesh, name, is_centered); p->plater->sidebar().obj_list()->load_mesh_object(p->mesh, name, is_centered);
} }
if (! p->config_substitutions.empty())
show_substitutions_info(p->config_substitutions, p->path.ToUTF8().data());
reset(); reset();
} }
}} }} // namespace Slic3r::GUI