mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-07-31 11:15:52 +00:00
Fix of
https://github.com/prusa3d/Slic3r/issues/1142 https://github.com/prusa3d/Slic3r/issues/1257 The preset keys not belonging into the config group are removed and the problem is reported into the boost::log
This commit is contained in:
@@ -417,7 +417,14 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
|
||||
try {
|
||||
Preset preset(m_type, name, false);
|
||||
preset.file = dir_entry.path().string();
|
||||
preset.load(keys);
|
||||
DynamicPrintConfig &config = preset.load(keys);
|
||||
// Report configuration fields, which are misplaced into a wrong group.
|
||||
std::string incorrect_keys;
|
||||
if (config.remove_keys_not_in(this->default_preset().config, incorrect_keys) > 0)
|
||||
BOOST_LOG_TRIVIAL(error) << "Error in \"" << dir_entry.path().string() << "\": The preset contains the following incorrect keys: " <<
|
||||
incorrect_keys << ", which were ignored";
|
||||
// Normalize once again to set the length of the filament specific vectors to 1.
|
||||
Preset::normalize(config);
|
||||
m_presets.emplace_back(preset);
|
||||
} catch (const std::runtime_error &err) {
|
||||
errors_cummulative += err.what();
|
||||
|
||||
@@ -919,24 +919,12 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
|
||||
DynamicPrintConfig config(default_config);
|
||||
for (auto &kvp : section.second)
|
||||
config.set_deserialize(kvp.first, kvp.second.data());
|
||||
Preset::normalize(config);
|
||||
// Report configuration fields, which are misplaced into a wrong group.
|
||||
std::string incorrect_keys;
|
||||
size_t n_incorrect_keys = 0;
|
||||
for (const std::string &key : config.keys())
|
||||
if (! default_config.has(key)) {
|
||||
if (incorrect_keys.empty())
|
||||
incorrect_keys = key;
|
||||
else {
|
||||
incorrect_keys += ", ";
|
||||
incorrect_keys += key;
|
||||
}
|
||||
config.erase(key);
|
||||
++ n_incorrect_keys;
|
||||
}
|
||||
if (! incorrect_keys.empty())
|
||||
if (config.remove_keys_not_in(default_config, incorrect_keys) > 0)
|
||||
BOOST_LOG_TRIVIAL(error) << "Error in a Vendor Config Bundle \"" << path << "\": The printer preset \"" <<
|
||||
section.first << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed";
|
||||
section.first << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed";
|
||||
Preset::normalize(config);
|
||||
if ((flags & LOAD_CFGBNDLE_SYSTEM) && presets == &printers) {
|
||||
// Filter out printer presets, which are not mentioned in the vendor profile.
|
||||
// These presets are considered not installed.
|
||||
|
||||
Reference in New Issue
Block a user