diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 2ee128c92..d7acc3ec4 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -721,6 +721,8 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessor::Result* re BOOST_LOG_TRIVIAL(info) << "Exporting G-code finished" << log_memory_info(); print->set_done(psGCodeExport); + //notify gui that the gcode is ready to be drawed + print->set_status(100, L("Gcode done"), PrintBase::SlicingStatus::FlagBits::GCODE_ENDED); // Write the profiler measurements to file PROFILE_UPDATE(); diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index b83a6bf57..ab46f5cf9 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1794,6 +1794,7 @@ void Print::auto_assign_extruders(ModelObject* model_object) const void Print::process() { name_tbb_thread_pool_threads(); + bool something_done = !is_step_done_unguarded(psBrim); BOOST_LOG_TRIVIAL(info) << "Starting the slicing process." << log_memory_info(); for (PrintObject *obj : m_objects) @@ -1934,6 +1935,9 @@ void Print::process() this->set_done(psBrim); } BOOST_LOG_TRIVIAL(info) << "Slicing process finished." << log_memory_info(); + //notify gui that the slicing/preview structs are ready to be drawed + if (something_done) + this->set_status(90, L("Slicing done"), SlicingStatus::FlagBits::SLICING_ENDED); } // G-code export process, running at a background thread. diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index aecb43089..a2db978fc 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -407,7 +407,9 @@ public: RELOAD_SLA_PREVIEW = 1 << 3, // UPDATE_PRINT_STEP_WARNINGS is mutually exclusive with UPDATE_PRINT_OBJECT_STEP_WARNINGS. UPDATE_PRINT_STEP_WARNINGS = 1 << 4, - UPDATE_PRINT_OBJECT_STEP_WARNINGS = 1 << 5 + UPDATE_PRINT_OBJECT_STEP_WARNINGS = 1 << 5, + SLICING_ENDED = 1 << 6, + GCODE_ENDED = 1 << 7 }; // Bitmap of FlagBits unsigned int flags; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a3e099e5a..833adb391 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3668,6 +3668,12 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) { + //update dirty flags + if (0 != (evt.status.flags & Slic3r::PrintBase::SlicingStatus::FlagBits::SLICING_ENDED)) + preview->get_canvas3d()->set_preview_dirty(); + if (0 != (evt.status.flags & Slic3r::PrintBase::SlicingStatus::FlagBits::GCODE_ENDED)) + preview->get_canvas3d()->set_gcode_viewer_dirty(); + if (evt.status.percent >= -1) { if (m_ui_jobs.is_any_running()) { // Avoid a race condition @@ -3745,7 +3751,6 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) void Plater::priv::on_slicing_completed(wxCommandEvent & evt) { - preview->get_canvas3d()->set_gcode_viewer_dirty(); // auto_switch_preview == 0 means "no force tab change" // auto_switch_preview == 1 means "force tab change" // auto_switch_preview == 2 means "force tab change only if already on a plater one"