From 38406e3e590d22efbfc3488c3eb201aac09c7fc7 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Sat, 7 Jan 2023 20:08:06 +0800 Subject: [PATCH] FIX: fix the object select state not correct issue when load project from drop-files Change-Id: I6ad11ec3a96d73ac38f2f5aab74a3fcd685c0a34 --- src/slic3r/GUI/PartPlate.cpp | 8 ++++---- src/slic3r/GUI/Plater.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 5947259aa..e518bcd43 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -545,7 +545,7 @@ void PartPlate::render_logo(bool bottom) const //canvas.request_extra_frame(); } - + if (m_vbo_id == 0) { unsigned int* vbo_id_ptr = const_cast(&m_vbo_id); glsafe(::glGenBuffers(1, vbo_id_ptr)); @@ -567,7 +567,7 @@ void PartPlate::render_logo(bool bottom) const if (part.buffer && part.buffer->get_vertices_count() > 0 //&& part.vbo_id != 0 ) { - if (part.offset.x() != m_origin.x() || part.offset.y() != m_origin.y()) { + if (part.offset.x() != m_origin.x() || part.offset.y() != m_origin.y()) { part.offset = Vec2d(m_origin.x(), m_origin.y()); part.update_buffer(); } @@ -3020,7 +3020,7 @@ int PartPlateList::select_plate(int index) if (m_intialized && m_plater) { Vec2d pos = compute_shape_position(index, m_plate_cols); m_plater->set_bed_position(pos); - wxQueueEvent(m_plater, new SimpleEvent(EVT_GLCANVAS_PLATE_SELECT)); + //wxQueueEvent(m_plater, new SimpleEvent(EVT_GLCANVAS_PLATE_SELECT)); } return 0; @@ -4448,7 +4448,7 @@ void PartPlateList::BedTextureInfo::TexturePart::update_buffer() rectangle.push_back(Vec2d(x+w, y+h)); rectangle.push_back(Vec2d(x, y+h)); ExPolygon poly; - + for (int i = 0; i < 4; i++) { const Vec2d & p = rectangle[i]; for (auto& p : rectangle) { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c4cf0f0af..f41ab6b88 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -7455,7 +7455,12 @@ int Plater::new_project(bool skip_confirm, bool silent) Model m; model().load_from(m); // new id avoid same path name + + //select first plate get_partplate_list().select_plate(0); + SimpleEvent event(EVT_GLCANVAS_PLATE_SELECT); + p->on_plate_selected(event); + p->load_auxiliary_files(); wxGetApp().app_config->update_last_backup_dir(model().get_backup_path()); @@ -10857,6 +10862,10 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click) { //select plate ret = p->partplate_list.select_plate(plate_index); + if (!ret) { + SimpleEvent event(EVT_GLCANVAS_PLATE_SELECT); + p->on_plate_selected(event); + } if ((!ret)&&(p->background_process.can_switch_print())) { //select successfully