From 4d1723a52051dba60d19ee32ba21331b34e9eb2b Mon Sep 17 00:00:00 2001 From: BenLue Date: Fri, 22 May 2026 11:54:07 +0200 Subject: [PATCH 1/2] feat: make filament Serial field optional (#14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - The **Serial** field (labeled \"Variant\" in the upstream issue) in the *Create Filament Preset* dialog is now optional - Users can leave it blank when a filament has no meaningful variant (e.g. Polymaker PolyLite PC) - The field label now reads **Serial (optional)** to make this clear - When blank, the preset is named `Vendor Type` instead of `Vendor Type ` with a trailing space ## Changes `src/slic3r/GUI/CreatePresetsDialog.cpp` - Removed the hard error when Serial is empty - Relaxed escape-character and all-spaces validation to check only the Vendor field (Serial can legitimately be empty) - Preset name construction skips the serial component when it is empty - Field label changed from `Serial` → `Serial (optional)` ## Test plan - [ ] Create a filament preset with Serial left blank → preset is created as `Vendor Type` - [ ] Create a filament preset with Serial filled in → preset is created as `Vendor Type Serial` (existing behaviour unchanged) - [ ] Vendor field still required: leaving Vendor blank still shows an error Upstream issue: bambulab/BambuStudio#10866 --- src/slic3r/GUI/CreatePresetsDialog.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index c53e10fbe6..4c19b788f4 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -840,7 +840,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item() wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer * optionSizer = new wxBoxSizer(wxVERTICAL); - wxStaticText *static_serial_text = new wxStaticText(this, wxID_ANY, _L("Serial"), wxDefaultPosition, wxDefaultSize); + wxStaticText *static_serial_text = new wxStaticText(this, wxID_ANY, _L("Serial (optional)"), wxDefaultPosition, wxDefaultSize); optionSizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0); optionSizer->SetMinSize(OPTION_SIZE); horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5)); @@ -1018,28 +1018,20 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() } //get filament serial wxString serial_str = m_filament_serial_input->GetTextCtrl()->GetValue(); - std::string serial_name; - if (serial_str.empty()) { - MessageDialog dlg(this, _L("Filament serial is not inputed, please input serial."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), - wxYES | wxYES_DEFAULT | wxCENTRE); - dlg.ShowModal(); - return; - } else { - serial_name = into_u8(serial_str); - } + std::string serial_name = into_u8(serial_str); vendor_name = remove_special_key(vendor_name); serial_name = remove_special_key(serial_name); - if (vendor_name.empty() || serial_name.empty()) { - MessageDialog dlg(this, _L("There may be escape characters in the vendor or serial input of filament. Please delete and re-enter."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), + if (vendor_name.empty()) { + MessageDialog dlg(this, _L("The filament vendor name contains invalid characters. Please remove them and try again."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); dlg.ShowModal(); return; } boost::algorithm::trim(vendor_name); boost::algorithm::trim(serial_name); - if (vendor_name.empty() || serial_name.empty()) { - MessageDialog dlg(this, _L("All inputs in the custom vendor or serial are spaces. Please re-enter."), + if (vendor_name.empty()) { + MessageDialog dlg(this, _L("The filament vendor name cannot be blank. Please enter a vendor name."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); dlg.ShowModal(); return; @@ -1058,7 +1050,8 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() return; } - std::string filament_preset_name = vendor_name + " " + (type_name == "PLA-AERO" ? "PLA Aero" : type_name) + " " + serial_name; + std::string display_type = type_name == "PLA-AERO" ? "PLA Aero" : type_name; + std::string filament_preset_name = vendor_name + " " + display_type + (serial_name.empty() ? "" : " " + serial_name); PresetBundle *preset_bundle = wxGetApp().preset_bundle; if (preset_bundle->filaments.is_alias_exist(filament_preset_name)) { MessageDialog dlg(this, From ae7ea018f9b762eaf2b8236c6ab4d7a045cccadb Mon Sep 17 00:00:00 2001 From: BenJule Date: Fri, 22 May 2026 11:59:13 +0200 Subject: [PATCH 2/2] fix: warn user when Serial input is invalid/sanitized to empty --- src/slic3r/GUI/CreatePresetsDialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 4c19b788f4..bcf041d7de 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -1030,6 +1030,12 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() } boost::algorithm::trim(vendor_name); boost::algorithm::trim(serial_name); + if (!serial_str.IsEmpty() && serial_name.empty()) { + MessageDialog dlg(this, _L("The filament serial contains only invalid characters or spaces. Please correct it or leave it blank."), + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); + dlg.ShowModal(); + return; + } if (vendor_name.empty()) { MessageDialog dlg(this, _L("The filament vendor name cannot be blank. Please enter a vendor name."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);