From d7b49d9d684b4073ebc6823b6d697ec749bc0dba Mon Sep 17 00:00:00 2001 From: ExPikaPaka Date: Tue, 7 Jul 2026 12:10:11 +0200 Subject: [PATCH] Transfer all Preset fields from cache via move assignmet apply_vendor_preset_group was copying fields manually and missed bundle_id, user_id, base_id, sync_info, updated_time, key_values, ini_str. Replace field-by-field copy with move assignment of the fully-deserialized Preset, then restore the vendor pointer which is excluded from serialization. --- src/libslic3r/PresetBundle.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 6e1c065e89..33d1ec0071 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -6002,20 +6002,16 @@ static void apply_vendor_preset_group(VendorPresetGroup& grp, { auto apply = [&](std::vector& cached, PresetCollection& coll, bool is_filaments) { for (Preset& cp : cached) { + // Reserve a slot in the collection, then move the fully-deserialized + // preset into it so all serialized fields are transferred at once. + // Only vendor (a raw pointer, excluded from serialization) is patched after. DynamicPrintConfig config = cp.config; Preset& p = coll.load_preset(cp.file, cp.name, std::move(config), false, cp.version); - p.is_system = true; - p.is_visible = cp.is_visible; - p.alias = cp.alias; - p.renamed_from = cp.renamed_from; - p.filament_id = cp.filament_id; - p.setting_id = cp.setting_id; - p.description = cp.description; - p.m_from_orca_filament_lib = cp.m_from_orca_filament_lib; - p.m_excluded_from = cp.m_excluded_from; - p.vendor = vp; + const std::string alias = cp.alias; + p = std::move(cp); + p.vendor = vp; if (is_filaments) - coll.set_printer_hold_alias(p.alias, p); + coll.set_printer_hold_alias(alias, p); } }; apply(grp.prints, prints_coll, false);