From ef90d48e6e2f6ce5963429fd3b3c30d76351546b Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Thu, 1 Feb 2024 22:38:45 +0800 Subject: [PATCH] Better way of storing the global scarf state --- src/libslic3r/GCode.cpp | 8 +------- src/libslic3r/PrintApply.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index a5af3db3574..3a1fdb02a13 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1913,14 +1913,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato { PROFILE_FUNC(); - PrintConfig print_config(print.config()); - { - const auto o = print.objects(); - print_config.has_scarf_joint_seam.value = std::any_of(o.begin(), o.end(), - [](const PrintObject* obj) { return obj->config().seam_slope_enabled; }); - } // modifies m_silent_time_estimator_enabled - DoExport::init_gcode_processor(print_config, m_processor, m_silent_time_estimator_enabled); + DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled); const bool is_bbl_printers = print.is_BBL_printer(); m_calib_config.clear(); diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp index 76598cca220..2b81518c3a1 100644 --- a/src/libslic3r/PrintApply.cpp +++ b/src/libslic3r/PrintApply.cpp @@ -1041,6 +1041,19 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_ else m_support_used = false; + { + const auto& o = model.objects; + const bool has_scarf_joint_seam = std::any_of(o.begin(), o.end(), [&new_full_config](ModelObject* obj) { + return obj->get_config_value(new_full_config, "seam_slope_enabled")->value; + }); + + if (has_scarf_joint_seam) { + new_full_config.set("has_scarf_joint_seam", true); + } + + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", has_scarf_joint_seam:" << has_scarf_joint_seam; + } + // Find modified keys of the various configs. Resolve overrides extruder retract values by filament profiles. DynamicPrintConfig filament_overrides; //BBS: add plate index