diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 41cd23acdd..89a7b58f90 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -226,7 +226,7 @@ struct PresetUpdater::priv bool get_cached_plugins_version(std::string &cached_version, bool& force); //BBS: refine preset update logic - bool install_bundles_rsrc(std::vector bundles, bool snapshot) const; + bool install_bundles_rsrc(const std::vector& bundles, bool snapshot) const; void check_installed_vendor_profiles() const; Updates get_printer_config_updates(bool update = false) const; Updates get_config_updates(const Semver& old_slic3r_version) const; @@ -1042,7 +1042,7 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url) } } -bool PresetUpdater::priv::install_bundles_rsrc(std::vector bundles, bool snapshot) const +bool PresetUpdater::priv::install_bundles_rsrc(const std::vector& bundles, bool snapshot) const { Updates updates; @@ -1079,9 +1079,9 @@ void PresetUpdater::priv::check_installed_vendor_profiles() const AppConfig *app_config = GUI::wxGetApp().app_config; const auto enabled_vendors = app_config->vendors(); - std::vector bundles; + std::set bundles; // Orca: always install filament library - bundles.push_back(PresetBundle::ORCA_FILAMENT_LIBRARY); + bundles.insert(PresetBundle::ORCA_FILAMENT_LIBRARY); for (auto &dir_entry : boost::filesystem::directory_iterator(rsrc_path)) { const auto &path = dir_entry.path(); std::string file_path = path.string(); @@ -1090,9 +1090,13 @@ void PresetUpdater::priv::check_installed_vendor_profiles() const std::string vendor_name = path.filename().string(); // Remove the .json suffix. vendor_name.erase(vendor_name.size() - 5); + if (bundles.find(vendor_name) != bundles.end())continue; + + const auto is_vendor_enabled = (vendor_name == PresetBundle::ORCA_DEFAULT_BUNDLE) // always update configs from resource to vendor for ORCA_DEFAULT_BUNDLE + || (enabled_vendors.find(vendor_name) != enabled_vendors.end()); if (enabled_config_update) { if ( fs::exists(path_in_vendor)) { - if (enabled_vendors.find(vendor_name) != enabled_vendors.end()) { + if (is_vendor_enabled) { Semver resource_ver = get_version_from_json(file_path); Semver vendor_ver = get_version_from_json(path_in_vendor.string()); @@ -1100,7 +1104,7 @@ void PresetUpdater::priv::check_installed_vendor_profiles() const if (!version_match || (vendor_ver < resource_ver)) { BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:found vendor "< 0) - install_bundles_rsrc(bundles, false); + if (bundles.size() > 0) { + install_bundles_rsrc(std::vector(bundles.begin(), bundles.end()), false); + } } Updates PresetUpdater::priv::get_printer_config_updates(bool update) const