From 9d0d0ccc4abf42076a95d3a9b42d12bd27b774e0 Mon Sep 17 00:00:00 2001 From: "maosheng.wei" Date: Mon, 8 Jan 2024 15:11:34 +0800 Subject: [PATCH] FIX: [5846] Custom Filament Page show System Filament Simultaneously solve: When downloading Preset from the cloud, the filament_id of the preset in m_preset is null. Jira: 5846 Change-Id: I6ba1b46fe92e345614b6a4af3fffa87d81fa2456 --- src/libslic3r/Preset.cpp | 3 +++ src/slic3r/GUI/WebGuideDialog.cpp | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 79ab7cd30..2948a3a63 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1692,6 +1692,9 @@ bool PresetCollection::load_user_preset(std::string name, std::mapdefault_preset_for(cloud_config); if (inherit_preset) { new_config = inherit_preset->config; + if (cloud_filament_id == "null") { + cloud_filament_id = inherit_preset->filament_id; + } } else { // We support custom root preset now diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 17881938d..1fefaf113 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -53,15 +53,19 @@ static wxString update_custom_filaments() need_delete_some_filament = true; } bool filament_with_base_id = false; - bool vendor_is_generic = false; + bool not_need_show = false; std::string filament_name; for (const Preset *preset : filament_id_to_presets.second) { - if (preset->is_system || preset->inherits() != "") continue; + if (preset->is_system) { + not_need_show = true; + break; + } + if (preset->inherits() != "") continue; if (!preset->base_id.empty()) filament_with_base_id = true; - if (!vendor_is_generic) { + if (!not_need_show) { auto filament_vendor = dynamic_cast(const_cast(preset)->config.option("filament_vendor", false)); - if (filament_vendor && filament_vendor->values.size() && filament_vendor->values[0] == "Generic") vendor_is_generic = true; + if (filament_vendor && filament_vendor->values.size() && filament_vendor->values[0] == "Generic") not_need_show = true; } if (filament_name.empty()) { @@ -71,7 +75,7 @@ static wxString update_custom_filaments() filament_name = preset_name; } } - if (vendor_is_generic) continue; + if (not_need_show) continue; if (!filament_name.empty()) { if (filament_with_base_id) { need_sort.push_back(std::make_pair("[Action Required] " + filament_name, filament_id));