From ea4e9b35a3e2084325fbaed4c5bedf310bcdef3e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 20 Aug 2021 09:26:39 +0200 Subject: [PATCH 1/4] Fix for #6803 - Illegal character in filename when STL opened direct from CAD app --- src/slic3r/GUI/Plater.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 0c3c5b9b1..ce4845fed 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2334,7 +2334,9 @@ std::vector Plater::priv::load_files(const std::vector& input_ else { model = Slic3r::Model::read_from_file(path.string(), nullptr, nullptr, only_if(load_config, Model::LoadAttribute::CheckVersion)); for (auto obj : model.objects) - if (obj->name.empty()) + if (obj->name.empty() || + obj->name.find_first_of("/") != std::string::npos) // When file is imported from Fusion360 the path containes "/" instead of "\\" (see https://github.com/prusa3d/PrusaSlicer/issues/6803) + // But read_from_file doesn't support that direction separator and as a result object name containes full path obj->name = fs::path(obj->input_file).filename().string(); } } catch (const ConfigurationError &e) { From 7e0e552fd22da60b0b594724e9d6853ec3856c86 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 20 Aug 2021 10:22:17 +0200 Subject: [PATCH 2/4] Moved raft_first_layer_density and raft_first_layer_expansion from 'Raft' section to 'Support material', the values are also used for first supports layer when raft is disabled. --- src/slic3r/GUI/Tab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 5c8fed787..32131d99d 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1518,11 +1518,11 @@ void TabPrint::build() optgroup->append_single_option_line("support_material_auto", category_path + "auto-generated-supports"); optgroup->append_single_option_line("support_material_threshold", category_path + "overhang-threshold"); optgroup->append_single_option_line("support_material_enforce_layers", category_path + "enforce-support-for-the-first"); + optgroup->append_single_option_line("raft_first_layer_density", category_path + "raft-first-layer-density"); + optgroup->append_single_option_line("raft_first_layer_expansion", category_path + "raft-first-layer-expansion"); optgroup = page->new_optgroup(L("Raft")); optgroup->append_single_option_line("raft_layers", category_path + "raft-layers"); - optgroup->append_single_option_line("raft_first_layer_density", category_path + "raft-first-layer-density"); - optgroup->append_single_option_line("raft_first_layer_expansion", category_path + "raft-first-layer-expansion"); optgroup->append_single_option_line("raft_contact_distance"); optgroup->append_single_option_line("raft_expansion"); From 883f46662d02fb50bc11dffdc4be1cc8e34fa8e1 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Fri, 20 Aug 2021 13:42:10 +0200 Subject: [PATCH 3/4] Fix warnings when newer CMake is used. project() call should always come AFTER cmake_minimum_required(). This caused various hard-to-debug issues when searching for packages. Newer CMake versions complain that compatibility is broken with v2.6 --- cmake/modules/FindDBus.cmake | 2 +- src/Shiny/CMakeLists.txt | 2 +- src/admesh/CMakeLists.txt | 2 +- src/boost/CMakeLists.txt | 2 +- src/clipper/CMakeLists.txt | 2 +- src/glu-libtess/CMakeLists.txt | 2 +- src/imgui/CMakeLists.txt | 2 +- src/libigl/CMakeLists.txt | 2 +- src/miniz/CMakeLists.txt | 2 +- src/semver/CMakeLists.txt | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/modules/FindDBus.cmake b/cmake/modules/FindDBus.cmake index 1d0f29dd7..d54d4e516 100644 --- a/cmake/modules/FindDBus.cmake +++ b/cmake/modules/FindDBus.cmake @@ -56,4 +56,4 @@ FIND_PATH(DBUS_ARCH_INCLUDE_DIR SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) \ No newline at end of file +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBus REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) \ No newline at end of file diff --git a/src/Shiny/CMakeLists.txt b/src/Shiny/CMakeLists.txt index 8be7592ae..abdb96a72 100644 --- a/src/Shiny/CMakeLists.txt +++ b/src/Shiny/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(Shiny) -cmake_minimum_required(VERSION 2.6) add_library(Shiny STATIC Shiny.h diff --git a/src/admesh/CMakeLists.txt b/src/admesh/CMakeLists.txt index 7d0177782..217976318 100644 --- a/src/admesh/CMakeLists.txt +++ b/src/admesh/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(admesh) -cmake_minimum_required(VERSION 2.6) add_library(admesh STATIC connect.cpp diff --git a/src/boost/CMakeLists.txt b/src/boost/CMakeLists.txt index 12fe6b4e5..e8c9e11ce 100644 --- a/src/boost/CMakeLists.txt +++ b/src/boost/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(nowide) -cmake_minimum_required(VERSION 2.6) add_library(nowide STATIC nowide/args.hpp diff --git a/src/clipper/CMakeLists.txt b/src/clipper/CMakeLists.txt index 0362a4d84..f62508820 100644 --- a/src/clipper/CMakeLists.txt +++ b/src/clipper/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(clipper) -cmake_minimum_required(VERSION 2.6) add_library(clipper STATIC # We are using ClipperLib compiled as part of the libslic3r project using Slic3r::Point as its base type. diff --git a/src/glu-libtess/CMakeLists.txt b/src/glu-libtess/CMakeLists.txt index f3f8d024a..8fca992a3 100644 --- a/src/glu-libtess/CMakeLists.txt +++ b/src/glu-libtess/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(glu-libtess) -cmake_minimum_required(VERSION 2.6) add_library(glu-libtess STATIC src/dict-list.h diff --git a/src/imgui/CMakeLists.txt b/src/imgui/CMakeLists.txt index 50575308d..235afe110 100644 --- a/src/imgui/CMakeLists.txt +++ b/src/imgui/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(imgui) -cmake_minimum_required(VERSION 2.6) add_library(imgui STATIC imconfig.h diff --git a/src/libigl/CMakeLists.txt b/src/libigl/CMakeLists.txt index 3daac757b..f023826a5 100644 --- a/src/libigl/CMakeLists.txt +++ b/src/libigl/CMakeLists.txt @@ -1,5 +1,5 @@ -project(libigl) cmake_minimum_required(VERSION 3.0) +project(libigl) add_library(libigl INTERFACE) diff --git a/src/miniz/CMakeLists.txt b/src/miniz/CMakeLists.txt index ab27067d0..a664f7460 100644 --- a/src/miniz/CMakeLists.txt +++ b/src/miniz/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(miniz) -cmake_minimum_required(VERSION 2.6) add_library(miniz INTERFACE) diff --git a/src/semver/CMakeLists.txt b/src/semver/CMakeLists.txt index c273121d4..4b61a7456 100644 --- a/src/semver/CMakeLists.txt +++ b/src/semver/CMakeLists.txt @@ -1,5 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12) project(semver) -cmake_minimum_required(VERSION 2.6) add_library(semver STATIC semver.c From 6efea25478f30cb9c466edb3c4a207d8f16275a0 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Fri, 20 Aug 2021 13:43:52 +0200 Subject: [PATCH 4/4] Change UI job's process() method to be protected, as it should have been Also add some comments to the interface of Job class --- src/slic3r/GUI/Jobs/ArrangeJob.hpp | 6 +++--- src/slic3r/GUI/Jobs/FillBedJob.hpp | 3 +-- src/slic3r/GUI/Jobs/Job.hpp | 13 ++++++++++--- src/slic3r/GUI/Jobs/RotoptimizeJob.hpp | 4 ++-- src/slic3r/GUI/Jobs/SLAImportJob.hpp | 12 +++++------- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.hpp b/src/slic3r/GUI/Jobs/ArrangeJob.hpp index a5e10f11a..2744920da 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.hpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.hpp @@ -35,7 +35,9 @@ protected: void prepare() override; void on_exception(const std::exception_ptr &) override; - + + void process() override; + public: ArrangeJob(std::shared_ptr pri, Plater *plater) : PlaterJob{std::move(pri), plater} @@ -46,8 +48,6 @@ public: return int(m_selected.size() + m_unprintable.size()); } - void process() override; - void finalize() override; }; diff --git a/src/slic3r/GUI/Jobs/FillBedJob.hpp b/src/slic3r/GUI/Jobs/FillBedJob.hpp index 07290d2f2..bf407656d 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.hpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.hpp @@ -24,6 +24,7 @@ class FillBedJob : public PlaterJob protected: void prepare() override; + void process() override; public: FillBedJob(std::shared_ptr pri, Plater *plater) @@ -35,8 +36,6 @@ public: return m_status_range; } - void process() override; - void finalize() override; }; diff --git a/src/slic3r/GUI/Jobs/Job.hpp b/src/slic3r/GUI/Jobs/Job.hpp index 082e5f4e8..8243ce943 100644 --- a/src/slic3r/GUI/Jobs/Job.hpp +++ b/src/slic3r/GUI/Jobs/Job.hpp @@ -49,11 +49,20 @@ protected: // Launched just before start(), a job can use it to prepare internals virtual void prepare() {} + + // The method where the actual work of the job should be defined. + virtual void process() = 0; // Launched when the job is finished. It refreshes the 3Dscene by def. virtual void finalize() { m_finalized = true; } - virtual void on_exception(const std::exception_ptr &) {} + // Exceptions occuring in process() are redirected from the worker thread + // into the main (UI) thread. This method is called from the main thread and + // can be overriden to handle these exceptions. + virtual void on_exception(const std::exception_ptr &eptr) + { + if (eptr) std::rethrow_exception(eptr); + } public: Job(std::shared_ptr pri); @@ -65,8 +74,6 @@ public: Job &operator=(const Job &) = delete; Job &operator=(Job &&) = delete; - virtual void process() = 0; - void start(); // To wait for the running job and join the threads. False is diff --git a/src/slic3r/GUI/Jobs/RotoptimizeJob.hpp b/src/slic3r/GUI/Jobs/RotoptimizeJob.hpp index 811c9c97e..cdb367f23 100644 --- a/src/slic3r/GUI/Jobs/RotoptimizeJob.hpp +++ b/src/slic3r/GUI/Jobs/RotoptimizeJob.hpp @@ -48,14 +48,14 @@ class RotoptimizeJob : public PlaterJob protected: void prepare() override; + void process() override; public: RotoptimizeJob(std::shared_ptr pri, Plater *plater) : PlaterJob{std::move(pri), plater} {} - - void process() override; + void finalize() override; static constexpr size_t get_methods_count() { return std::size(Methods); } diff --git a/src/slic3r/GUI/Jobs/SLAImportJob.hpp b/src/slic3r/GUI/Jobs/SLAImportJob.hpp index 543f42006..583c98655 100644 --- a/src/slic3r/GUI/Jobs/SLAImportJob.hpp +++ b/src/slic3r/GUI/Jobs/SLAImportJob.hpp @@ -10,18 +10,16 @@ class SLAImportJob : public PlaterJob { std::unique_ptr p; +protected: + void prepare() override; + void process() override; + void finalize() override; + public: SLAImportJob(std::shared_ptr pri, Plater *plater); ~SLAImportJob(); - void process() override; - void reset(); - -protected: - void prepare() override; - - void finalize() override; }; }} // namespace Slic3r::GUI