FIX: [STUDIO-1933] show ams filament as Generic type if id not found

Change-Id: I5ffd499ea16275479c6685dc6795ad240f59fa37
This commit is contained in:
chunmao.guo 2023-01-10 14:57:16 +08:00 committed by Lane.Wei
parent 110beef8e1
commit 851cdad5f3

View file

@ -378,6 +378,11 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
std::string filament_id = f.opt_string("filament_id", 0u);
auto iter = std::find_if(filaments.begin(), filaments.end(),
[&filament_id](auto &f) { return f.is_compatible && f.is_system && f.filament_id == filament_id; });
if (iter == filaments.end()) {
auto filament_type = "Generic " + f.opt_string("filament_type", 0u);
iter = std::find_if(filaments.begin(), filaments.end(),
[&filament_type](auto &f) { return f.is_compatible && f.is_system && boost::algorithm::starts_with(f.name, filament_type); });
}
if (iter == filaments.end()) {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": filament_id %1% not found or system or compatible") % filament_id;
continue;