From 6323a1c35ca95486013fa8adb4d905f6633bf642 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 30 Sep 2022 20:06:34 +0800 Subject: [PATCH] Fix the bed type incorrect issue after reopen studio for new project Change-Id: Ia1a07cb2cde6864552e6dd084949c1cb83c8cab0 --- src/slic3r/GUI/Plater.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index d5cefc893..81f1e1da2 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -541,11 +541,22 @@ Sidebar::Sidebar(Plater *parent) AppConfig *app_config = wxGetApp().app_config; std::string str_bed_type = app_config->get("curr_bed_type"); - m_bed_type_list->Select(atoi(str_bed_type.c_str())); + int bed_type_value = atoi(str_bed_type.c_str()); + m_bed_type_list->Select(bed_type_value); bed_type_sizer->Add(bed_type_title, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10)); bed_type_sizer->Add(m_bed_type_list, 1, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(10)); vsizer_printer->Add(bed_type_sizer, 0, wxEXPAND | wxTOP, FromDIP(5)); + auto& project_config = wxGetApp().preset_bundle->project_config; + /*const t_config_enum_values* keys_map = print_config_def.get("curr_bed_type")->enum_keys_map; + BedType bed_type = btCount; + for (auto item : *keys_map) { + if (item.first == str_bed_type) + bed_type = (BedType)item.second; + }*/ + BedType bed_type = (BedType)bed_type_value; + project_config.set_key_value("curr_bed_type", new ConfigOptionEnum(bed_type)); + p->m_panel_printer_content->SetSizer(vsizer_printer); p->m_panel_printer_content->Layout(); scrolled_sizer->Add(p->m_panel_printer_content, 0, wxTOP | wxEXPAND, FromDIP(14));