diff options
author | Adam Elnagger <adam.elnagger@gmail.com> | 2022-05-30 20:34:15 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2022-07-18 18:47:17 +0300 |
commit | df9d385036e27c2bc73793f17212426c63a459ec (patch) | |
tree | af17d1cad50a9a9a424db82e54ac80967fb362e0 | |
parent | 8d8167d977afd7fbf83baaf9165359605872bf63 (diff) |
Rework BackgroundSlicingProcess to support different SLA archivers.
Also update the GUI to properly save changes to the output format configuration.
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/BackgroundSlicingProcess.cpp | 9 | ||||
-rw-r--r-- | src/slic3r/GUI/BackgroundSlicingProcess.hpp | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 47901e9eb..1584ef30f 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -6757,7 +6757,7 @@ void PrintConfigDef::init_sla_params() def->enum_labels.push_back(L("Masked CWS")); def->enum_labels.push_back(L("Prusa SL1")); def->mode = comAdvancedE | comSuSi; // output_format should be preconfigured in profiles; - def->set_default_value(new ConfigOptionEnum<OutputFormat>(ofMaskedCWS)); + def->set_default_value(new ConfigOptionEnum<OutputFormat>(ofSL1)); def = this->add("sla_output_precision", coFloat); def->label = L("SLA output precision"); diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 3a87335a8..9135e4005 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -20,6 +20,7 @@ #include "libslic3r/SLAPrint.hpp" #include "libslic3r/Utils.hpp" #include "libslic3r/GCode/PostProcessor.hpp" +#include "libslic3r/Format/Format.hpp" #include "libslic3r/Format/SL1.hpp" #include "libslic3r/Thread.hpp" #include "libslic3r/libslic3r.h" @@ -196,7 +197,7 @@ void BackgroundSlicingProcess::process_sla() ThumbnailsParams{current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values, true, true, true, true}); Zipper zipper(export_path); - m_sla_archive.export_print(zipper, *m_sla_print); + m_sla_archive->export_print(zipper, *m_sla_print); for (const ThumbnailData& data : thumbnails) if (data.is_valid()) write_thumbnail(zipper, data); @@ -593,6 +594,10 @@ Print::ApplyStatus BackgroundSlicingProcess::apply(const Model &model, const Dyn if (m_gcode_result != nullptr) m_gcode_result->reset(); } + if (invalidated && m_print->technology() == ptSLA) { + m_sla_archive = Slic3r::get_output_format(config); + m_sla_print->set_printer(m_sla_archive); + } return invalidated; } @@ -764,7 +769,7 @@ void BackgroundSlicingProcess::prepare_upload() ThumbnailsParams{current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values, true, true, true, true}); // true, false, true, true); // renders also supports and pad Zipper zipper{source_path.string()}; - m_sla_archive.export_print(zipper, *m_sla_print, m_upload_job.upload_data.upload_path.string()); + m_sla_archive->export_print(zipper, *m_sla_print, m_upload_job.upload_data.upload_path.string()); for (const ThumbnailData& data : thumbnails) if (data.is_valid()) write_thumbnail(zipper, data); diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp index b22a6f77e..9160faea4 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp @@ -84,7 +84,7 @@ public: ~BackgroundSlicingProcess(); void set_fff_print(Print *print) { m_fff_print = print; } - void set_sla_print(SLAPrint *print) { m_sla_print = print; m_sla_print->set_printer(&m_sla_archive); } + void set_sla_print(SLAPrint *print) { m_sla_print = print; } void set_thumbnail_cb(ThumbnailsGeneratorCallback cb) { m_thumbnail_cb = cb; } void set_gcode_result(GCodeProcessorResult* result) { m_gcode_result = result; } @@ -219,8 +219,8 @@ private: GCodeProcessorResult *m_gcode_result = nullptr; // Callback function, used to write thumbnails into gcode. ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr; - SL1Archive m_sla_archive; - // Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID. + std::shared_ptr<SLAAbstractArchive> m_sla_archive = nullptr; + // Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID. std::string m_temp_output_path; // Output path provided by the user. The output path may be set even if the slicing is running, // but once set, it cannot be re-set. |