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)
This commit is contained in:
parent
93ce494741
commit
eecc2a738c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -673,7 +673,7 @@ GLCanvas3D::Mouse::Mouse()
|
|||
|
||||
void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& 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<const ModelInstance*>& sorted_
|
|||
// collect owners world bounding boxes and data from volumes
|
||||
std::vector<Owner> 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<Owner>::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);
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue