From b295ba35ee36be7afe277b34354a865b6c0ca74d Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Fri, 1 Dec 2023 10:20:23 +0800 Subject: [PATCH] FIX: custom filament preset display in cali history issue jira: new Change-Id: I4145450a231adff542ab1a7428b3479f4074e06a --- src/slic3r/GUI/CaliHistoryDialog.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/CaliHistoryDialog.cpp b/src/slic3r/GUI/CaliHistoryDialog.cpp index 8d20b9b17..e2e27ad0c 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.cpp +++ b/src/slic3r/GUI/CaliHistoryDialog.cpp @@ -26,16 +26,28 @@ static wxString get_preset_name_by_filament_id(std::string filament_id) if (filament_id.compare(it->filament_id) == 0) { auto preset_parent = collection->get_preset_parent(*it); if (preset_parent) { - if (!preset_parent->alias.empty()) - preset_name = from_u8(preset_parent->alias); - else - preset_name = from_u8(preset_parent->name); + if (preset_parent->is_system) { + if (!preset_parent->alias.empty()) + preset_name = from_u8(preset_parent->alias); + else + preset_name = from_u8(preset_parent->name); + } + else { // is custom created filament + std::string name_str = preset_parent->name; + preset_name = from_u8(name_str.substr(0, name_str.find(" @"))); + } } else { - if (!it->alias.empty()) - preset_name = from_u8(it->alias); - else - preset_name = from_u8(it->name); + if (it->is_system) { + if (!it->alias.empty()) + preset_name = from_u8(it->alias); + else + preset_name = from_u8(it->name); + } + else { // is custom created filament + std::string name_str = it->name; + preset_name = from_u8(name_str.substr(0, name_str.find(" @"))); + } } } }