From a3874a410fc5e763f1e97a782799a7f7fbdc8167 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 30 Nov 2021 10:55:00 +0100 Subject: [PATCH] Tech ENABLE_FIX_PREVIEW_OPTIONS_Z set as default --- src/libslic3r/GCode/GCodeProcessor.cpp | 18 +----------------- src/libslic3r/GCode/GCodeProcessor.hpp | 4 ---- src/libslic3r/Technologies.hpp | 2 -- src/slic3r/GUI/GCodeViewer.cpp | 4 ---- 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index b28d3d706..3889321b2 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -813,9 +813,7 @@ bool GCodeProcessor::contains_reserved_tags(const std::string& gcode, unsigned i } GCodeProcessor::GCodeProcessor() -#if ENABLE_FIX_PREVIEW_OPTIONS_Z : m_options_z_corrector(m_result) -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z { reset(); m_time_processor.machines[static_cast(PrintEstimatedStatistics::ETimeMode::Normal)].line_m73_main_mask = "M73 P%s R%s\n"; @@ -1179,9 +1177,7 @@ void GCodeProcessor::reset() m_use_volumetric_e = false; m_last_default_color_id = 0; -#if ENABLE_FIX_PREVIEW_OPTIONS_Z m_options_z_corrector.reset(); -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z #if ENABLE_GCODE_VIEWER_DATA_CHECKING m_mm3_per_mm_compare.reset(); @@ -1845,9 +1841,7 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers store_move_vertex(EMoveType::Color_change); CustomGCode::Item item = { static_cast(m_end_position[2]), CustomGCode::ColorChange, extruder_id + 1, color, "" }; m_result.custom_gcode_per_print_z.emplace_back(item); -#if ENABLE_FIX_PREVIEW_OPTIONS_Z m_options_z_corrector.set(); -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z process_custom_gcode_time(CustomGCode::ColorChange); process_filaments(CustomGCode::ColorChange); } @@ -1860,9 +1854,7 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers store_move_vertex(EMoveType::Pause_Print); CustomGCode::Item item = { static_cast(m_end_position[2]), CustomGCode::PausePrint, m_extruder_id + 1, "", "" }; m_result.custom_gcode_per_print_z.emplace_back(item); -#if ENABLE_FIX_PREVIEW_OPTIONS_Z m_options_z_corrector.set(); -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z process_custom_gcode_time(CustomGCode::PausePrint); return; } @@ -1872,9 +1864,7 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers store_move_vertex(EMoveType::Custom_GCode); CustomGCode::Item item = { static_cast(m_end_position[2]), CustomGCode::Custom, m_extruder_id + 1, "", "" }; m_result.custom_gcode_per_print_z.emplace_back(item); -#if ENABLE_FIX_PREVIEW_OPTIONS_Z m_options_z_corrector.set(); -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z return; } @@ -2455,12 +2445,8 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) if (m_forced_height > 0.0f) m_height = m_forced_height; else { - if (m_end_position[Z] > m_extruded_last_z + EPSILON) { + if (m_end_position[Z] > m_extruded_last_z + EPSILON) m_height = m_end_position[Z] - m_extruded_last_z; -#if !ENABLE_FIX_PREVIEW_OPTIONS_Z - m_extruded_last_z = m_end_position[Z]; -#endif // !ENABLE_FIX_PREVIEW_OPTIONS_Z - } } if (m_height == 0.0f) @@ -2469,10 +2455,8 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) if (m_end_position[Z] == 0.0f) m_end_position[Z] = m_height; -#if ENABLE_FIX_PREVIEW_OPTIONS_Z m_extruded_last_z = m_end_position[Z]; m_options_z_corrector.update(m_height); -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z #if ENABLE_GCODE_VIEWER_DATA_CHECKING m_height_compare.update(m_height, m_extrusion_role); diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index a7c1144f0..485cb87c8 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -389,7 +389,6 @@ namespace Slic3r { bool has_first_vertex() const { return m_first_vertex.has_value(); } }; -#if ENABLE_FIX_PREVIEW_OPTIONS_Z // Helper class used to fix the z for color change, pause print and // custom gcode markes class OptionsZCorrector @@ -426,7 +425,6 @@ namespace Slic3r { m_custom_gcode_per_print_z_id.reset(); } }; -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z #if ENABLE_GCODE_VIEWER_DATA_CHECKING struct DataChecker @@ -532,9 +530,7 @@ namespace Slic3r { CpColor m_cp_color; bool m_use_volumetric_e; SeamsDetector m_seams_detector; -#if ENABLE_FIX_PREVIEW_OPTIONS_Z OptionsZCorrector m_options_z_corrector; -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z size_t m_last_default_color_id; #if ENABLE_GCODE_VIEWER_STATISTICS std::chrono::time_point m_start_time; diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 3dd5bd363..2a2b3e587 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -41,8 +41,6 @@ //==================== #define ENABLE_2_4_0_ALPHA2 1 -// Enable fixing the z position of color change, pause print and custom gcode markers in preview -#define ENABLE_FIX_PREVIEW_OPTIONS_Z (1 && ENABLE_2_4_0_ALPHA2) // Enable replacing a missing file during reload from disk command #define ENABLE_RELOAD_FROM_DISK_REPLACE_FILE (1 && ENABLE_2_4_0_ALPHA2) // Enable fixing the synchronization of seams with the horizontal slider in preview diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index eb84637a3..9ca84bb9a 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2545,11 +2545,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool if (m_sequential_view.current.first <= buffer.model.instances.s_ids.back() && buffer.model.instances.s_ids.front() <= m_sequential_view.current.last) { for (size_t id : buffer.model.instances.s_ids) { if (has_second_range) { -#if ENABLE_FIX_PREVIEW_OPTIONS_Z if (id < m_sequential_view.endpoints.first) { -#else - if (id <= m_sequential_view.endpoints.first) { -#endif // ENABLE_FIX_PREVIEW_OPTIONS_Z ++buffer.model.instances.render_ranges.ranges.front().offset; if (id <= m_sequential_view.current.first) ++buffer.model.instances.render_ranges.ranges.back().offset;