From eecc2a738cedae93577f42b05fe1c11578ed93c5 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 18 Nov 2022 18:02:11 +0800 Subject: [PATCH] ENH: label: refine some label logic 1. only show label of object in current partplate 2. disable label under gizmo 3. fix a issue of label not updated in time 4. add some logs Change-Id: If20196a566cc45a4a0c2bcc6bbe212aaa9f74dd3 (cherry picked from commit 3e92ed61e9687d5351a9bb2bc6d25b568cd1c973) --- src/libslic3r/Format/bbs_3mf.cpp | 8 ++++---- src/slic3r/GUI/GLCanvas3D.cpp | 6 +++++- src/slic3r/GUI/MainFrame.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index fb6adac67d..9d9e048a36 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -1172,7 +1172,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) } lock{&archive}; if (!open_zip_reader(&archive, filename)) { - add_error("Unable to open the file"); + add_error("Unable to open the file"+filename); return false; } @@ -1259,7 +1259,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) } lock{ &archive }; if (!open_zip_reader(&archive, filename)) { - add_error("Unable to open the file"); + add_error("Unable to open the file"+filename); return false; } @@ -4702,7 +4702,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) boost::system::error_code ec; boost::filesystem::remove(filepath_tmp, ec); if (!open_zip_writer(&archive, filepath_tmp)) { - add_error("Unable to open the file"); + add_error("Unable to open the file"+filepath_tmp); BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", Unable to open the file\n"); return false; } @@ -4762,7 +4762,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) } if (!open_zip_writer(&archive, filename)) { - add_error("Unable to open the file"); + add_error("Unable to open the file"+filename); BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", Unable to open the file\n"); return false; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 9bdc07a224..31ccb73e13 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -673,7 +673,7 @@ GLCanvas3D::Mouse::Mouse() void GLCanvas3D::Labels::render(const std::vector& sorted_instances) const { - if (!m_enabled || !is_shown()) + if (!m_enabled || !is_shown() || m_canvas.get_gizmos_manager().is_running()) return; const Camera& camera = wxGetApp().plater()->get_camera(); @@ -701,10 +701,14 @@ void GLCanvas3D::Labels::render(const std::vector& sorted_ // collect owners world bounding boxes and data from volumes std::vector owners; const GLVolumeCollection& volumes = m_canvas.get_volumes(); + PartPlate* cur_plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); for (const GLVolume* volume : volumes.volumes) { int obj_idx = volume->object_idx(); if (0 <= obj_idx && obj_idx < (int)model->objects.size()) { int inst_idx = volume->instance_idx(); + //only show current plate's label + if (!cur_plate->contain_instance(obj_idx, inst_idx)) + continue; std::vector::iterator it = std::find_if(owners.begin(), owners.end(), [obj_idx, inst_idx](const Owner& owner) { return (owner.obj_idx == obj_idx) && (owner.inst_idx == inst_idx); }); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index e53644ab89..ee674ba8aa 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -2190,7 +2190,7 @@ void MainFrame::init_menubar_as_editor() viewMenu->AppendSeparator(); append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Labels"), _L("Show object labels in 3D scene"), - [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this, + [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this); /*viewMenu->AppendSeparator();