From 2ee113b9da00093ecfc7e739679da59f7955faf2 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Wed, 21 Sep 2022 15:51:38 +0800 Subject: [PATCH] FIX: Remember the bed typ of the previous project Change-Id: Id3b0e4ec7f8b4fcb2396f6f9f22789736e48eb8a (cherry picked from commit 2ea818594b6da0ee323b5e255c36b45ff4247324) --- src/libslic3r/AppConfig.cpp | 4 ++++ src/slic3r/GUI/Plater.cpp | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 47bc7dbf1..189d27279 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -285,6 +285,10 @@ void AppConfig::set_defaults() set("backup_interval", "10"); } + if (get("curr_bed_type").empty()) { + set("curr_bed_type", "0"); + } + #if BBL_RELEASE_TO_PUBLIC if (get("iot_environment").empty()) { set("iot_environment", "3"); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 78298f8be..24f1405a3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -539,7 +539,9 @@ Sidebar::Sidebar(Plater *parent) wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/x1/manual/compatibility-and-parameter-settings-of-filaments"); }); - m_bed_type_list->Select(0); + 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())); 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)); @@ -5028,6 +5030,10 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt) config.set_key_value("curr_bed_type", new ConfigOptionEnum(bed_type)); // update plater with new config q->on_config_change(wxGetApp().preset_bundle->full_config()); + + // update app_config + AppConfig *app_config = wxGetApp().app_config; + app_config->set("curr_bed_type", std::to_string(int(bed_type))); } } }