New gcode visualization integration - Fixed pre-gcode preview layers times

This commit is contained in:
enricoturri1966 2023-12-12 11:03:19 +01:00 committed by Lukas Matena
parent 160d9b0187
commit 00a19fe4eb
3 changed files with 17 additions and 1 deletions

View File

@ -2703,6 +2703,7 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co
#if ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_VIEWER
m_gcode_viewer.enable_legend(true); m_gcode_viewer.enable_legend(true);
m_gcode_viewer.load_as_gcode(gcode_result, *this->fff_print(), str_tool_colors); m_gcode_viewer.load_as_gcode(gcode_result, *this->fff_print(), str_tool_colors);
m_gcode_layers_times_cache = m_gcode_viewer.get_layers_times();
#else #else
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
m_gcode_viewer.load(gcode_result, *this->fff_print()); m_gcode_viewer.load(gcode_result, *this->fff_print());

View File

@ -597,6 +597,13 @@ private:
ArrangeSettingsDb_AppCfg m_arrange_settings_db; ArrangeSettingsDb_AppCfg m_arrange_settings_db;
ArrangeSettingsDialogImgui m_arrange_settings_dialog; ArrangeSettingsDialogImgui m_arrange_settings_dialog;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER
// used to show layers times on the layers slider when pre-gcode view is active
std::vector<float> m_gcode_layers_times_cache;
#endif // ENABLE_NEW_GCODE_VIEWER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
public: public:
struct ContoursList struct ContoursList
@ -846,6 +853,9 @@ public:
std::vector<double> get_gcode_layers_zs() const; std::vector<double> get_gcode_layers_zs() const;
std::vector<float> get_gcode_layers_times() const { return m_gcode_viewer.get_layers_times(); } std::vector<float> get_gcode_layers_times() const { return m_gcode_viewer.get_layers_times(); }
std::vector<float> get_gcode_layers_times(libvgcode::ETimeMode mode) const { return m_gcode_viewer.get_layers_times(mode); } std::vector<float> get_gcode_layers_times(libvgcode::ETimeMode mode) const { return m_gcode_viewer.get_layers_times(mode); }
const std::vector<float>& get_gcode_layers_times_cache() const { return m_gcode_layers_times_cache; }
void reset_gcode_layers_times_cache() { m_gcode_layers_times_cache.clear(); }
#else #else
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
bool is_gcode_legend_enabled() const { return m_gcode_viewer.is_legend_enabled(); } bool is_gcode_legend_enabled() const { return m_gcode_viewer.is_legend_enabled(); }

View File

@ -551,7 +551,7 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
auto print_mode_stat = m_gcode_result->print_statistics.modes.front(); auto print_mode_stat = m_gcode_result->print_statistics.modes.front();
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_VIEWER
m_layers_slider->SetLayersTimes(m_canvas->get_gcode_layers_times(), print_mode_stat.time); m_layers_slider->SetLayersTimes(m_canvas->get_gcode_layers_times_cache(), print_mode_stat.time);
#else #else
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
m_layers_slider->SetLayersTimes(print_mode_stat.layers_times, print_mode_stat.time); m_layers_slider->SetLayersTimes(print_mode_stat.layers_times, print_mode_stat.time);
@ -854,6 +854,11 @@ void Preview::load_print_as_fff(bool keep_z_range)
} }
if (wxGetApp().is_editor() && !has_layers) { if (wxGetApp().is_editor() && !has_layers) {
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER
m_canvas->reset_gcode_layers_times_cache();
#endif // ENABLE_NEW_GCODE_VIEWER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
hide_layers_slider(); hide_layers_slider();
m_left_sizer->Hide(m_bottom_toolbar_panel); m_left_sizer->Hide(m_bottom_toolbar_panel);
m_left_sizer->Layout(); m_left_sizer->Layout();