ENH: bootup: add slow bootup mode to avoid some possible crash on seldom computers

Change-Id: Ia7a05082eee32dcc8a2ed9ca47cf13287ee2aed9
This commit is contained in:
lane.wei 2022-11-18 14:36:34 +08:00 committed by Lane.Wei
parent 2aedc84586
commit d40f9b24ed
3 changed files with 19 additions and 12 deletions

View file

@ -995,7 +995,12 @@ void GUI_App::post_init()
}
}
}
#if BBL_HAS_FIRST_PAGE
//#if BBL_HAS_FIRST_PAGE
bool slow_bootup = false;
if (app_config->get("slow_bootup") == "true") {
slow_bootup = true;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", slow bootup, won't render gl here.";
}
if (!switch_to_3d) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", begin load_gl_resources";
mainframe->Freeze();
@ -1016,17 +1021,19 @@ void GUI_App::post_init()
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init imgui frame";
plater_->canvas3D()->enable_render(true);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", start to render a first frame for test";
if (!slow_bootup) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", start to render a first frame for test";
plater_->canvas3D()->render(false);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished rendering a first frame for test";
}
if (is_editor())
mainframe->select_tab(size_t(0));
mainframe->Thaw();
plater_->trigger_restore_project(1);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", end load_gl_resources";
}
#endif
//#endif
//BBS: remove GCodeViewer as seperate APP logic
/*if (this->init_params->start_as_gcodeviewer) {
@ -2342,7 +2349,7 @@ bool GUI_App::on_init_inner()
mainframe->Show(true);
BOOST_LOG_TRIVIAL(info) << "main frame firstly shown";
#if BBL_HAS_FIRST_PAGE
//#if BBL_HAS_FIRST_PAGE
//BBS: set tp3DEditor firstly
/*plater_->canvas3D()->enable_render(false);
mainframe->select_tab(size_t(MainFrame::tp3DEditor));
@ -2358,9 +2365,9 @@ bool GUI_App::on_init_inner()
plater_->canvas3D()->render();
if (is_editor())
mainframe->select_tab(size_t(0));*/
#else
plater_->trigger_restore_project(1);
#endif
//#else
//plater_->trigger_restore_project(1);
//#endif
obj_list()->set_min_height();

View file

@ -25,7 +25,7 @@
#include <mutex>
#include <stack>
#define BBL_HAS_FIRST_PAGE 1
//#define BBL_HAS_FIRST_PAGE 1
#define STUDIO_INACTIVE_TIMEOUT 15*60*1000
#define LOG_FILES_MAX_NUM 30
#define TIMEOUT_CONNECT 15

View file

@ -5036,7 +5036,7 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
}
wxPanel* old_panel = current_panel;
#if BBL_HAS_FIRST_PAGE
//#if BBL_HAS_FIRST_PAGE
if (!old_panel) {
//BBS: only switch to the first panel when visible
panel->Show();
@ -5044,7 +5044,7 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
if (!panel->IsShownOnScreen())
return;
}
#endif
//#endif
current_panel = panel;
//BBS: add the collapse logic
if (current_panel == preview && q->only_gcode_mode()) {