Show context menu for a multi-object selection on 3DScene,

add "Reload from disk" item for this menu
This commit is contained in:
YuSanka 2019-12-18 09:06:21 +01:00
parent 2222b0cdc9
commit 7650732c61
3 changed files with 13 additions and 5 deletions

View File

@ -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()

View File

@ -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 ;

View File

@ -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
{