Fix broken editing of filament in device

This commit is contained in:
Lam Wei Lun
2026-09-25 11:54:34 +08:00
parent d69d14d6f8
commit 5f589ff909
7 changed files with 107 additions and 54 deletions
+3 -10
View File
@@ -378,16 +378,9 @@ wxString MachineObject::get_printer_type_display_str() const
{
std::string display_name = DevPrinterConfigUtil::get_printer_display_name(printer_type);
// Bambu printers use m_resource_file_path + "/printers/" + type_str + ".json", which is a semantic that only works for their profiles.
// For any other profile, we can simply consult preset bundle if the model_id exists.
if (display_name.empty()) {
for (const auto& [vendor_id, vendor] : GUI::wxGetApp().preset_bundle->vendors) {
for (const auto& model : vendor.models) {
if (printer_type == model.model_id)
display_name = model.name;
}
}
}
// Bambu names come from Bambu configs; other vendors resolve through preset model IDs.
if (display_name.empty() && GUI::wxGetApp().preset_bundle)
display_name = GUI::wxGetApp().preset_bundle->get_printer_model_display_name(printer_type);
if (!display_name.empty())
return display_name;