From f394f84d51b8654b9008a11e773bdd04d75b979d Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 17 Jun 2019 13:09:11 +0200 Subject: [PATCH] Fixed selection after layers deleting --- src/slic3r/GUI/GUI_ObjectList.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 31396b630..1d7d95b56 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2317,32 +2317,28 @@ void ObjectList::remove() wxDataViewItemArray sels; GetSelections(sels); + wxDataViewItem parent = wxDataViewItem(0); + for (auto& item : sels) { if (m_objects_model->GetParent(item) == wxDataViewItem(0)) delete_from_model_and_list(itObject, m_objects_model->GetIdByItem(item), -1); else { -// if (sels.size() == 1) -// select_item(m_objects_model->GetParent(item)); - wxDataViewItem parent = m_objects_model->GetParent(item); - if (sels.size() == 1) { - if (!(m_objects_model->GetItemType(item) & itLayer)) { - select_item(parent); - parent = wxDataViewItem(0); - } - else { - wxDataViewItemArray children; - if (m_objects_model->GetChildren(parent, children) == 1) - parent = m_objects_model->GetTopParent(item); - } + if (m_objects_model->GetItemType(item) & itLayer) { + parent = m_objects_model->GetParent(item); + wxDataViewItemArray children; + if (m_objects_model->GetChildren(parent, children) == 1) + parent = m_objects_model->GetTopParent(item); } + else if (sels.size() == 1) + select_item(m_objects_model->GetParent(item)); del_subobject_item(item); - - if (sels.size() == 1 && parent) - select_item(parent); } } + + if (parent) + select_item(parent); } void ObjectList::del_layer_range(const t_layer_height_range& range)