From 6e3fae386533843baadbf03fcf18ec294ebcb968 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 8 Dec 2020 17:45:50 +0100 Subject: [PATCH] Fix of #5319 - presets inherited from renamed presets using the old preset name in the "inherits" field were losing the "inherits" flag. --- src/libslic3r/Preset.cpp | 6 +++++- src/libslic3r/Preset.hpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 3972b20d26..f0bf93a552 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1316,6 +1316,8 @@ std::string PresetCollection::section_name() const } } +// Used for validating the "inherits" flag when importing user's config bundles. +// Returns names of all system presets including the former names of these presets. std::vector PresetCollection::system_preset_names() const { size_t num = 0; @@ -1325,8 +1327,10 @@ std::vector PresetCollection::system_preset_names() const std::vector out; out.reserve(num); for (const Preset &preset : m_presets) - if (preset.is_system) + if (preset.is_system) { out.emplace_back(preset.name); + out.insert(out.end(), preset.renamed_from.begin(), preset.renamed_from.end()); + } std::sort(out.begin(), out.end()); return out; } diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index c54dd3fd87..1bf6b94af3 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -441,6 +441,8 @@ public: { return dirty_options(&this->get_edited_preset(), this->get_selected_preset_parent(), deep_compare); } // Return a sorted list of system preset names. + // Used for validating the "inherits" flag when importing user's config bundles. + // Returns names of all system presets including the former names of these presets. std::vector system_preset_names() const; // Update a dirty flag of the current preset