From 349dd60940dc7fcd3bce127a3a88952ed13f9e0f Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Sep 2020 09:18:20 +0200 Subject: [PATCH] Small refactoring --- src/slic3r/GUI/GCodeViewer.cpp | 20 ++++++++++---------- src/slic3r/GUI/GCodeViewer.hpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 76b0e02fc..831a3885e 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -392,7 +392,7 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std: auto start_time = std::chrono::high_resolution_clock::now(); #endif // ENABLE_GCODE_VIEWER_STATISTICS - if (m_vertices_count == 0) + if (m_moves_count == 0) return; wxBusyCursor busy; @@ -406,7 +406,7 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std: // update ranges for coloring / legend m_extrusions.reset_ranges(); - for (size_t i = 0; i < m_vertices_count; ++i) { + for (size_t i = 0; i < m_moves_count; ++i) { // skip first vertex if (i == 0) continue; @@ -457,7 +457,7 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std: void GCodeViewer::reset() { - m_vertices_count = 0; + m_moves_count = 0; for (TBuffer& buffer : m_buffers) { buffer.reset(); } @@ -882,11 +882,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) #endif // ENABLE_GCODE_VIEWER_STATISTICS // vertices data - m_vertices_count = gcode_result.moves.size(); - if (m_vertices_count == 0) + m_moves_count = gcode_result.moves.size(); + if (m_moves_count == 0) return; - for (size_t i = 0; i < m_vertices_count; ++i) { + for (size_t i = 0; i < m_moves_count; ++i) { const GCodeProcessor::MoveVertex& move = gcode_result.moves[i]; if (wxGetApp().is_gcode_viewer()) // for the gcode viewer we need all moves to correctly size the printbed @@ -1174,7 +1174,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) // toolpaths data -> extract from result std::vector> vertices(m_buffers.size()); std::vector> indices(m_buffers.size()); - for (size_t i = 0; i < m_vertices_count; ++i) { + for (size_t i = 0; i < m_moves_count; ++i) { // skip first vertex if (i == 0) continue; @@ -1257,7 +1257,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) #endif // ENABLE_GCODE_VIEWER_STATISTICS // layers zs / roles / extruder ids / cp color ids -> extract from result - for (size_t i = 0; i < m_vertices_count; ++i) { + for (size_t i = 0; i < m_moves_count; ++i) { const GCodeProcessor::MoveVertex& move = gcode_result.moves[i]; if (move.type == EMoveType::Extrude) m_layers_zs.emplace_back(static_cast(move.position[2])); @@ -1410,12 +1410,12 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool m_statistics.render_paths_size = 0; #endif // ENABLE_GCODE_VIEWER_STATISTICS - m_sequential_view.endpoints.first = m_vertices_count; + m_sequential_view.endpoints.first = m_moves_count; m_sequential_view.endpoints.last = 0; if (!keep_sequential_current_first) m_sequential_view.current.first = 0; if (!keep_sequential_current_last) - m_sequential_view.current.last = m_vertices_count; + m_sequential_view.current.last = m_moves_count; // first pass: collect visible paths and update sequential view data std::vector> paths; diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index abda780af..50e41f4cf 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -375,7 +375,7 @@ public: private: unsigned int m_last_result_id{ 0 }; - size_t m_vertices_count{ 0 }; + size_t m_moves_count{ 0 }; mutable std::vector m_buffers{ static_cast(EMoveType::Extrude) }; // bounding box of toolpaths BoundingBoxf3 m_paths_bounding_box;