From 9bc96bf28e42ba6959283fbb731e23bb878cf579 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 21 Apr 2020 12:42:52 +0200 Subject: [PATCH] Removed "Support materials" item from "Add Settings" context menu for the Layer ranges Related to #3060 and #4100 --- src/slic3r/GUI/GUI_ObjectList.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 5d06edad9..6297cace3 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1209,6 +1209,13 @@ static bool improper_category(const std::string& category, const int extruders_c (!is_object_settings && category == "Support material"); } +static bool is_object_item(ItemType item_type) +{ + return item_type & itObject || item_type & itInstance || + // multi-selection in ObjectList, but full_object in Selection + (item_type == itUndef && scene_selection().is_single_full_object()); +} + void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part) { auto options = get_options(is_part); @@ -1579,9 +1586,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_) const ItemType item_type = m_objects_model->GetItemType(GetSelection()); if (item_type == itUndef && !selection.is_single_full_object()) return nullptr; - const bool is_object_settings = item_type & itObject || item_type & itInstance || - // multi-selection in ObjectList, but full_object in Selection - (item_type == itUndef && selection.is_single_full_object()); + const bool is_object_settings = is_object_item(item_type); create_freq_settings_popupmenu(menu, is_object_settings); if (mode == comAdvanced) @@ -1821,8 +1826,7 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu) const wxDataViewItem selected_item = GetSelection(); wxDataViewItem item = m_objects_model->GetItemType(selected_item) & itSettings ? m_objects_model->GetParent(selected_item) : selected_item; - const bool is_part = !(m_objects_model->GetItemType(item) == itObject || scene_selection().is_single_full_object()); - get_options_menu(settings_menu, is_part); + get_options_menu(settings_menu, !is_object_item(m_objects_model->GetItemType(item))); for (auto cat : settings_menu) { append_menu_item(menu, wxID_ANY, _(cat.first), "",