mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fix of #2548
This commit is contained in:
parent
5320ed9374
commit
ac82cbe0cc
3 changed files with 82 additions and 4 deletions
|
@ -1260,6 +1260,7 @@ struct Plater::priv
|
|||
Preview *preview;
|
||||
|
||||
BackgroundSlicingProcess background_process;
|
||||
bool suppressed_backround_processing_update { false };
|
||||
|
||||
// A class to handle UI jobs like arranging and optimizing rotation.
|
||||
// These are not instant jobs, the user has to be informed about their
|
||||
|
@ -1694,7 +1695,11 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
panels.push_back(preview);
|
||||
|
||||
this->background_process_timer.SetOwner(this->q, 0);
|
||||
this->q->Bind(wxEVT_TIMER, [this](wxTimerEvent &evt) { this->update_restart_background_process(false, false); });
|
||||
this->q->Bind(wxEVT_TIMER, [this](wxTimerEvent &evt)
|
||||
{
|
||||
if (!this->suppressed_backround_processing_update)
|
||||
this->update_restart_background_process(false, false);
|
||||
});
|
||||
|
||||
update();
|
||||
|
||||
|
@ -4176,9 +4181,25 @@ void Plater::changed_objects(const std::vector<size_t>& object_idxs)
|
|||
this->p->schedule_background_process();
|
||||
}
|
||||
|
||||
void Plater::schedule_background_process()
|
||||
void Plater::schedule_background_process(bool schedule/* = true*/)
|
||||
{
|
||||
this->p->schedule_background_process();
|
||||
if (schedule)
|
||||
this->p->schedule_background_process();
|
||||
|
||||
this->p->suppressed_backround_processing_update = false;
|
||||
}
|
||||
|
||||
bool Plater::is_background_process_running() const
|
||||
{
|
||||
return this->p->background_process_timer.IsRunning();
|
||||
}
|
||||
|
||||
void Plater::suppress_background_process(const bool stop_background_process)
|
||||
{
|
||||
if (stop_background_process)
|
||||
this->p->background_process_timer.Stop();
|
||||
|
||||
this->p->suppressed_backround_processing_update = true;
|
||||
}
|
||||
|
||||
void Plater::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/) { p->fix_through_netfabb(obj_idx, vol_idx); }
|
||||
|
@ -4254,4 +4275,15 @@ bool Plater::can_copy_to_clipboard() const
|
|||
return true;
|
||||
}
|
||||
|
||||
SuppressBackgroundProcessingUpdate::SuppressBackgroundProcessingUpdate() :
|
||||
m_was_running(wxGetApp().plater()->is_background_process_running())
|
||||
{
|
||||
wxGetApp().plater()->suppress_background_process(m_was_running);
|
||||
}
|
||||
|
||||
SuppressBackgroundProcessingUpdate::~SuppressBackgroundProcessingUpdate()
|
||||
{
|
||||
wxGetApp().plater()->schedule_background_process(m_was_running);
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue