GCodeViewer -> Allow to switch to gcode viewer state when an sla printer is selected
This commit is contained in:
parent
34759f9a70
commit
99a15af03d
@ -434,6 +434,10 @@ void MainFrame::shutdown()
|
||||
// restore sidebar if it was hidden when switching to gcode viewer mode
|
||||
if (m_restore_from_gcode_viewer.collapsed_sidebar)
|
||||
m_plater->collapse_sidebar(false);
|
||||
|
||||
// restore sla printer if it was deselected when switching to gcode viewer mode
|
||||
if (m_restore_from_gcode_viewer.sla_technology)
|
||||
m_plater->set_printer_technology(ptSLA);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Stop the background thread (Windows and Linux).
|
||||
// Disconnect from a 3DConnextion driver (OSX).
|
||||
@ -1010,8 +1014,7 @@ void MainFrame::init_menubar()
|
||||
wxMessageDialog((wxWindow*)this, _L("Switching to G-code preview mode will remove all objects, continue?"),
|
||||
wxString(SLIC3R_APP_NAME) + " - " + _L("Switch to G-code preview mode"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION | wxCENTRE).ShowModal() == wxID_YES)
|
||||
set_mode(EMode::GCodeViewer);
|
||||
}, "", nullptr,
|
||||
[this]() { return m_plater != nullptr && m_plater->printer_technology() != ptSLA; }, this);
|
||||
}, "", nullptr);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
fileMenu->AppendSeparator();
|
||||
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
|
||||
@ -1329,6 +1332,12 @@ void MainFrame::set_mode(EMode mode)
|
||||
m_plater->clear_undo_redo_stack_main();
|
||||
m_plater->take_snapshot(_L("New Project"));
|
||||
|
||||
// restore sla printer if it was deselected when switching to gcode viewer mode
|
||||
if (m_restore_from_gcode_viewer.sla_technology) {
|
||||
m_plater->set_printer_technology(ptSLA);
|
||||
m_restore_from_gcode_viewer.sla_technology = false;
|
||||
}
|
||||
|
||||
// switch view
|
||||
m_plater->select_view_3D("3D");
|
||||
m_plater->select_view("iso");
|
||||
@ -1371,6 +1380,9 @@ void MainFrame::set_mode(EMode mode)
|
||||
m_plater->clear_undo_redo_stack_main();
|
||||
m_plater->take_snapshot(_L("New Project"));
|
||||
|
||||
// switch to FFF printer mode
|
||||
m_restore_from_gcode_viewer.sla_technology = m_plater->set_printer_technology(ptFFF);
|
||||
|
||||
// switch view
|
||||
m_plater->select_view_3D("Preview");
|
||||
m_plater->select_view("iso");
|
||||
|
@ -76,6 +76,7 @@ class MainFrame : public DPIFrame
|
||||
{
|
||||
bool collapsed_sidebar{ false };
|
||||
bool collapse_toolbar_enabled{ false };
|
||||
bool sla_technology{ false };
|
||||
};
|
||||
|
||||
RestoreFromGCodeViewer m_restore_from_gcode_viewer;
|
||||
|
@ -5596,12 +5596,23 @@ PrinterTechnology Plater::printer_technology() const
|
||||
|
||||
const DynamicPrintConfig * Plater::config() const { return p->config; }
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool Plater::set_printer_technology(PrinterTechnology printer_technology)
|
||||
#else
|
||||
void Plater::set_printer_technology(PrinterTechnology printer_technology)
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
{
|
||||
p->printer_technology = printer_technology;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool ret = p->background_process.select_technology(printer_technology);
|
||||
if (ret) {
|
||||
// Update the active presets.
|
||||
}
|
||||
#else
|
||||
if (p->background_process.select_technology(printer_technology)) {
|
||||
// Update the active presets.
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
//FIXME for SLA synchronize
|
||||
//p->background_process.apply(Model)!
|
||||
|
||||
@ -5618,6 +5629,10 @@ void Plater::set_printer_technology(PrinterTechnology printer_technology)
|
||||
p->update_main_toolbar_tooltips();
|
||||
|
||||
p->sidebar->get_searcher().set_printer_technology(printer_technology);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
return ret;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void Plater::changed_object(int obj_idx)
|
||||
|
@ -263,7 +263,11 @@ public:
|
||||
|
||||
PrinterTechnology printer_technology() const;
|
||||
const DynamicPrintConfig * config() const;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool set_printer_technology(PrinterTechnology printer_technology);
|
||||
#else
|
||||
void set_printer_technology(PrinterTechnology printer_technology);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void copy_selection_to_clipboard();
|
||||
void paste_from_clipboard();
|
||||
|
Loading…
Reference in New Issue
Block a user