diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 81000157bf..4fded0d1a0 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1278,8 +1278,8 @@ void PresetCollection::load_presets( preset.filament_id = key_values[BBL_JSON_KEY_FILAMENT_ID]; if (key_values.find(BBL_JSON_KEY_DESCRIPTION) != key_values.end()) preset.description = key_values[BBL_JSON_KEY_DESCRIPTION]; - if (key_values.find("instantiation") != key_values.end()) - preset.is_visible = key_values["instantiation"] != "false"; + if (key_values.find(BBL_JSON_KEY_INSTANTIATION) != key_values.end()) + preset.is_visible = key_values[BBL_JSON_KEY_INSTANTIATION] != "false"; //Orca: find and use the inherit config as the base Preset* inherit_preset = nullptr; @@ -1327,6 +1327,18 @@ void PresetCollection::load_presets( << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed"; } + if (preset.type == Preset::TYPE_FILAMENT && preset.is_user() && preset.inherits().empty()) { + auto compatible_printers = dynamic_cast(preset.config.option("compatible_printers", true)); + if (compatible_printers && compatible_printers->values.empty()) { + size_t at_pos = name.find('@'); + if (at_pos != std::string::npos && at_pos + 1 < name.length()) { + compatible_printers->values.push_back(name.substr(at_pos + 1)); + preset.save(nullptr); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " added compatible_printers for preset: " << name; + } + } + } + preset.loaded = true; //BBS: add some workaround for previous incorrect settings if ((!preset.setting_id.empty())&&(preset.setting_id == preset.base_id)) @@ -1356,6 +1368,7 @@ void PresetCollection::load_presets( if (fs::exists(file_path)) fs::remove(file_path); } + presets_loaded.emplace_back(preset); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " load config successful and preset name is:" << preset.name; } catch (const std::runtime_error &err) {