From 7c48eac83226fa3daf2bceacc0d3f681a1cbad45 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 19 Jul 2024 15:14:58 +0800 Subject: [PATCH] ENH: config: refine some small logic 1. always resize filament count when not matched in full_fff_print 2. remove no-use codes in Preset::normalize jira: no-jira Change-Id: Ie15a5977d28f28e0f63ba84f27f98f77d16665c0 (cherry picked from commit f122c4f4ef6f476c4e8190a0872e566d690d6c25) --- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PresetBundle.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 8ee923cac7..e4bad2c723 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -351,7 +351,7 @@ void Preset::normalize(DynamicPrintConfig &config) static_cast(opt)->resize(n, defaults.option(key)); } // The following keys are mandatory for the UI, but they are not part of FullPrintConfig, therefore they are handled separately. - for (const std::string key : { "filament_settings_id" }) { + for (const std::string &key : { "filament_settings_id" }) { auto *opt = config.option(key, false); assert(opt == nullptr || opt->type() == coStrings); if (opt != nullptr && opt->type() == coStrings) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 2e88552926..594cf0f3da 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -2173,7 +2173,8 @@ DynamicPrintConfig PresetBundle::full_fff_config(bool apply_extruder, std::vecto // BBS size_t num_filaments = this->filament_presets.size(); - if (filament_maps.empty()) { + //in some middle state, they may be different + if (filament_maps.size() != num_filaments) { filament_maps.resize(num_filaments, 1); }