From 7ed80e0a8d354ea30d67e8e5cef156b22643f92f Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 6 Jan 2022 11:43:05 +0100 Subject: Tech ENABLE_SPIRAL_VASE_LAYERS - 1st installment - Per-layer preview for spiral vase mode --- src/slic3r/GUI/GCodeViewer.cpp | 10 ++++++++++ src/slic3r/GUI/GCodeViewer.hpp | 8 +++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 06370de6e..52c1bf929 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2040,6 +2040,16 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) sort_remove_duplicates(m_extruder_ids); m_extruder_ids.shrink_to_fit(); +#if ENABLE_SPIRAL_VASE_LAYERS + // replace layers for spiral vase mode + if (!gcode_result.spiral_vase_layers.empty()) { + m_layers.reset(); + for (const auto& layer : gcode_result.spiral_vase_layers) { + m_layers.append(layer.first, { layer.second.first, layer.second.second }); + } + } +#endif // ENABLE_SPIRAL_VASE_LAYERS + // set layers z range if (!m_layers.empty()) m_layers_z_range = { 0, static_cast(m_layers.size() - 1) }; diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index c56e88c88..a67208f10 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -448,9 +448,8 @@ class GCodeViewer size_t first{ 0 }; size_t last{ 0 }; - bool operator == (const Endpoints& other) const { - return first == other.first && last == other.last; - } + bool operator == (const Endpoints& other) const { return first == other.first && last == other.last; } + bool operator != (const Endpoints& other) const { return !operator==(other); } }; private: @@ -479,9 +478,8 @@ class GCodeViewer bool operator != (const Layers& other) const { if (m_zs != other.m_zs) return true; - if (!(m_endpoints == other.m_endpoints)) + if (m_endpoints != other.m_endpoints) return true; - return false; } }; -- cgit v1.2.3