ENH: protect build ams list
jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I4e8665df0bb24f056f79bd5cabab886bb5ff7921
This commit is contained in:
parent
23a0069a4d
commit
6d1b8f0324
|
@ -329,7 +329,7 @@ Semver PresetBundle::get_vendor_profile_version(std::string vendor_name)
|
|||
std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const std::string& filament_id) const
|
||||
{
|
||||
if (filament_id.empty())
|
||||
return {};
|
||||
return std::nullopt;
|
||||
|
||||
// basic filament info should be same in the parent preset and child preset
|
||||
// so just match the filament id is enough
|
||||
|
@ -355,7 +355,7 @@ std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const
|
|||
return info;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
//BBS: load project embedded presets
|
||||
|
|
|
@ -55,10 +55,10 @@ struct FilamentBaseInfo
|
|||
std::string filament_id;
|
||||
std::string filament_type;
|
||||
std::string vendor;
|
||||
int nozzle_temp_range_low;
|
||||
int nozzle_temp_range_high;
|
||||
bool is_support;
|
||||
bool is_system;
|
||||
int nozzle_temp_range_low{ 220 };
|
||||
int nozzle_temp_range_high{ 220 };
|
||||
bool is_support{ false };
|
||||
bool is_system{ true };
|
||||
};
|
||||
|
||||
// Bundle of Print + Filament + Printer presets.
|
||||
|
|
|
@ -2834,8 +2834,11 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
|
|||
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{into_u8(wxColour("#" + tray.color).GetAsString(wxC2S_HTML_SYNTAX))});
|
||||
tray_config.set_key_value("filament_exist", new ConfigOptionBools{tray.is_exists});
|
||||
tray_config.set_key_value("filament_multi_colors", new ConfigOptionStrings{});
|
||||
auto info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray.setting_id);
|
||||
tray_config.set_key_value("filament_is_support", new ConfigOptionBools{ info ? info->is_support : false });
|
||||
std::optional<FilamentBaseInfo> info;
|
||||
if (wxGetApp().preset_bundle) {
|
||||
info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray.setting_id);
|
||||
}
|
||||
tray_config.set_key_value("filament_is_support", new ConfigOptionBools{ info.has_value() ? info->is_support : false});
|
||||
for (int i = 0; i < tray.cols.size(); ++i) {
|
||||
tray_config.opt<ConfigOptionStrings>("filament_multi_colors")->values.push_back(into_u8(wxColour("#" + tray.cols[i]).GetAsString(wxC2S_HTML_SYNTAX)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue