From 6ad9aba4546633ab1a2577dc5f62160767ac392f Mon Sep 17 00:00:00 2001 From: David Kocik Date: Tue, 23 May 2023 11:13:06 +0200 Subject: [PATCH] Revert "Concider projects with .zip extension that are 3mf projects as it would have .3mf extension." This reverts commit 96f4c018d90eb6aa8d2ae59724f4a1e8ae0b857d. --- src/libslic3r/Model.cpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index b4fccd1db..9aa4cf3c6 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -119,7 +119,7 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c result = load_step(input_file.c_str(), &model); else if (boost::algorithm::iends_with(input_file, ".amf") || boost::algorithm::iends_with(input_file, ".amf.xml")) result = load_amf(input_file.c_str(), config, config_substitutions, &model, options & LoadAttribute::CheckVersion); - else if (boost::algorithm::iends_with(input_file, ".3mf") || boost::algorithm::iends_with(input_file, ".zip")) + else if (boost::algorithm::iends_with(input_file, ".3mf")) //FIXME options & LoadAttribute::CheckVersion ? result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, false); else @@ -153,7 +153,7 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig Model model; bool result = false; - if (boost::algorithm::iends_with(input_file, ".3mf") || boost::algorithm::iends_with(input_file, ".zip")) + if (boost::algorithm::iends_with(input_file, ".3mf")) result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, options & LoadAttribute::CheckVersion); else if (boost::algorithm::iends_with(input_file, ".zip.amf")) result = load_amf(input_file.c_str(), config, config_substitutions, &model, options & LoadAttribute::CheckVersion); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 946d69bf5..2e22dc0de 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1702,7 +1702,6 @@ struct Plater::priv static const std::regex pattern_zip_amf; static const std::regex pattern_any_amf; static const std::regex pattern_prusa; - static const std::regex pattern_zip; priv(Plater *q, MainFrame *main_frame); ~priv(); @@ -2004,7 +2003,6 @@ const std::regex Plater::priv::pattern_3mf(".*3mf", std::regex::icase); const std::regex Plater::priv::pattern_zip_amf(".*[.]zip[.]amf", std::regex::icase); const std::regex Plater::priv::pattern_any_amf(".*[.](amf|amf[.]xml|zip[.]amf)", std::regex::icase); const std::regex Plater::priv::pattern_prusa(".*prusa", std::regex::icase); -const std::regex Plater::priv::pattern_zip(".*zip", std::regex::icase); Plater::priv::priv(Plater *q, MainFrame *main_frame) : q(q) @@ -2430,7 +2428,7 @@ void Plater::check_selected_presets_visibility(PrinterTechnology loaded_printer_ std::vector Plater::priv::load_files(const std::vector& input_files, bool load_model, bool load_config, bool imperial_units/* = false*/) { - if (input_files.empty()) { return std::vector(); } + if (input_files.empty()) { return std::vector(); } auto *nozzle_dmrs = config->opt("nozzle_diameter"); @@ -2491,7 +2489,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ progress_dlg->Fit(); } - const bool type_3mf = std::regex_match(path.string(), pattern_3mf) || std::regex_match(path.string(), pattern_zip); + const bool type_3mf = std::regex_match(path.string(), pattern_3mf); const bool type_zip_amf = !type_3mf && std::regex_match(path.string(), pattern_zip_amf); const bool type_any_amf = !type_3mf && std::regex_match(path.string(), pattern_any_amf); const bool type_prusa = std::regex_match(path.string(), pattern_prusa); @@ -5927,13 +5925,7 @@ bool Plater::load_files(const wxArrayString& filenames, bool delete_after_load/* // searches for project files for (std::vector::const_reverse_iterator it = paths.rbegin(); it != paths.rend(); ++it) { std::string filename = (*it).filename().string(); - - bool handle_as_project = (boost::algorithm::iends_with(filename, ".3mf") || boost::algorithm::iends_with(filename, ".amf")); - if (boost::algorithm::iends_with(filename, ".zip") && is_project_3mf(it->string())) { - BOOST_LOG_TRIVIAL(warning) << "File with .zip extension is 3mf project, opening as it would have .3mf extension: " << *it; - handle_as_project = true; - } - if (handle_as_project) { + if (boost::algorithm::iends_with(filename, ".3mf") || boost::algorithm::iends_with(filename, ".amf")) { ProjectDropDialog::LoadType load_type = ProjectDropDialog::LoadType::Unknown; { if ((boost::algorithm::iends_with(filename, ".3mf") && !is_project_3mf(it->string())) ||