fix lack of refresh after gcode generation

(fix ca995447fbaebbd7185b19f53e435781c4653983)
using the slicing state callback to transmit when to refresh things.
supermerill/SuperSlicer#1533
supermerill/SuperSlicer#1532
supermerill/SuperSlicer#1591
This commit is contained in:
supermerill 2021-09-26 16:17:47 +02:00
parent d45c92c6fb
commit c08429cb78
4 changed files with 15 additions and 2 deletions

View File

@ -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();

View File

@ -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.

View File

@ -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;

View File

@ -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"