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 {
|
||||
GLVolumeState() :
|
||||
volume_idx(size_t(-1)), was_wipe_tower(0) {}
|
||||
volume_idx(size_t(-1)) {}
|
||||
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) :
|
||||
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;
|
||||
// Volume index in the old GLVolume vector.
|
||||
size_t volume_idx;
|
||||
bool was_wipe_tower;
|
||||
};
|
||||
|
||||
// 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
|
||||
// so, if they were a wipe tower.
|
||||
bool was_deleted_wipe_tower = false;
|
||||
for (int del_idx = 0; del_idx < deleted_volumes.size(); del_idx++) {
|
||||
if (deleted_volumes[del_idx].volume_idx == temp_idx && deleted_volumes[del_idx].was_wipe_tower) {
|
||||
for (int del_idx = 0; del_idx < deleted_wipe_towers.size(); del_idx++) {
|
||||
if (deleted_wipe_towers[del_idx].volume_idx == temp_idx) {
|
||||
was_deleted_wipe_tower = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1018,34 +1018,30 @@ void GUI_App::post_init()
|
|||
plater_->select_view_3D("3D");
|
||||
//BBS init the opengl resource here
|
||||
#ifdef __linux__
|
||||
if (!plater_->canvas3D()->get_wxglcanvas()->IsShownOnScreen() ||
|
||||
!plater_->canvas3D()->make_current_for_postinit()) {
|
||||
/* The canvas3d didn't actually exist (and therefore, there is
|
||||
* no current EGL context) -- try again later, I guess.
|
||||
*/
|
||||
m_post_initialized = false;
|
||||
return;
|
||||
if (plater_->canvas3D()->get_wxglcanvas()->IsShownOnScreen()&&plater_->canvas3D()->make_current_for_postinit()) {
|
||||
#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";
|
||||
}
|
||||
#ifdef __linux__
|
||||
}
|
||||
#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())
|
||||
mainframe->select_tab(size_t(0));
|
||||
mainframe->Thaw();
|
||||
|
|
Loading…
Reference in New Issue