ENABLE_GCODE_VIEWER_AS_STATE -> Fixed toolpaths visualization when switching between states and when exporting g-code

This commit is contained in:
enricoturri1966 2020-06-22 11:49:58 +02:00
parent 2a90cd2849
commit dc6f97a6ad
4 changed files with 32 additions and 4 deletions

View File

@ -510,11 +510,9 @@ void Preview::reload_print(bool keep_volumes)
!keep_volumes)
{
m_canvas->reset_volumes();
#if ENABLE_GCODE_VIEWER
m_canvas->reset_gcode_toolpaths();
#else
#if !ENABLE_GCODE_VIEWER
m_canvas->reset_legend_texture();
#endif // ENABLE_GCODE_VIEWER
#endif // !ENABLE_GCODE_VIEWER
m_loaded = false;
#ifdef __linux__
m_volumes_cleanup_required = false;

View File

@ -1414,6 +1414,7 @@ void MainFrame::set_mode(EMode mode)
#endif // ENABLE_LAYOUT_NO_RESTART
m_plater->reset();
m_plater->reset_gcode_toolpaths();
m_plater->Freeze();
@ -1457,6 +1458,7 @@ void MainFrame::set_mode(EMode mode)
m_plater->reset();
m_plater->reset_last_loaded_gcode();
m_plater->reset_gcode_toolpaths();
m_plater->Freeze();

View File

@ -1701,6 +1701,10 @@ struct Plater::priv
void update_preview_moves_slider();
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER
void reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
void reset_all_gizmos();
void update_ui_from_settings();
void update_main_toolbar_tooltips();
@ -4008,6 +4012,13 @@ void Plater::priv::update_preview_moves_slider()
}
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER
void Plater::priv::reset_gcode_toolpaths()
{
preview->get_canvas3d()->reset_gcode_toolpaths();
}
#endif // ENABLE_GCODE_VIEWER
bool Plater::priv::can_set_instance_to_object() const
{
const int obj_idx = get_selected_object_idx();
@ -5060,6 +5071,9 @@ void Plater::reslice()
if ((state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) != 0)
return;
#if ENABLE_GCODE_VIEWER
bool clean_gcode_toolpaths = true;
#endif // ENABLE_GCODE_VIEWER
if (p->background_process.running())
{
if (wxGetApp().get_mode() == comSimple)
@ -5072,6 +5086,13 @@ void Plater::reslice()
}
else if (!p->background_process.empty() && !p->background_process.idle())
p->show_action_buttons(true);
#if ENABLE_GCODE_VIEWER
else
clean_gcode_toolpaths = false;
if (clean_gcode_toolpaths)
reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
// update type of preview
p->preview->update_view_type(true);
@ -5750,6 +5771,11 @@ void Plater::update_preview_moves_slider()
{
p->update_preview_moves_slider();
}
void Plater::reset_gcode_toolpaths()
{
p->reset_gcode_toolpaths();
}
#endif // ENABLE_GCODE_VIEWER
const Mouse3DController& Plater::get_mouse3d_controller() const

View File

@ -350,6 +350,8 @@ public:
#if ENABLE_GCODE_VIEWER
void update_preview_bottom_toolbar();
void update_preview_moves_slider();
void reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER_AS_STATE