From c751f2d638b1969df190a4a30e8223f1fae91609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Fri, 4 Jun 2021 08:52:19 +0200 Subject: [PATCH] Show info about multi-material segmentation in ObjectList. --- src/slic3r/GUI/GUI_ObjectList.cpp | 16 +++++++++------- src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp | 6 +++++- src/slic3r/GUI/ObjectDataViewModel.cpp | 7 ++++--- src/slic3r/GUI/ObjectDataViewModel.hpp | 1 + 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 53fbc4c1c..bd0e4923b 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2201,9 +2201,9 @@ void ObjectList::part_selection_changed() if (type == itInfo) { InfoItemType info_type = m_objects_model->GetInfoItemType(item); if (info_type != InfoItemType::VariableLayerHeight) { - GLGizmosManager::EType gizmo_type = - info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports - : GLGizmosManager::EType::Seam; + GLGizmosManager::EType gizmo_type = info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports : + info_type == InfoItemType::CustomSeam ? GLGizmosManager::EType::Seam : + GLGizmosManager::EType::MmuSegmentation; GLGizmosManager& gizmos_mgr = wxGetApp().plater()->canvas3D()->get_gizmos_manager(); if (gizmos_mgr.get_current_type() != gizmo_type) gizmos_mgr.open_gizmo(gizmo_type); @@ -2333,6 +2333,7 @@ void ObjectList::update_info_items(size_t obj_idx) for (InfoItemType type : {InfoItemType::CustomSupports, InfoItemType::CustomSeam, + InfoItemType::MmuSegmentation, InfoItemType::VariableLayerHeight}) { wxDataViewItem item = m_objects_model->GetInfoItemByType(item_obj, type); bool shows = item.IsOk(); @@ -2341,12 +2342,13 @@ void ObjectList::update_info_items(size_t obj_idx) switch (type) { case InfoItemType::CustomSupports : case InfoItemType::CustomSeam : + case InfoItemType::MmuSegmentation : should_show = printer_technology() == ptFFF && std::any_of(model_object->volumes.begin(), model_object->volumes.end(), - [type](const ModelVolume* mv) { - return ! (type == InfoItemType::CustomSupports - ? mv->supported_facets.empty() - : mv->seam_facets.empty()); + [type](const ModelVolume *mv) { + return !(type == InfoItemType::CustomSupports ? mv->supported_facets.empty() : + type == InfoItemType::CustomSeam ? mv->seam_facets.empty() : + mv->mmu_segmentation_facets.empty()); }); break; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index e04a5c49d..3cf466dc3 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -7,6 +7,7 @@ #include "slic3r/GUI/Plater.hpp" #include "slic3r/GUI/BitmapCache.hpp" #include "slic3r/GUI/format.hpp" +#include "slic3r/GUI/GUI_ObjectList.hpp" #include "libslic3r/PresetBundle.hpp" #include "libslic3r/Model.hpp" @@ -375,8 +376,11 @@ void GLGizmoMmuSegmentation::update_model_object() const updated |= mv->mmu_segmentation_facets.set(*m_triangle_selectors[idx].get()); } - if (updated) + if (updated) { + const ModelObjectPtrs &mos = wxGetApp().model().objects; + wxGetApp().obj_list()->update_info_items(std::find(mos.begin(), mos.end(), mo) - mos.begin()); m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); + } } void GLGizmoMmuSegmentation::init_model_triangle_selectors() diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index f703ddcdb..482de650d 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -62,9 +62,10 @@ ObjectDataViewModelNode::ObjectDataViewModelNode(ObjectDataViewModelNode* parent m_type(itInfo), m_extruder(wxEmptyString) { - m_name = info_type == InfoItemType::CustomSupports ? _L("Paint-on supports") - : info_type == InfoItemType::CustomSeam ? _L("Paint-on seam") - : _L("Variable layer height"); + m_name = info_type == InfoItemType::CustomSupports ? _L("Paint-on supports") : + info_type == InfoItemType::CustomSeam ? _L("Paint-on seam") : + info_type == InfoItemType::MmuSegmentation ? _L("Paint-on segmentation") : + _L("Variable layer height"); m_info_item_type = info_type; } diff --git a/src/slic3r/GUI/ObjectDataViewModel.hpp b/src/slic3r/GUI/ObjectDataViewModel.hpp index 11a9225ca..a858b2619 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.hpp +++ b/src/slic3r/GUI/ObjectDataViewModel.hpp @@ -50,6 +50,7 @@ enum class InfoItemType Undef, CustomSupports, CustomSeam, + MmuSegmentation, VariableLayerHeight };