From 08e2e29afdd459b0b392b2a082e1e7b599cfe294 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 12 Aug 2021 13:53:22 +0200 Subject: [PATCH 1/2] ObjectList: Implemented interface for delete InfoItem --- src/slic3r/GUI/GUI_ObjectList.cpp | 11 +++++++---- src/slic3r/GUI/GUI_ObjectList.hpp | 1 + src/slic3r/GUI/ObjectDataViewModel.cpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 07119b8de1..138eb82968 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1778,10 +1778,8 @@ void ObjectList::del_subobject_item(wxDataViewItem& item) del_layers_from_object(obj_idx); else if (type & itLayer && obj_idx != -1) del_layer_from_object(obj_idx, m_objects_model->GetLayerRangeByItem(item)); - else if (type & itInfo && obj_idx != -1) { - Unselect(item); - Select(parent); - } + else if (type & itInfo && obj_idx != -1) + del_info_item(obj_idx, m_objects_model->GetInfoItemType(item)); else if (idx == -1) return; else if (!del_subobject_from_object(obj_idx, idx, type)) @@ -1795,6 +1793,11 @@ void ObjectList::del_subobject_item(wxDataViewItem& item) update_info_items(obj_idx); } +void ObjectList::del_info_item(const int obj_idx, InfoItemType type) +{ + // ToDo lmFIXME :) +} + void ObjectList::del_settings_from_config(const wxDataViewItem& parent_item) { const bool is_layer_settings = m_objects_model->GetItemType(parent_item) == itLayer; diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 71730b2c06..0fbad19192 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -254,6 +254,7 @@ public: void del_layer_from_object(const int obj_idx, const t_layer_height_range& layer_range); void del_layers_from_object(const int obj_idx); bool del_subobject_from_object(const int obj_idx, const int idx, const int type); + void del_info_item(const int obj_idx, InfoItemType type); void split(); void merge(bool to_multipart_object); void layers_editing(); diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index 96d7ca8aed..9417364ef1 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1141,7 +1141,7 @@ void ObjectDataViewModel::GetItemInfo(const wxDataViewItem& item, ItemType& type if (!node || node->GetIdx() <-1 || ( node->GetIdx() == -1 && - !(node->GetType() & (itObject | itSettings | itInstanceRoot | itLayerRoot/* | itLayer*/)) + !(node->GetType() & (itObject | itSettings | itInstanceRoot | itLayerRoot | itInfo)) ) ) return; From dd1e1307bebc2558dd79e05389401854f3e36879 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 16 Aug 2021 09:48:29 +0200 Subject: [PATCH 2/2] Use Del key to delete custom supports etc. from the object list --- src/slic3r/GUI/GUI_ObjectList.cpp | 43 ++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 138eb82968..318705e09e 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1795,7 +1795,48 @@ void ObjectList::del_subobject_item(wxDataViewItem& item) void ObjectList::del_info_item(const int obj_idx, InfoItemType type) { - // ToDo lmFIXME :) + Plater* plater = wxGetApp().plater(); + GLCanvas3D* cnv = plater->canvas3D(); + + switch (type) { + case InfoItemType::CustomSupports: + cnv->get_gizmos_manager().reset_all_states(); + Plater::TakeSnapshot(plater, _L("Remove paint-on supports")); + for (ModelVolume* mv : (*m_objects)[obj_idx]->volumes) + mv->supported_facets.clear(); + break; + + case InfoItemType::CustomSeam: + cnv->get_gizmos_manager().reset_all_states(); + Plater::TakeSnapshot(plater, _L("Remove paint-on seam")); + for (ModelVolume* mv : (*m_objects)[obj_idx]->volumes) + mv->seam_facets.clear(); + break; + + case InfoItemType::MmuSegmentation: + cnv->get_gizmos_manager().reset_all_states(); + Plater::TakeSnapshot(plater, _L("Remove Multi Material painting")); + for (ModelVolume* mv : (*m_objects)[obj_idx]->volumes) + mv->mmu_segmentation_facets.clear(); + break; + + case InfoItemType::Sinking: + Plater::TakeSnapshot(plater, _L("Shift objects to bed")); + (*m_objects)[obj_idx]->ensure_on_bed(); + cnv->reload_scene(true, true); + break; + + case InfoItemType::VariableLayerHeight: + Plater::TakeSnapshot(plater, _L("Remove variable layer height")); + (*m_objects)[obj_idx]->layer_height_profile.clear(); + if (cnv->is_layers_editing_enabled()) + //cnv->post_event(SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); + cnv->force_main_toolbar_left_action(cnv->get_main_toolbar_item_id("layersediting")); + break; + + case InfoItemType::Undef : assert(false); break; + } + cnv->post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); } void ObjectList::del_settings_from_config(const wxDataViewItem& parent_item)