diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a069e89609..daf55d53c6 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -8859,6 +8859,20 @@ void read_binary_stl(const std::string& filename, std::string& model_id, std::st return; } +// Logs what show_substitutions_info() would list, for loads that don't show the dialog. +static void log_substitutions(const ConfigSubstitutions& substitutions, const std::string& source) +{ + for (const ConfigSubstitution& substitution : substitutions) + BOOST_LOG_TRIVIAL(warning) << "Loading " << source << ": " << substitution.opt_def->opt_key << " = \"" << substitution.old_value + << "\" replaced with \"" << substitution.new_value->serialize() << "\""; +} + +static void log_substitutions(const PresetsConfigSubstitutions& substitutions, const std::string& source) +{ + for (const PresetConfigSubstitutions& preset : substitutions) + log_substitutions(preset.substitutions, source + " (preset " + preset.preset_name + ")"); +} + // BBS: backup & restore std::vector Plater::priv::load_files(const std::vector& input_files, LoadStrategy strategy, @@ -9160,7 +9174,6 @@ std::vector Plater::priv::load_files(const std::vector& input_ Semver app_version = *(Semver::parse(SoftFever_VERSION)); const wxString load_3mf_title = _L("Load 3MF"); const wxString newer_3mf_title = _L("Newer 3MF version"); - const wxString bambu_project_title = _L("BambuStudio Project"); const wxString msg_unsupported_geometry = _L("The 3MF is not supported by OrcaSlicer, loading geometry data only."); const wxString msg_old_orca_geometry = _L("The 3MF file was generated by an old OrcaSlicer version, loading geometry data only."); const wxString msg_older_geometry = _L("The 3MF file was generated by an older version, loading geometry data only."); @@ -9171,6 +9184,8 @@ std::vector Plater::priv::load_files(const std::vector& input_ << boost::format("3MF import message [%1%]: %2% | file: %3%") % into_u8(title) % into_u8(text) % path.string(); show_info(q, text, title); }; + // Untagged files up to 2.3.2 may also come from OrcaSlicer, which only started tagging its 3MFs after it. + const bool is_bambu_studio_project = en_3mf_file_type == En3mfType::From_BBS && file_version > Semver(2, 3, 2); if (en_3mf_file_type == En3mfType::From_Prusa) { // do not reset the model config load_config = false; @@ -9230,8 +9245,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ } else if (en_3mf_file_type == En3mfType::From_BBS) { // No OrcaSlicer tag - check Bambu/Application version - Semver orca_tag_start_version(2, 3, 2); - if (file_version <= orca_tag_start_version) { + if (!is_bambu_studio_project) { // Compatible old version (before OrcaSlicer tagging was introduced after 2.3.2). // Any version prior or equal to 2.3.2 is older than the current one, no version warnings needed. // Still apply migration fixes for known old versions. @@ -9264,33 +9278,17 @@ std::vector Plater::priv::load_files(const std::vector& input_ } } else { // BambuStudio project (version > 2.3.2 without OrcaSlicer tag) - // Report that a BambuStudio project is being imported and compare with SLIC3R_VERSION - Semver slic3r_version = *(Semver::parse(SLIC3R_VERSION)); if (load_config && config_loaded.empty()) { load_config = false; log_and_show_3mf_info(msg_bambu_geometry, load_3mf_title); } - else if (load_config && (file_version > slic3r_version)) { - // BambuStudio file version is newer than our compatible SLIC3R_VERSION - if (config_substitutions.unrecogized_keys.size() > 0) { - wxString text = wxString::Format(_L("The 3MF was created by BambuStudio (version %s), which is newer than the compatible version %s. Found unrecognized settings:"), - file_version.to_string(), slic3r_version.to_string()); - text += "\n"; - wxString context = text; - wxString append = _L("You should update your software.\n"); - context += "\n\n"; - context += append; - log_and_show_3mf_info(context, bambu_project_title); - } else { - wxString text = wxString::Format(_L("The 3MF was created by BambuStudio (version %s), which is newer than the compatible version %s. Some settings may not be fully compatible."), - file_version.to_string(), slic3r_version.to_string()); - text += "\n"; - log_and_show_3mf_info(text, bambu_project_title); - } - } else if (load_config && !published_config.published) { - // BambuStudio version is older or same as our SLIC3R_VERSION - wxString text = _L("The 3MF was created by BambuStudio. Some settings may differ from OrcaSlicer."); - log_and_show_3mf_info(text, bambu_project_title); + else if (load_config) { + // Logged, not shown: it is the same for every BambuStudio project and needs no action. + std::string unrecognized; + for (const std::string& key : config_substitutions.unrecogized_keys) + unrecognized += (unrecognized.empty() ? "" : ", ") + key; + BOOST_LOG_TRIVIAL(info) << "BambuStudio " << file_version.to_string() << " project " << path.string() + << ", unrecognized settings: " << (unrecognized.empty() ? "none" : unrecognized); } } } @@ -9379,7 +9377,10 @@ std::vector Plater::priv::load_files(const std::vector& input_ PresetsConfigSubstitutions preset_substitutions; PresetBundle & preset_bundle = *wxGetApp().preset_bundle; preset_substitutions = preset_bundle.load_project_embedded_presets(project_presets, ForwardCompatibilitySubstitutionRule::Enable); - if (!preset_substitutions.empty()) show_substitutions_info(preset_substitutions); + if (is_bambu_studio_project) + log_substitutions(preset_substitutions, path.string()); + else if (!preset_substitutions.empty()) + show_substitutions_info(preset_substitutions); } if (project_presets.size() > 0) { for (unsigned int i = 0; i < project_presets.size(); i++) { delete project_presets[i]; } @@ -9417,7 +9418,11 @@ std::vector Plater::priv::load_files(const std::vector& input_ notify_manager->bbl_show_3mf_warn_notification(error_message); } } - if (!config_substitutions.empty()) show_substitutions_info(config_substitutions.substitutions, filename.string()); + // BambuStudio projects routinely carry values Orca replaces; log them rather than showing a dialog on every open. + if (is_bambu_studio_project) + log_substitutions(config_substitutions.substitutions, path.string()); + else if (!config_substitutions.empty()) + show_substitutions_info(config_substitutions.substitutions, filename.string()); // BBS if (load_model && !load_config) {