1) Added Scale to print volume menu item to objects list context menu

2) Disable [F] key when scale sizmo is dragging
This commit is contained in:
Enrico Turri 2019-05-23 09:20:11 +02:00
parent 763576fbc2
commit a8e92be6eb
4 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,4 @@
#include "libslic3r/libslic3r.h"
#include "GUI_ObjectList.hpp" #include "GUI_ObjectList.hpp"
#include "GUI_ObjectManipulation.hpp" #include "GUI_ObjectManipulation.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
@ -1283,6 +1284,14 @@ void ObjectList::append_menu_item_delete(wxMenu* menu)
[this](wxCommandEvent&) { remove(); }, "", menu); [this](wxCommandEvent&) { remove(); }, "", menu);
} }
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void ObjectList::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu)
{
append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")),
[this](wxCommandEvent&) { wxGetApp().plater()->scale_selection_to_fit_print_volume(); }, "", menu);
}
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void ObjectList::create_object_popupmenu(wxMenu *menu) void ObjectList::create_object_popupmenu(wxMenu *menu)
{ {
#ifdef __WXOSX__ #ifdef __WXOSX__
@ -1291,6 +1300,9 @@ void ObjectList::create_object_popupmenu(wxMenu *menu)
append_menu_item_export_stl(menu); append_menu_item_export_stl(menu);
append_menu_item_fix_through_netfabb(menu); append_menu_item_fix_through_netfabb(menu);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
append_menu_item_scale_selection_to_fit_print_volume(menu);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
// Split object to parts // Split object to parts
m_menu_item_split = append_menu_item_split(menu); m_menu_item_split = append_menu_item_split(menu);

View File

@ -207,6 +207,9 @@ public:
void append_menu_item_export_stl(wxMenu* menu) const ; void append_menu_item_export_stl(wxMenu* menu) const ;
void append_menu_item_change_extruder(wxMenu* menu) const; void append_menu_item_change_extruder(wxMenu* menu) const;
void append_menu_item_delete(wxMenu* menu); void append_menu_item_delete(wxMenu* menu);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
void create_object_popupmenu(wxMenu *menu); void create_object_popupmenu(wxMenu *menu);
void create_sla_object_popupmenu(wxMenu*menu); void create_sla_object_popupmenu(wxMenu*menu);
void create_part_popupmenu(wxMenu*menu); void create_part_popupmenu(wxMenu*menu);

View File

@ -853,7 +853,9 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
{ {
if (m_current == Scale) if (m_current == Scale)
{ {
wxGetApp().plater()->scale_selection_to_fit_print_volume(); if (!is_dragging())
wxGetApp().plater()->scale_selection_to_fit_print_volume();
processed = true; processed = true;
} }

View File

@ -3021,8 +3021,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu); sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu);
#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME #if ENABLE_SCALE_TO_FIT_PRINT_VOLUME
append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")), sidebar->obj_list()->append_menu_item_scale_selection_to_fit_print_volume(menu);
[this](wxCommandEvent&) { scale_selection_to_fit_print_volume(); }, "", menu);
#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME #endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME
wxMenu* mirror_menu = new wxMenu(); wxMenu* mirror_menu = new wxMenu();