ObjectList::paste_objects_into_list() refactored to call front end / back end synchronization and scene refresh only once

This commit is contained in:
Enrico Turri 2019-04-15 15:40:40 +02:00
parent d8f28bc31a
commit 8235ad2b02
3 changed files with 35 additions and 3 deletions

View file

@ -3714,6 +3714,36 @@ void Plater::changed_object(int obj_idx)
this->p->schedule_background_process();
}
void Plater::changed_objects(const std::vector<size_t>& object_idxs)
{
if (object_idxs.empty())
return;
auto list = wxGetApp().obj_list();
wxASSERT(list != nullptr);
if (list == nullptr)
return;
if (list->is_parts_changed()) {
for (int obj_idx : object_idxs)
{
if (obj_idx < p->model.objects.size())
// recenter and re - align to Z = 0
p->model.objects[obj_idx]->ensure_on_bed();
}
if (this->p->printer_technology == ptSLA) {
// Update the SLAPrint from the current Model, so that the reload_scene()
// pulls the correct data, update the 3D scene.
this->p->update_restart_background_process(true, false);
}
else
p->view3D->reload_scene(false);
}
// update print
this->p->schedule_background_process();
}
void Plater::schedule_background_process()
{
this->p->schedule_background_process();