Don't let UI jobs overlap.

This commit is contained in:
tamasmeszaros 2021-11-30 12:06:28 +01:00
parent ef059404b3
commit 86afffa692
4 changed files with 20 additions and 5 deletions

View File

@ -553,9 +553,15 @@ GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(ImGuiWrapper * imgui,
auto btn_txt_sz = ImGui::CalcTextSize(btn_txt.c_str());
ImVec2 button_sz = {btn_txt_sz.x + padding.x, btn_txt_sz.y + padding.y};
ImGui::SetCursorPosX(padding.x + sz.x - button_sz.x);
if (wxGetApp().plater()->is_any_job_running())
imgui->disabled_begin(true);
if ( imgui->button(btn_txt) ) {
wxGetApp().plater()->optimize_rotation();
}
imgui->disabled_end();
}
GLGizmoRotate3D::RotoptimzeWindow::~RotoptimzeWindow()

View File

@ -1203,7 +1203,7 @@ void MainFrame::init_menubar_as_editor()
append_menu_item(import_menu, wxID_ANY, _L("Import SL1 / SL1S archive") + dots, _L("Load an SL1 / Sl1S archive"),
[this](wxCommandEvent&) { if (m_plater) m_plater->import_sl1_archive(); }, "import_plater", nullptr,
[this](){return m_plater != nullptr; }, this);
[this](){return m_plater != nullptr && !m_plater->is_any_job_running(); }, this);
import_menu->AppendSeparator();
append_menu_item(import_menu, wxID_ANY, _L("Import &Config") + dots + "\tCtrl+L", _L("Load exported configuration file"),

View File

@ -5082,7 +5082,8 @@ void Plater::add_model(bool imperial_units/* = false*/)
void Plater::import_sl1_archive()
{
p->m_ui_jobs.import_sla_arch();
if (!p->m_ui_jobs.is_any_running())
p->m_ui_jobs.import_sla_arch();
}
void Plater::extract_config_from_project()
@ -5366,6 +5367,11 @@ void Plater::update() { p->update(); }
void Plater::stop_jobs() { p->m_ui_jobs.stop_all(); }
bool Plater::is_any_job_running() const
{
return p->m_ui_jobs.is_any_running();
}
void Plater::update_ui_from_settings() { p->update_ui_from_settings(); }
void Plater::select_view(const std::string& direction) { p->select_view(direction); }
@ -5514,7 +5520,8 @@ void Plater::set_number_of_copies(/*size_t num*/)
void Plater::fill_bed_with_instances()
{
p->m_ui_jobs.fill_bed();
if (!p->m_ui_jobs.is_any_running())
p->m_ui_jobs.fill_bed();
}
bool Plater::is_selection_empty() const
@ -6394,7 +6401,8 @@ GLCanvas3D* Plater::get_current_canvas3D()
void Plater::arrange()
{
p->m_ui_jobs.arrange();
if (!p->m_ui_jobs.is_any_running())
p->m_ui_jobs.arrange();
}
void Plater::set_current_canvas_as_dirty()
@ -6565,7 +6573,7 @@ void Plater::suppress_background_process(const bool stop_background_process)
void Plater::mirror(Axis axis) { p->mirror(axis); }
void Plater::split_object() { p->split_object(); }
void Plater::split_volume() { p->split_volume(); }
void Plater::optimize_rotation() { p->m_ui_jobs.optimize_rotation();}
void Plater::optimize_rotation() { if (!p->m_ui_jobs.is_any_running()) p->m_ui_jobs.optimize_rotation(); }
void Plater::update_menus() { p->menus.update(); }
void Plater::show_action_buttons(const bool ready_to_slice) const { p->show_action_buttons(ready_to_slice); }

View File

@ -178,6 +178,7 @@ public:
void update();
void stop_jobs();
bool is_any_job_running() const;
void select_view(const std::string& direction);
void select_view_3D(const std::string& name);