From 7650732c61162d42e457d9db887961908cbd298d Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 18 Dec 2019 09:06:21 +0100 Subject: [PATCH] Show context menu for a multi-object selection on 3DScene, add "Reload from disk" item for this menu --- src/slic3r/GUI/GUI_ObjectList.cpp | 11 ++++++++--- src/slic3r/GUI/GUI_ObjectList.hpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index c0520cb9a..a058de805 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -3874,8 +3874,8 @@ void ObjectList::show_multi_selection_menu() GetSelections(sels); for (const wxDataViewItem& item : sels) - if (!(m_objects_model->GetItemType(item) & (itVolume | itObject))) - // show this menu only for Object(s)/Volume(s) selection + if (!(m_objects_model->GetItemType(item) & (itVolume | itObject | itInstance))) + // show this menu only for Objects(Instances mixed with Objects)/Volumes selection return; wxMenu* menu = new wxMenu(); @@ -3885,7 +3885,12 @@ void ObjectList::show_multi_selection_menu() _(L("Select extruder number for selected objects and/or parts")), [this](wxCommandEvent&) { extruder_selection(); }, "", menu); - PopupMenu(menu); + append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")), + [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { + return wxGetApp().plater()->can_reload_from_disk(); + }, wxGetApp().plater()); + + wxGetApp().plater()->PopupMenu(menu); } void ObjectList::extruder_selection() diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 73b23453b..a5a72ad8c 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -366,6 +366,8 @@ public: void update_printable_state(int obj_idx, int instance_idx); void toggle_printable_state(wxDataViewItem item); + void show_multi_selection_menu(); + private: #ifdef __WXOSX__ // void OnChar(wxKeyEvent& event); @@ -384,8 +386,6 @@ private: void OnEditingStarted(wxDataViewEvent &event); #endif /* __WXMSW__ */ void OnEditingDone(wxDataViewEvent &event); - - void show_multi_selection_menu(); void extruder_selection(); void set_extruder_for_selected_items(const int extruder) const ; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ef891b3b3..107d55de0 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3615,7 +3615,10 @@ void Plater::priv::on_right_click(RBtnEvent& evt) if (evt.data.second) // right button was clicked on empty space menu = &default_menu; else + { + sidebar->obj_list()->show_multi_selection_menu(); return; + } } else {