Do not show intermediate states in objects list while reloading from disk

This commit is contained in:
Enrico Turri 2019-09-11 15:31:30 +02:00
parent 26f3af4b16
commit c55a463c93

View file

@ -1936,6 +1936,7 @@ private:
* */
std::string m_last_fff_printer_profile_name;
std::string m_last_sla_printer_profile_name;
bool m_update_objects_list_on_loading{ true };
};
const std::regex Plater::priv::pattern_bundle(".*[.](amf|amf[.]xml|zip[.]amf|3mf|prusa)", std::regex::icase);
@ -2460,8 +2461,11 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
_(L("Object too large?")));
}
for (const size_t idx : obj_idxs) {
wxGetApp().obj_list()->add_object_to_list(idx);
if (m_update_objects_list_on_loading)
{
for (const size_t idx : obj_idxs) {
wxGetApp().obj_list()->add_object_to_list(idx);
}
}
update();
@ -3095,6 +3099,9 @@ void Plater::priv::reload_from_disk()
// disable render to avoid to show intermediate states
view3D->get_canvas3d()->enable_render(false);
// disable update of objects list while loading to avoid to show intermediate states
m_update_objects_list_on_loading = false;
const auto new_idxs = load_files(input_paths, true, false);
if (new_idxs.empty())
{
@ -3103,12 +3110,6 @@ void Plater::priv::reload_from_disk()
return;
}
// temporary removes the new objects from the list
for (const auto idx : new_idxs)
{
wxGetApp().obj_list()->delete_object_from_list(idx);
}
for (const auto idx : new_idxs)
{
ModelObject *object = model.objects[idx];
@ -3137,7 +3138,10 @@ void Plater::priv::reload_from_disk()
// XXX: Restore more: layer_height_ranges, layer_height_profile (?)
}
// puts the updated objects back into the list
// re-enable update of objects list
m_update_objects_list_on_loading = true;
// puts the new objects into the list
for (const auto idx : new_idxs)
{
wxGetApp().obj_list()->add_object_to_list(idx);