FIX: fix the object select state not correct issue when load project from drop-files

Change-Id: I6ad11ec3a96d73ac38f2f5aab74a3fcd685c0a34
This commit is contained in:
lane.wei 2023-01-07 20:08:06 +08:00 committed by Lane.Wei
parent 0dc7f51782
commit 38406e3e59
2 changed files with 13 additions and 4 deletions

View file

@ -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<unsigned int*>(&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) {

View file

@ -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