Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
3e0a06aa0e
8 changed files with 12 additions and 170 deletions
|
@ -25,8 +25,6 @@
|
||||||
#define ENABLE_ENSURE_ON_BED_WHILE_SCALING (1 && ENABLE_MODELVOLUME_TRANSFORM)
|
#define ENABLE_ENSURE_ON_BED_WHILE_SCALING (1 && ENABLE_MODELVOLUME_TRANSFORM)
|
||||||
// Gizmos always rendered on top of objects
|
// Gizmos always rendered on top of objects
|
||||||
#define ENABLE_GIZMOS_ON_TOP (1 && ENABLE_1_42_0)
|
#define ENABLE_GIZMOS_ON_TOP (1 && ENABLE_1_42_0)
|
||||||
// New menu layout (open/save/save as project + import/export)
|
|
||||||
#define ENABLE_NEW_MENU_LAYOUT (1 && ENABLE_1_42_0)
|
|
||||||
// All rotations made using the rotate gizmo are done with respect to the world reference system
|
// All rotations made using the rotate gizmo are done with respect to the world reference system
|
||||||
#define ENABLE_WORLD_ROTATIONS (1 && ENABLE_1_42_0)
|
#define ENABLE_WORLD_ROTATIONS (1 && ENABLE_1_42_0)
|
||||||
// Enables shortcut keys for gizmos
|
// Enables shortcut keys for gizmos
|
||||||
|
|
|
@ -318,7 +318,6 @@ void GUI_App::update_ui_from_settings()
|
||||||
mainframe->update_ui_from_settings();
|
mainframe->update_ui_from_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void GUI_App::load_project(wxWindow *parent, wxString& input_file)
|
void GUI_App::load_project(wxWindow *parent, wxString& input_file)
|
||||||
{
|
{
|
||||||
input_file.Clear();
|
input_file.Clear();
|
||||||
|
@ -332,9 +331,6 @@ void GUI_App::load_project(wxWindow *parent, wxString& input_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files)
|
void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files)
|
||||||
#else
|
|
||||||
void GUI_App::open_model(wxWindow *parent, wxArrayString& input_files)
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
{
|
{
|
||||||
input_files.Clear();
|
input_files.Clear();
|
||||||
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
||||||
|
|
|
@ -112,12 +112,8 @@ public:
|
||||||
|
|
||||||
void recreate_GUI();
|
void recreate_GUI();
|
||||||
void system_info();
|
void system_info();
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void load_project(wxWindow *parent, wxString& input_file);
|
void load_project(wxWindow *parent, wxString& input_file);
|
||||||
void import_model(wxWindow *parent, wxArrayString& input_files);
|
void import_model(wxWindow *parent, wxArrayString& input_files);
|
||||||
#else
|
|
||||||
void open_model(wxWindow *parent, wxArrayString& input_files);
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
static bool catch_error(std::function<void()> cb,
|
static bool catch_error(std::function<void()> cb,
|
||||||
// wxMessageDialog* message_dialog,
|
// wxMessageDialog* message_dialog,
|
||||||
const std::string& err);
|
const std::string& err);
|
||||||
|
|
|
@ -763,11 +763,7 @@ void ObjectList::load_part( ModelObject* model_object,
|
||||||
|
|
||||||
m_parts_changed = false;
|
m_parts_changed = false;
|
||||||
wxArrayString input_files;
|
wxArrayString input_files;
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxGetApp().import_model(parent, input_files);
|
wxGetApp().import_model(parent, input_files);
|
||||||
#else
|
|
||||||
wxGetApp().open_model(parent, input_files);
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
for (int i = 0; i < input_files.size(); ++i) {
|
for (int i = 0; i < input_files.size(); ++i) {
|
||||||
std::string input_file = input_files.Item(i).ToStdString();
|
std::string input_file = input_files.Item(i).ToStdString();
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,6 @@ void MainFrame::add_created_tab(Tab* panel)
|
||||||
m_tabpanel->AddPage(panel, panel->title());
|
m_tabpanel->AddPage(panel, panel->title());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
bool MainFrame::can_save() const
|
bool MainFrame::can_save() const
|
||||||
{
|
{
|
||||||
return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false;
|
return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false;
|
||||||
|
@ -218,14 +217,12 @@ bool MainFrame::can_delete_all() const
|
||||||
{
|
{
|
||||||
return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false;
|
return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
void MainFrame::init_menubar()
|
void MainFrame::init_menubar()
|
||||||
{
|
{
|
||||||
// File menu
|
// File menu
|
||||||
wxMenu* fileMenu = new wxMenu;
|
wxMenu* fileMenu = new wxMenu;
|
||||||
{
|
{
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxMenuItem* item_open = append_menu_item(fileMenu, wxID_ANY, _(L("Open…\tCtrl+O")), _(L("Open a project file")),
|
wxMenuItem* item_open = append_menu_item(fileMenu, wxID_ANY, _(L("Open…\tCtrl+O")), _(L("Open a project file")),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "brick_add.png");
|
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "brick_add.png");
|
||||||
wxMenuItem* item_save = append_menu_item(fileMenu, wxID_ANY, _(L("Save\tCtrl+S")), _(L("Save current project file")),
|
wxMenuItem* item_save = append_menu_item(fileMenu, wxID_ANY, _(L("Save\tCtrl+S")), _(L("Save current project file")),
|
||||||
|
@ -264,19 +261,6 @@ void MainFrame::init_menubar()
|
||||||
append_submenu(fileMenu, export_menu, wxID_ANY, _(L("Export")), _(L("")));
|
append_submenu(fileMenu, export_menu, wxID_ANY, _(L("Export")), _(L("")));
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
#else
|
|
||||||
append_menu_item(fileMenu, wxID_ANY, _(L("Open STL/OBJ/AMF/3MF…\tCtrl+O")), _(L("Open a model")),
|
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->add(); }, "brick_add.png");
|
|
||||||
append_menu_item(fileMenu, wxID_ANY, _(L("&Load Config…\tCtrl+L")), _(L("Load exported configuration file")),
|
|
||||||
[this](wxCommandEvent&) { load_config_file(); }, "plugin_add.png");
|
|
||||||
append_menu_item(fileMenu, wxID_ANY, _(L("&Export Config…\tCtrl+E")), _(L("Export current configuration to file")),
|
|
||||||
[this](wxCommandEvent&) { export_config(); }, "plugin_go.png");
|
|
||||||
append_menu_item(fileMenu, wxID_ANY, _(L("&Load Config Bundle…")), _(L("Load presets from a bundle")),
|
|
||||||
[this](wxCommandEvent&) { load_configbundle(); }, "lorry_add.png");
|
|
||||||
append_menu_item(fileMenu, wxID_ANY, _(L("&Export Config Bundle…")), _(L("Export all presets to file")),
|
|
||||||
[this](wxCommandEvent&) { export_configbundle(); }, "lorry_go.png");
|
|
||||||
fileMenu->AppendSeparator();
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
m_menu_item_repeat = nullptr;
|
m_menu_item_repeat = nullptr;
|
||||||
append_menu_item(fileMenu, wxID_ANY, _(L("Quick Slice…\tCtrl+U")), _(L("Slice a file into a G-code")),
|
append_menu_item(fileMenu, wxID_ANY, _(L("Quick Slice…\tCtrl+U")), _(L("Slice a file into a G-code")),
|
||||||
|
@ -307,7 +291,6 @@ void MainFrame::init_menubar()
|
||||||
append_menu_item(fileMenu, wxID_EXIT, _(L("Quit")), _(L("Quit Slic3r")),
|
append_menu_item(fileMenu, wxID_EXIT, _(L("Quit")), _(L("Quit Slic3r")),
|
||||||
[this](wxCommandEvent&) { Close(false); });
|
[this](wxCommandEvent&) { Close(false); });
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_plater != nullptr); }, item_open->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_plater != nullptr); }, item_open->GetId());
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_save()); }, item_save->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_save()); }, item_save->GetId());
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_save()); }, item_save_as->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_save()); }, item_save_as->GetId());
|
||||||
|
@ -315,10 +298,8 @@ void MainFrame::init_menubar()
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_gcode()); }, item_export_gcode->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_gcode()); }, item_export_gcode->GetId());
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_model()); }, item_export_stl->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_model()); }, item_export_stl->GetId());
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_model()); }, item_export_amf->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_model()); }, item_export_amf->GetId());
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
// Edit menu
|
// Edit menu
|
||||||
wxMenu* editMenu = nullptr;
|
wxMenu* editMenu = nullptr;
|
||||||
if (m_plater != nullptr)
|
if (m_plater != nullptr)
|
||||||
|
@ -336,22 +317,6 @@ void MainFrame::init_menubar()
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete()); }, item_delete_sel->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete()); }, item_delete_sel->GetId());
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_all()); }, item_delete_all->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_all()); }, item_delete_all->GetId());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
#if !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
// Plater menu
|
|
||||||
if (m_plater) {
|
|
||||||
m_plater_menu = new wxMenu();
|
|
||||||
append_menu_item(m_plater_menu, wxID_ANY, _(L("Export G-code...")), _(L("Export current plate as G-code")),
|
|
||||||
[this](wxCommandEvent&) { m_plater->export_gcode(); }, "cog_go.png");
|
|
||||||
append_menu_item(m_plater_menu, wxID_ANY, _(L("Export plate as STL...")), _(L("Export current plate as STL")),
|
|
||||||
[this](wxCommandEvent&) { m_plater->export_stl(); }, "brick_go.png");
|
|
||||||
append_menu_item(m_plater_menu, wxID_ANY, _(L("Export plate as AMF...")), _(L("Export current plate as AMF")),
|
|
||||||
[this](wxCommandEvent&) { m_plater->export_amf(); }, "brick_go.png");
|
|
||||||
append_menu_item(m_plater_menu, wxID_ANY, _(L("Export plate as 3MF...")), _(L("Export current plate as 3MF")),
|
|
||||||
[this](wxCommandEvent&) { m_plater->export_3mf(); }, "brick_go.png");
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
// Window menu
|
// Window menu
|
||||||
auto windowMenu = new wxMenu();
|
auto windowMenu = new wxMenu();
|
||||||
|
@ -374,7 +339,6 @@ void MainFrame::init_menubar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// View menu
|
// View menu
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxMenu* viewMenu = nullptr;
|
wxMenu* viewMenu = nullptr;
|
||||||
if (m_plater) {
|
if (m_plater) {
|
||||||
viewMenu = new wxMenu();
|
viewMenu = new wxMenu();
|
||||||
|
@ -398,22 +362,6 @@ void MainFrame::init_menubar()
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_left->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_left->GetId());
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_right->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_right->GetId());
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (m_plater) {
|
|
||||||
m_viewMenu = new wxMenu();
|
|
||||||
// \xA0 is a non-breaing space. It is entered here to spoil the automatic accelerators,
|
|
||||||
// as the simple numeric accelerators spoil all numeric data entry.
|
|
||||||
// The camera control accelerators are captured by GLCanvas3D::on_char().
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Iso")) + "\t\xA0" + "0", _(L("Iso View")), [this](wxCommandEvent&) { select_view("iso"); });
|
|
||||||
m_viewMenu->AppendSeparator();
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Top")) + "\t\xA0" + "1", _(L("Top View")), [this](wxCommandEvent&) { select_view("top"); });
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Bottom")) + "\t\xA0" + "2", _(L("Bottom View")), [this](wxCommandEvent&) { select_view("bottom"); });
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Front")) + "\t\xA0" + "3", _(L("Front View")), [this](wxCommandEvent&) { select_view("front"); });
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Rear")) + "\t\xA0" + "4", _(L("Rear View")), [this](wxCommandEvent&) { select_view("rear"); });
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Left")) + "\t\xA0" + "5", _(L("Left View")), [this](wxCommandEvent&) { select_view("left"); });
|
|
||||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Right")) + "\t\xA0" + "6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); });
|
|
||||||
}
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
// Help menu
|
// Help menu
|
||||||
auto helpMenu = new wxMenu();
|
auto helpMenu = new wxMenu();
|
||||||
|
@ -447,18 +395,9 @@ void MainFrame::init_menubar()
|
||||||
{
|
{
|
||||||
auto menubar = new wxMenuBar();
|
auto menubar = new wxMenuBar();
|
||||||
menubar->Append(fileMenu, L("&File"));
|
menubar->Append(fileMenu, L("&File"));
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (editMenu) menubar->Append(editMenu, L("&Edit"));
|
if (editMenu) menubar->Append(editMenu, L("&Edit"));
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
#if !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (m_plater_menu) menubar->Append(m_plater_menu, L("&Plater"));
|
|
||||||
#endif // !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
menubar->Append(windowMenu, L("&Window"));
|
menubar->Append(windowMenu, L("&Window"));
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (viewMenu) menubar->Append(viewMenu, L("&View"));
|
if (viewMenu) menubar->Append(viewMenu, L("&View"));
|
||||||
#else
|
|
||||||
if (m_viewMenu) menubar->Append(m_viewMenu, L("&View"));
|
|
||||||
#endif // !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
// Add additional menus from C++
|
// Add additional menus from C++
|
||||||
wxGetApp().add_config_menu(menubar);
|
wxGetApp().add_config_menu(menubar);
|
||||||
menubar->Append(helpMenu, L("&Help"));
|
menubar->Append(helpMenu, L("&Help"));
|
||||||
|
|
|
@ -56,10 +56,6 @@ class MainFrame : public wxFrame
|
||||||
|
|
||||||
wxMenuItem* m_menu_item_repeat { nullptr };
|
wxMenuItem* m_menu_item_repeat { nullptr };
|
||||||
wxMenuItem* m_menu_item_reslice_now { nullptr };
|
wxMenuItem* m_menu_item_reslice_now { nullptr };
|
||||||
#if !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxMenu* m_plater_menu{ nullptr };
|
|
||||||
wxMenu* m_viewMenu{ nullptr };
|
|
||||||
#endif // !ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
std::string get_base_name(const wxString full_name) const ;
|
std::string get_base_name(const wxString full_name) const ;
|
||||||
std::string get_dir_name(const wxString full_name) const ;
|
std::string get_dir_name(const wxString full_name) const ;
|
||||||
|
@ -67,7 +63,6 @@ class MainFrame : public wxFrame
|
||||||
void on_presets_changed(SimpleEvent&);
|
void on_presets_changed(SimpleEvent&);
|
||||||
void on_value_changed(wxCommandEvent&);
|
void on_value_changed(wxCommandEvent&);
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
bool can_save() const;
|
bool can_save() const;
|
||||||
bool can_export_model() const;
|
bool can_export_model() const;
|
||||||
bool can_export_gcode() const;
|
bool can_export_gcode() const;
|
||||||
|
@ -75,7 +70,6 @@ class MainFrame : public wxFrame
|
||||||
bool can_select() const;
|
bool can_select() const;
|
||||||
bool can_delete() const;
|
bool can_delete() const;
|
||||||
bool can_delete_all() const;
|
bool can_delete_all() const;
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainFrame() {}
|
MainFrame() {}
|
||||||
|
|
|
@ -267,6 +267,12 @@ void PresetComboBox::set_label_marker(int item)
|
||||||
this->SetClientData(item, (void*)LABEL_ITEM_MARKER);
|
this->SetClientData(item, (void*)LABEL_ITEM_MARKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PresetComboBox::check_selection()
|
||||||
|
{
|
||||||
|
if (this->last_selected != GetSelection())
|
||||||
|
this->last_selected = GetSelection();
|
||||||
|
}
|
||||||
|
|
||||||
// Frequently changed parameters
|
// Frequently changed parameters
|
||||||
|
|
||||||
class FreqChangedParams : public OG_Settings
|
class FreqChangedParams : public OG_Settings
|
||||||
|
@ -641,7 +647,10 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||||
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
|
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
|
||||||
}
|
}
|
||||||
// Update the printer choosers, update the dirty flags.
|
// Update the printer choosers, update the dirty flags.
|
||||||
|
auto prev_selection = p->combo_printer->GetSelection();
|
||||||
preset_bundle.printers.update_platter_ui(p->combo_printer);
|
preset_bundle.printers.update_platter_ui(p->combo_printer);
|
||||||
|
if (prev_selection != p->combo_printer->GetSelection())
|
||||||
|
p->combo_printer->check_selection();
|
||||||
// Update the filament choosers to only contain the compatible presets, update the color preview,
|
// Update the filament choosers to only contain the compatible presets, update the color preview,
|
||||||
// update the dirty flags.
|
// update the dirty flags.
|
||||||
if (p->plater->printer_technology() == ptFFF) {
|
if (p->plater->printer_technology() == ptFFF) {
|
||||||
|
@ -926,9 +935,7 @@ struct Plater::priv
|
||||||
GLCanvas3D *canvas3D;
|
GLCanvas3D *canvas3D;
|
||||||
Preview *preview;
|
Preview *preview;
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxString project_filename;
|
wxString project_filename;
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
BackgroundSlicingProcess background_process;
|
BackgroundSlicingProcess background_process;
|
||||||
std::atomic<bool> arranging;
|
std::atomic<bool> arranging;
|
||||||
|
@ -950,11 +957,7 @@ struct Plater::priv
|
||||||
std::string get_config(const std::string &key) const;
|
std::string get_config(const std::string &key) const;
|
||||||
BoundingBoxf bed_shape_bb() const;
|
BoundingBoxf bed_shape_bb() const;
|
||||||
BoundingBox scaled_bed_shape_bb() const;
|
BoundingBox scaled_bed_shape_bb() const;
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
std::vector<size_t> load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config);
|
std::vector<size_t> load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config);
|
||||||
#else
|
|
||||||
std::vector<size_t> load_files(const std::vector<fs::path> &input_files);
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
std::vector<size_t> load_model_objects(const ModelObjectPtrs &model_objects);
|
std::vector<size_t> load_model_objects(const ModelObjectPtrs &model_objects);
|
||||||
std::unique_ptr<CheckboxFileDialog> get_export_file(GUI::FileType file_type);
|
std::unique_ptr<CheckboxFileDialog> get_export_file(GUI::FileType file_type);
|
||||||
|
|
||||||
|
@ -1058,9 +1061,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
#endif // ENABLE_IMGUI
|
#endif // ENABLE_IMGUI
|
||||||
, canvas3D(nullptr)
|
, canvas3D(nullptr)
|
||||||
, delayed_scene_refresh(false)
|
, delayed_scene_refresh(false)
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
, project_filename(wxEmptyString)
|
, project_filename(wxEmptyString)
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
{
|
{
|
||||||
arranging.store(false);
|
arranging.store(false);
|
||||||
rotoptimizing.store(false);
|
rotoptimizing.store(false);
|
||||||
|
@ -1245,11 +1246,7 @@ BoundingBox Plater::priv::scaled_bed_shape_bb() const
|
||||||
return bed_shape.bounding_box();
|
return bed_shape.bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config)
|
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config)
|
||||||
#else
|
|
||||||
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_files)
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
{
|
{
|
||||||
if (input_files.empty()) { return std::vector<size_t>(); }
|
if (input_files.empty()) { return std::vector<size_t>(); }
|
||||||
|
|
||||||
|
@ -1269,11 +1266,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
|
||||||
wxProgressDialog dlg(loading, loading);
|
wxProgressDialog dlg(loading, loading);
|
||||||
dlg.Pulse();
|
dlg.Pulse();
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
auto *new_model = (!load_model || one_by_one) ? nullptr : new Slic3r::Model();
|
auto *new_model = (!load_model || one_by_one) ? nullptr : new Slic3r::Model();
|
||||||
#else
|
|
||||||
auto *new_model = one_by_one ? nullptr : new Slic3r::Model();
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
std::vector<size_t> obj_idxs;
|
std::vector<size_t> obj_idxs;
|
||||||
|
|
||||||
for (size_t i = 0; i < input_files.size(); i++) {
|
for (size_t i = 0; i < input_files.size(); i++) {
|
||||||
|
@ -1292,11 +1285,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
|
||||||
{
|
{
|
||||||
DynamicPrintConfig config_loaded;
|
DynamicPrintConfig config_loaded;
|
||||||
model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, false);
|
model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, false);
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (load_config && !config_loaded.empty()) {
|
if (load_config && !config_loaded.empty()) {
|
||||||
#else
|
|
||||||
if (!config_loaded.empty()) {
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
// Based on the printer technology field found in the loaded config, select the base for the config,
|
// Based on the printer technology field found in the loaded config, select the base for the config,
|
||||||
PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
|
PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
|
||||||
config.apply(printer_technology == ptFFF ?
|
config.apply(printer_technology == ptFFF ?
|
||||||
|
@ -1306,19 +1295,16 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
|
||||||
config += std::move(config_loaded);
|
config += std::move(config_loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (load_config)
|
if (load_config)
|
||||||
{
|
{
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (!config.empty()) {
|
if (!config.empty()) {
|
||||||
Preset::normalize(config);
|
Preset::normalize(config);
|
||||||
wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config));
|
wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config));
|
||||||
wxGetApp().load_current_presets();
|
wxGetApp().load_current_presets();
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->update_config_dir(path.parent_path().string());
|
wxGetApp().app_config->update_config_dir(path.parent_path().string());
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
model = Slic3r::Model::read_from_file(path.string(), nullptr, false);
|
model = Slic3r::Model::read_from_file(path.string(), nullptr, false);
|
||||||
|
@ -1331,10 +1317,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (load_model)
|
if (load_model)
|
||||||
{
|
{
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
// The model should now be initialized
|
// The model should now be initialized
|
||||||
|
|
||||||
if (model.looks_like_multipart_object()) {
|
if (model.looks_like_multipart_object()) {
|
||||||
|
@ -1364,9 +1348,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
|
||||||
new_model->add_object(*model_object);
|
new_model->add_object(*model_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_model != nullptr) {
|
if (new_model != nullptr) {
|
||||||
|
@ -1383,16 +1365,13 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
|
||||||
obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
|
obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (load_model)
|
if (load_model)
|
||||||
{
|
{
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().string());
|
wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().string());
|
||||||
// XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames...
|
// XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames...
|
||||||
statusbar()->set_status_text(_(L("Loaded")));
|
statusbar()->set_status_text(_(L("Loaded")));
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
return obj_idxs;
|
return obj_idxs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1593,9 +1572,7 @@ void Plater::priv::delete_object_from_model(size_t obj_idx)
|
||||||
|
|
||||||
void Plater::priv::reset()
|
void Plater::priv::reset()
|
||||||
{
|
{
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
project_filename.Clear();
|
project_filename.Clear();
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
// Prevent toolpaths preview from rendering while we modify the Print object
|
// Prevent toolpaths preview from rendering while we modify the Print object
|
||||||
preview->set_enabled(false);
|
preview->set_enabled(false);
|
||||||
|
@ -2117,11 +2094,7 @@ void Plater::priv::on_schedule_background_process(SimpleEvent&)
|
||||||
void Plater::priv::on_action_add(SimpleEvent&)
|
void Plater::priv::on_action_add(SimpleEvent&)
|
||||||
{
|
{
|
||||||
if (q != nullptr)
|
if (q != nullptr)
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
q->add_model();
|
q->add_model();
|
||||||
#else
|
|
||||||
q->add();
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::on_action_split_objects(SimpleEvent&)
|
void Plater::priv::on_action_split_objects(SimpleEvent&)
|
||||||
|
@ -2332,7 +2305,6 @@ Print& Plater::fff_print() { return p->fff_print; }
|
||||||
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
|
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
|
||||||
SLAPrint& Plater::sla_print() { return p->sla_print; }
|
SLAPrint& Plater::sla_print() { return p->sla_print; }
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void Plater::load_project()
|
void Plater::load_project()
|
||||||
{
|
{
|
||||||
wxString input_file;
|
wxString input_file;
|
||||||
|
@ -2350,33 +2322,19 @@ void Plater::load_project()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::add_model()
|
void Plater::add_model()
|
||||||
#else
|
|
||||||
void Plater::add()
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
{
|
{
|
||||||
wxArrayString input_files;
|
wxArrayString input_files;
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxGetApp().import_model(this, input_files);
|
wxGetApp().import_model(this, input_files);
|
||||||
#else
|
|
||||||
wxGetApp().open_model(this, input_files);
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (input_files.empty())
|
if (input_files.empty())
|
||||||
return;
|
return;
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
std::vector<fs::path> input_paths;
|
std::vector<fs::path> input_paths;
|
||||||
for (const auto &file : input_files) {
|
for (const auto &file : input_files) {
|
||||||
input_paths.push_back(file.wx_str());
|
input_paths.push_back(file.wx_str());
|
||||||
}
|
}
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
load_files(input_paths, true, false);
|
load_files(input_paths, true, false);
|
||||||
#else
|
|
||||||
load_files(input_paths);
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void Plater::extract_config_from_project()
|
void Plater::extract_config_from_project()
|
||||||
{
|
{
|
||||||
wxString input_file;
|
wxString input_file;
|
||||||
|
@ -2389,13 +2347,8 @@ void Plater::extract_config_from_project()
|
||||||
input_paths.push_back(input_file.wx_str());
|
input_paths.push_back(input_file.wx_str());
|
||||||
load_files(input_paths, false, true);
|
load_files(input_paths, false, true);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config) { p->load_files(input_files, load_model, load_config); }
|
void Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config) { p->load_files(input_files, load_model, load_config); }
|
||||||
#else
|
|
||||||
void Plater::load_files(const std::vector<fs::path> &input_files) { p->load_files(input_files); }
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
void Plater::update() { p->update(); }
|
void Plater::update() { p->update(); }
|
||||||
|
|
||||||
|
@ -2611,23 +2564,16 @@ void Plater::export_amf()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void Plater::export_3mf(const boost::filesystem::path& output_path)
|
void Plater::export_3mf(const boost::filesystem::path& output_path)
|
||||||
#else
|
|
||||||
void Plater::export_3mf()
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
{
|
{
|
||||||
if (p->model.objects.empty()) { return; }
|
if (p->model.objects.empty()) { return; }
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
wxString path;
|
wxString path;
|
||||||
bool export_config = true;
|
bool export_config = true;
|
||||||
if (output_path.empty())
|
if (output_path.empty())
|
||||||
{
|
{
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
auto dialog = p->get_export_file(FT_3MF);
|
auto dialog = p->get_export_file(FT_3MF);
|
||||||
if (!dialog) { return; }
|
if (!dialog) { return; }
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
path = dialog->GetPath();
|
path = dialog->GetPath();
|
||||||
export_config = dialog->get_checkbox_value();
|
export_config = dialog->get_checkbox_value();
|
||||||
}
|
}
|
||||||
|
@ -2636,17 +2582,9 @@ void Plater::export_3mf()
|
||||||
|
|
||||||
if (!path.Lower().EndsWith(".3mf"))
|
if (!path.Lower().EndsWith(".3mf"))
|
||||||
return;
|
return;
|
||||||
#else
|
|
||||||
wxString path = dialog->GetPath();
|
|
||||||
auto path_cstr = path.c_str();
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config();
|
DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config();
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
if (Slic3r::store_3mf(path.c_str(), &p->model, export_config ? &cfg : nullptr)) {
|
if (Slic3r::store_3mf(path.c_str(), &p->model, export_config ? &cfg : nullptr)) {
|
||||||
#else
|
|
||||||
if (Slic3r::store_3mf(path_cstr, &p->model, dialog->get_checkbox_value() ? &cfg : nullptr)) {
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
// Success
|
// Success
|
||||||
p->statusbar()->set_status_text(wxString::Format(_(L("3MF file exported to %s")), path));
|
p->statusbar()->set_status_text(wxString::Format(_(L("3MF file exported to %s")), path));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2774,7 +2712,6 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||||
this->p->schedule_background_process();
|
this->p->schedule_background_process();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
const wxString& Plater::get_project_filename() const
|
const wxString& Plater::get_project_filename() const
|
||||||
{
|
{
|
||||||
return p->project_filename;
|
return p->project_filename;
|
||||||
|
@ -2784,7 +2721,6 @@ bool Plater::is_export_gcode_scheduled() const
|
||||||
{
|
{
|
||||||
return p->background_process.is_export_scheduled();
|
return p->background_process.is_export_scheduled();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
int Plater::get_selected_object_idx()
|
int Plater::get_selected_object_idx()
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
void set_label_marker(int item);
|
void set_label_marker(int item);
|
||||||
void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; }
|
void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; }
|
||||||
int get_extruder_idx() const { return extruder_idx; }
|
int get_extruder_idx() const { return extruder_idx; }
|
||||||
|
void check_selection();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::size_t Marker;
|
typedef std::size_t Marker;
|
||||||
|
@ -116,19 +117,11 @@ public:
|
||||||
const SLAPrint& sla_print() const;
|
const SLAPrint& sla_print() const;
|
||||||
SLAPrint& sla_print();
|
SLAPrint& sla_print();
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void load_project();
|
void load_project();
|
||||||
void add_model();
|
void add_model();
|
||||||
void extract_config_from_project();
|
void extract_config_from_project();
|
||||||
#else
|
|
||||||
void add();
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true);
|
void load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true);
|
||||||
#else
|
|
||||||
void load_files(const std::vector<boost::filesystem::path> &input_files);
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void select_view(const std::string& direction);
|
void select_view(const std::string& direction);
|
||||||
|
@ -149,11 +142,7 @@ public:
|
||||||
void export_gcode(boost::filesystem::path output_path = boost::filesystem::path());
|
void export_gcode(boost::filesystem::path output_path = boost::filesystem::path());
|
||||||
void export_stl();
|
void export_stl();
|
||||||
void export_amf();
|
void export_amf();
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
|
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
|
||||||
#else
|
|
||||||
void export_3mf();
|
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
void reslice();
|
void reslice();
|
||||||
void changed_object(int obj_idx);
|
void changed_object(int obj_idx);
|
||||||
void fix_through_netfabb(const int obj_idx);
|
void fix_through_netfabb(const int obj_idx);
|
||||||
|
@ -162,10 +151,8 @@ public:
|
||||||
void on_extruders_change(int extruders_count);
|
void on_extruders_change(int extruders_count);
|
||||||
void on_config_change(const DynamicPrintConfig &config);
|
void on_config_change(const DynamicPrintConfig &config);
|
||||||
|
|
||||||
#if ENABLE_NEW_MENU_LAYOUT
|
|
||||||
const wxString& get_project_filename() const;
|
const wxString& get_project_filename() const;
|
||||||
bool is_export_gcode_scheduled() const;
|
bool is_export_gcode_scheduled() const;
|
||||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
|
||||||
|
|
||||||
int get_selected_object_idx();
|
int get_selected_object_idx();
|
||||||
bool is_single_full_object_selection() const;
|
bool is_single_full_object_selection() const;
|
||||||
|
|
Loading…
Reference in a new issue