From 473c7fb3ef55427cb6d9cdf3258b0f740648adce Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 24 Sep 2024 19:42:47 +0800 Subject: [PATCH] Fix a bed type regression (#6893) --- src/libslic3r/PrintConfig.cpp | 5 +++-- src/slic3r/GUI/Plater.cpp | 27 +++++++++++++++------------ src/slic3r/GUI/Plater.hpp | 2 ++ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2288ab888..33941656d 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -760,16 +760,17 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("Bed types supported by the printer"); def->mode = comSimple; def->enum_keys_map = &s_keys_map_BedType; + // Orca: make sure the order of the values is the same as the BedType enum def->enum_values.emplace_back("Cool Plate"); - def->enum_values.emplace_back("Textured Cool Plate"); def->enum_values.emplace_back("Engineering Plate"); def->enum_values.emplace_back("High Temp Plate"); def->enum_values.emplace_back("Textured PEI Plate"); + def->enum_values.emplace_back("Textured Cool Plate"); def->enum_labels.emplace_back(L("Smooth Cool Plate")); - def->enum_labels.emplace_back(L("Textured Cool Plate")); def->enum_labels.emplace_back(L("Engineering Plate")); def->enum_labels.emplace_back(L("Smooth High Temp Plate")); def->enum_labels.emplace_back(L("Textured PEI Plate")); + def->enum_labels.emplace_back(L("Textured Cool Plate")); def->set_default_value(new ConfigOptionEnum(btPC)); // BBS diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c7c5302d2..a720dfab5 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1284,22 +1284,25 @@ void Sidebar::update_all_preset_comboboxes() //p->m_staticText_filament_settings->Update(); - if (is_bbl_vendor || cfg.opt_bool("support_multi_bed_types")) { m_bed_type_list->Enable(); - auto str_bed_type = wxGetApp().app_config->get_printer_setting(wxGetApp().preset_bundle->printers.get_selected_preset_name(), - "curr_bed_type"); - if (!str_bed_type.empty()) { - int bed_type_value = atoi(str_bed_type.c_str()); - if (bed_type_value == 0) - bed_type_value = 1; - m_bed_type_list->SelectAndNotify(bed_type_value - 1); - } else { - BedType bed_type = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle); - m_bed_type_list->SelectAndNotify((int) bed_type - 1); + // Orca: don't update bed type if loading project + if (!p->plater->is_loading_project()) { + auto str_bed_type = wxGetApp().app_config->get_printer_setting(wxGetApp().preset_bundle->printers.get_selected_preset_name(), + "curr_bed_type"); + if (!str_bed_type.empty()) { + int bed_type_value = atoi(str_bed_type.c_str()); + if (bed_type_value == 0) + bed_type_value = 1; + m_bed_type_list->SelectAndNotify(bed_type_value - 1); + } else { + BedType bed_type = preset_bundle.printers.get_edited_preset().get_default_bed_type(&preset_bundle); + m_bed_type_list->SelectAndNotify((int) bed_type - 1); + } } } else { - m_bed_type_list->SelectAndNotify(btPEI); + // Orca: combobox don't have the btDefault option, so we need to -1 + m_bed_type_list->SelectAndNotify(btPEI - 1); m_bed_type_list->Disable(); } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 0b25c4245..4086a1577 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -781,6 +781,8 @@ public: }; std::atomic m_arrange_running{false}; + bool is_loading_project() const { return m_loading_project; } + private: struct priv; std::unique_ptr p;