ENH: refine some small logic
1. continue post_init when gl window not ready under linux 2. use deleted_wipe_towers in reload_scene to judge whether it is deleted Change-Id: I5be2ac876842e5432d254d47e4fe31f066455106 (cherry picked from commit 5e61a21d5662ccc656136b6a219c2358364c36d9)
This commit is contained in:
parent
fe5629f0ed
commit
1fe0d7be8c
|
@ -2170,16 +2170,15 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||||
|
|
||||||
struct GLVolumeState {
|
struct GLVolumeState {
|
||||||
GLVolumeState() :
|
GLVolumeState() :
|
||||||
volume_idx(size_t(-1)), was_wipe_tower(0) {}
|
volume_idx(size_t(-1)) {}
|
||||||
GLVolumeState(const GLVolume* volume, unsigned int volume_idx) :
|
GLVolumeState(const GLVolume* volume, unsigned int volume_idx) :
|
||||||
composite_id(volume->composite_id), volume_idx(volume_idx), was_wipe_tower(volume->is_wipe_tower) {}
|
composite_id(volume->composite_id), volume_idx(volume_idx) {}
|
||||||
GLVolumeState(const GLVolume::CompositeID &composite_id) :
|
GLVolumeState(const GLVolume::CompositeID &composite_id) :
|
||||||
composite_id(composite_id), volume_idx(size_t(-1)), was_wipe_tower(0) {}
|
composite_id(composite_id), volume_idx(size_t(-1)) {}
|
||||||
|
|
||||||
GLVolume::CompositeID composite_id;
|
GLVolume::CompositeID composite_id;
|
||||||
// Volume index in the old GLVolume vector.
|
// Volume index in the old GLVolume vector.
|
||||||
size_t volume_idx;
|
size_t volume_idx;
|
||||||
bool was_wipe_tower;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// SLA steps to pull the preview meshes for.
|
// SLA steps to pull the preview meshes for.
|
||||||
|
@ -2388,8 +2387,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||||
// slow thing of seeing if they were in the deleted list, and if
|
// slow thing of seeing if they were in the deleted list, and if
|
||||||
// so, if they were a wipe tower.
|
// so, if they were a wipe tower.
|
||||||
bool was_deleted_wipe_tower = false;
|
bool was_deleted_wipe_tower = false;
|
||||||
for (int del_idx = 0; del_idx < deleted_volumes.size(); del_idx++) {
|
for (int del_idx = 0; del_idx < deleted_wipe_towers.size(); del_idx++) {
|
||||||
if (deleted_volumes[del_idx].volume_idx == temp_idx && deleted_volumes[del_idx].was_wipe_tower) {
|
if (deleted_wipe_towers[del_idx].volume_idx == temp_idx) {
|
||||||
was_deleted_wipe_tower = true;
|
was_deleted_wipe_tower = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1018,34 +1018,30 @@ void GUI_App::post_init()
|
||||||
plater_->select_view_3D("3D");
|
plater_->select_view_3D("3D");
|
||||||
//BBS init the opengl resource here
|
//BBS init the opengl resource here
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (!plater_->canvas3D()->get_wxglcanvas()->IsShownOnScreen() ||
|
if (plater_->canvas3D()->get_wxglcanvas()->IsShownOnScreen()&&plater_->canvas3D()->make_current_for_postinit()) {
|
||||||
!plater_->canvas3D()->make_current_for_postinit()) {
|
#endif
|
||||||
/* The canvas3d didn't actually exist (and therefore, there is
|
Size canvas_size = plater_->canvas3D()->get_canvas_size();
|
||||||
* no current EGL context) -- try again later, I guess.
|
wxGetApp().imgui()->set_display_size(static_cast<float>(canvas_size.get_width()), static_cast<float>(canvas_size.get_height()));
|
||||||
*/
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", start to init opengl";
|
||||||
m_post_initialized = false;
|
wxGetApp().init_opengl();
|
||||||
return;
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init opengl";
|
||||||
|
plater_->canvas3D()->init();
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init canvas3D";
|
||||||
|
wxGetApp().imgui()->new_frame();
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init imgui frame";
|
||||||
|
plater_->canvas3D()->enable_render(true);
|
||||||
|
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
#ifdef __linux__
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Size canvas_size = plater_->canvas3D()->get_canvas_size();
|
|
||||||
wxGetApp().imgui()->set_display_size(static_cast<float>(canvas_size.get_width()), static_cast<float>(canvas_size.get_height()));
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", start to init opengl";
|
|
||||||
wxGetApp().init_opengl();
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init opengl";
|
|
||||||
plater_->canvas3D()->init();
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init canvas3D";
|
|
||||||
wxGetApp().imgui()->new_frame();
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished init imgui frame";
|
|
||||||
plater_->canvas3D()->enable_render(true);
|
|
||||||
|
|
||||||
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())
|
if (is_editor())
|
||||||
mainframe->select_tab(size_t(0));
|
mainframe->select_tab(size_t(0));
|
||||||
mainframe->Thaw();
|
mainframe->Thaw();
|
||||||
|
|
Loading…
Reference in New Issue