Move show_substitutions_info() call into UI thread

This commit is contained in:
tamasmeszaros 2021-06-29 16:21:56 +02:00
parent 28472ee03f
commit 7c28de0f5a

View file

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