Show info about multi-material segmentation in ObjectList.

This commit is contained in:
Lukáš Hejl 2021-06-04 08:52:19 +02:00
parent 154e552006
commit c751f2d638
4 changed files with 19 additions and 11 deletions

View File

@ -2201,9 +2201,9 @@ void ObjectList::part_selection_changed()
if (type == itInfo) { if (type == itInfo) {
InfoItemType info_type = m_objects_model->GetInfoItemType(item); InfoItemType info_type = m_objects_model->GetInfoItemType(item);
if (info_type != InfoItemType::VariableLayerHeight) { if (info_type != InfoItemType::VariableLayerHeight) {
GLGizmosManager::EType gizmo_type = GLGizmosManager::EType gizmo_type = info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports :
info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports info_type == InfoItemType::CustomSeam ? GLGizmosManager::EType::Seam :
: GLGizmosManager::EType::Seam; GLGizmosManager::EType::MmuSegmentation;
GLGizmosManager& gizmos_mgr = wxGetApp().plater()->canvas3D()->get_gizmos_manager(); GLGizmosManager& gizmos_mgr = wxGetApp().plater()->canvas3D()->get_gizmos_manager();
if (gizmos_mgr.get_current_type() != gizmo_type) if (gizmos_mgr.get_current_type() != gizmo_type)
gizmos_mgr.open_gizmo(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, for (InfoItemType type : {InfoItemType::CustomSupports,
InfoItemType::CustomSeam, InfoItemType::CustomSeam,
InfoItemType::MmuSegmentation,
InfoItemType::VariableLayerHeight}) { InfoItemType::VariableLayerHeight}) {
wxDataViewItem item = m_objects_model->GetInfoItemByType(item_obj, type); wxDataViewItem item = m_objects_model->GetInfoItemByType(item_obj, type);
bool shows = item.IsOk(); bool shows = item.IsOk();
@ -2341,12 +2342,13 @@ void ObjectList::update_info_items(size_t obj_idx)
switch (type) { switch (type) {
case InfoItemType::CustomSupports : case InfoItemType::CustomSupports :
case InfoItemType::CustomSeam : case InfoItemType::CustomSeam :
case InfoItemType::MmuSegmentation :
should_show = printer_technology() == ptFFF should_show = printer_technology() == ptFFF
&& std::any_of(model_object->volumes.begin(), model_object->volumes.end(), && std::any_of(model_object->volumes.begin(), model_object->volumes.end(),
[type](const ModelVolume* mv) { [type](const ModelVolume *mv) {
return ! (type == InfoItemType::CustomSupports return !(type == InfoItemType::CustomSupports ? mv->supported_facets.empty() :
? mv->supported_facets.empty() type == InfoItemType::CustomSeam ? mv->seam_facets.empty() :
: mv->seam_facets.empty()); mv->mmu_segmentation_facets.empty());
}); });
break; break;

View File

@ -7,6 +7,7 @@
#include "slic3r/GUI/Plater.hpp" #include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/BitmapCache.hpp" #include "slic3r/GUI/BitmapCache.hpp"
#include "slic3r/GUI/format.hpp" #include "slic3r/GUI/format.hpp"
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.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()); 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)); m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
}
} }
void GLGizmoMmuSegmentation::init_model_triangle_selectors() void GLGizmoMmuSegmentation::init_model_triangle_selectors()

View File

@ -62,9 +62,10 @@ ObjectDataViewModelNode::ObjectDataViewModelNode(ObjectDataViewModelNode* parent
m_type(itInfo), m_type(itInfo),
m_extruder(wxEmptyString) m_extruder(wxEmptyString)
{ {
m_name = info_type == InfoItemType::CustomSupports ? _L("Paint-on supports") m_name = info_type == InfoItemType::CustomSupports ? _L("Paint-on supports") :
: info_type == InfoItemType::CustomSeam ? _L("Paint-on seam") info_type == InfoItemType::CustomSeam ? _L("Paint-on seam") :
: _L("Variable layer height"); info_type == InfoItemType::MmuSegmentation ? _L("Paint-on segmentation") :
_L("Variable layer height");
m_info_item_type = info_type; m_info_item_type = info_type;
} }

View File

@ -50,6 +50,7 @@ enum class InfoItemType
Undef, Undef,
CustomSupports, CustomSupports,
CustomSeam, CustomSeam,
MmuSegmentation,
VariableLayerHeight VariableLayerHeight
}; };