Separated Print / PrintObject into PrintBase.cpp/h to support SLAPrint

This commit is contained in:
bubnikv 2018-11-08 14:23:17 +01:00
parent 6d60ecffa0
commit c2e46350f2
15 changed files with 433 additions and 406 deletions

View file

@ -178,6 +178,14 @@ bool BackgroundSlicingProcess::stop()
return true;
}
bool BackgroundSlicingProcess::reset()
{
bool stopped = this->stop();
this->reset_export();
m_print->clear();
return stopped;
}
// To be called by Print::apply() through the Print::m_cancel_callback to stop the background
// processing before changing any data of running or finalized milestones.
// This function shall not trigger any UI update through the wxWidgets event.

View file

@ -43,6 +43,9 @@ public:
// Cancel the background processing. Returns false if the background processing was not running.
// A stopped background processing may be restarted with start().
bool stop();
// Cancel the background processing and reset the print. Returns false if the background processing was not running.
// Useful when the Model or configuration is being changed drastically.
bool reset();
// Apply config over the print. Returns false, if the new config values caused any of the already
// processed steps to be invalidated, therefore the task will need to be restarted.

View file

@ -1434,8 +1434,9 @@ void Plater::priv::reset()
if (_3DScene::is_layers_editing_enabled(canvas3D))
_3DScene::enable_layers_editing(canvas3D, false);
// Stop and reset the Print content.
this->background_process.reset();
model.clear_objects();
// print.clear_objects();
// Delete all objects from list on c++ side
sidebar->obj_list()->delete_all_objects_from_list();
@ -2001,10 +2002,8 @@ void Plater::decrease_instances(size_t num)
ModelObject* model_object = p->model.objects[obj_idx];
if (model_object->instances.size() > num) {
for (size_t i = 0; i < num; i++) {
for (size_t i = 0; i < num; ++ i)
model_object->delete_last_instance();
// p->print.get_object(obj_idx)->delete_last_copy();
}
sidebar().obj_list()->decrease_object_instances(obj_idx, num);
}
else {