From 3d6c9e54e98e235a272c989c0383ed07da7ee585 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 25 Mar 2020 10:15:02 +0100 Subject: [PATCH] ENABLE_THUMBNAIL_GENERATOR set as default --- src/libslic3r/Format/3mf.cpp | 43 --------------------- src/libslic3r/Format/3mf.hpp | 6 --- src/libslic3r/GCode.cpp | 16 -------- src/libslic3r/GCode.hpp | 10 ----- src/libslic3r/GCode/ThumbnailData.cpp | 4 -- src/libslic3r/GCode/ThumbnailData.hpp | 4 -- src/libslic3r/Print.cpp | 8 ---- src/libslic3r/Print.hpp | 6 --- src/libslic3r/Technologies.hpp | 31 ++++----------- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 12 ------ src/slic3r/GUI/BackgroundSlicingProcess.hpp | 4 -- src/slic3r/GUI/Camera.cpp | 26 ------------- src/slic3r/GUI/Camera.hpp | 12 ------ src/slic3r/GUI/GLCanvas3D.cpp | 23 ----------- src/slic3r/GUI/GLCanvas3D.hpp | 12 ------ src/slic3r/GUI/Plater.cpp | 14 ------- 16 files changed, 7 insertions(+), 224 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index 462dcf27b..f355d400d 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -3,9 +3,7 @@ #include "../Utils.hpp" #include "../GCode.hpp" #include "../Geometry.hpp" -#if ENABLE_THUMBNAIL_GENERATOR #include "../GCode/ThumbnailData.hpp" -#endif // ENABLE_THUMBNAIL_GENERATOR #include "../I18N.hpp" @@ -47,9 +45,7 @@ const std::string MODEL_EXTENSION = ".model"; const std::string MODEL_FILE = "3D/3dmodel.model"; // << this is the only format of the string which works with CURA const std::string CONTENT_TYPES_FILE = "[Content_Types].xml"; const std::string RELATIONSHIPS_FILE = "_rels/.rels"; -#if ENABLE_THUMBNAIL_GENERATOR const std::string THUMBNAIL_FILE = "Metadata/thumbnail.png"; -#endif // ENABLE_THUMBNAIL_GENERATOR const std::string PRINT_CONFIG_FILE = "Metadata/Slic3r_PE.config"; const std::string MODEL_CONFIG_FILE = "Metadata/Slic3r_PE_model.config"; const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt"; @@ -1969,22 +1965,12 @@ namespace Slic3r { bool m_fullpath_sources{ true }; public: -#if ENABLE_THUMBNAIL_GENERATOR bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr); -#else - bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources); -#endif // ENABLE_THUMBNAIL_GENERATOR private: -#if ENABLE_THUMBNAIL_GENERATOR bool _save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data); -#else - bool _save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config); -#endif // ENABLE_THUMBNAIL_GENERATOR bool _add_content_types_file_to_archive(mz_zip_archive& archive); -#if ENABLE_THUMBNAIL_GENERATOR bool _add_thumbnail_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data); -#endif // ENABLE_THUMBNAIL_GENERATOR bool _add_relationships_file_to_archive(mz_zip_archive& archive); bool _add_model_file_to_archive(mz_zip_archive& archive, const Model& model, IdToObjectDataMap &objects_data); bool _add_object_to_model_stream(std::stringstream& stream, unsigned int& object_id, ModelObject& object, BuildItemsList& build_items, VolumeToOffsetsMap& volumes_offsets); @@ -1999,26 +1985,14 @@ namespace Slic3r { bool _add_custom_gcode_per_print_z_file_to_archive(mz_zip_archive& archive, Model& model); }; -#if ENABLE_THUMBNAIL_GENERATOR bool _3MF_Exporter::save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data) { clear_errors(); m_fullpath_sources = fullpath_sources; return _save_model_to_file(filename, model, config, thumbnail_data); } -#else - bool _3MF_Exporter::save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources) - { - clear_errors(); - return _save_model_to_file(filename, model, config); - } -#endif // ENABLE_THUMBNAIL_GENERATOR -#if ENABLE_THUMBNAIL_GENERATOR bool _3MF_Exporter::_save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data) -#else - bool _3MF_Exporter::_save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config) -#endif // ENABLE_THUMBNAIL_GENERATOR { mz_zip_archive archive; mz_zip_zero_struct(&archive); @@ -2037,7 +2011,6 @@ namespace Slic3r { return false; } -#if ENABLE_THUMBNAIL_GENERATOR if ((thumbnail_data != nullptr) && thumbnail_data->is_valid()) { // Adds the file Metadata/thumbnail.png. @@ -2048,7 +2021,6 @@ namespace Slic3r { return false; } } -#endif // ENABLE_THUMBNAIL_GENERATOR // Adds relationships file ("_rels/.rels"). // The content of this file is the same for each PrusaSlicer 3mf. @@ -2160,9 +2132,7 @@ namespace Slic3r { stream << "\n"; stream << " \n"; stream << " \n"; -#if ENABLE_THUMBNAIL_GENERATOR stream << " \n"; -#endif // ENABLE_THUMBNAIL_GENERATOR stream << ""; std::string out = stream.str(); @@ -2176,7 +2146,6 @@ namespace Slic3r { return true; } -#if ENABLE_THUMBNAIL_GENERATOR bool _3MF_Exporter::_add_thumbnail_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data) { bool res = false; @@ -2194,7 +2163,6 @@ namespace Slic3r { return res; } -#endif // ENABLE_THUMBNAIL_GENERATOR bool _3MF_Exporter::_add_relationships_file_to_archive(mz_zip_archive& archive) { @@ -2202,9 +2170,7 @@ namespace Slic3r { stream << "\n"; stream << "\n"; stream << " \n"; -#if ENABLE_THUMBNAIL_GENERATOR stream << " \n"; -#endif // ENABLE_THUMBNAIL_GENERATOR stream << ""; std::string out = stream.str(); @@ -2795,22 +2761,13 @@ bool load_3mf(const char* path, DynamicPrintConfig* config, Model* model, bool c return res; } -#if ENABLE_THUMBNAIL_GENERATOR bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data) -#else -bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources) -#endif // ENABLE_THUMBNAIL_GENERATOR { if ((path == nullptr) || (model == nullptr)) return false; _3MF_Exporter exporter; -#if ENABLE_THUMBNAIL_GENERATOR bool res = exporter.save_model_to_file(path, *model, config, fullpath_sources, thumbnail_data); -#else - bool res = exporter.save_model_to_file(path, *model, config, fullpath_sources); -#endif // ENABLE_THUMBNAIL_GENERATOR - if (!res) exporter.log_errors(); diff --git a/src/libslic3r/Format/3mf.hpp b/src/libslic3r/Format/3mf.hpp index 8ca1ebde8..94a702775 100644 --- a/src/libslic3r/Format/3mf.hpp +++ b/src/libslic3r/Format/3mf.hpp @@ -26,20 +26,14 @@ namespace Slic3r { class Model; class DynamicPrintConfig; -#if ENABLE_THUMBNAIL_GENERATOR struct ThumbnailData; -#endif // ENABLE_THUMBNAIL_GENERATOR // Load the content of a 3mf file into the given model and preset bundle. extern bool load_3mf(const char* path, DynamicPrintConfig* config, Model* model, bool check_version); // Save the given model and the config data contained in the given Print into a 3mf file. // The model could be modified during the export process if meshes are not repaired or have no shared vertices -#if ENABLE_THUMBNAIL_GENERATOR extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr); -#else - extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources); -#endif // ENABLE_THUMBNAIL_GENERATOR }; // namespace Slic3r diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index ad11fddd9..3a90349b5 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -20,9 +20,7 @@ #include #include #include -#if ENABLE_THUMBNAIL_GENERATOR #include -#endif // ENABLE_THUMBNAIL_GENERATOR #include #include @@ -700,11 +698,7 @@ std::vector>> GCode::collec return layers_to_print; } -#if ENABLE_THUMBNAIL_GENERATOR void GCode::do_export(Print* print, const char* path, GCodePreviewData* preview_data, ThumbnailsGeneratorCallback thumbnail_cb) -#else -void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_data) -#endif // ENABLE_THUMBNAIL_GENERATOR { PROFILE_CLEAR(); @@ -730,11 +724,7 @@ void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_ try { m_placeholder_parser_failed_templates.clear(); -#if ENABLE_THUMBNAIL_GENERATOR this->_do_export(*print, file, thumbnail_cb); -#else - this->_do_export(*print, file); -#endif // ENABLE_THUMBNAIL_GENERATOR fflush(file); if (ferror(file)) { fclose(file); @@ -974,7 +964,6 @@ namespace DoExport { } } - #if ENABLE_THUMBNAIL_GENERATOR template static void export_thumbnails_to_file(ThumbnailsGeneratorCallback &thumbnail_cb, const std::vector &sizes, WriteToOutput output, ThrowIfCanceledCallback throw_if_canceled) { @@ -1018,7 +1007,6 @@ namespace DoExport { } } } - #endif // ENABLE_THUMBNAIL_GENERATOR // Fill in print_statistics and return formatted string containing filament statistics to be inserted into G-code comment section. static std::string update_print_stats_and_format_filament_stats( @@ -1124,11 +1112,7 @@ std::vector sort_object_instances_by_model_order(const Pri return instances; } -#if ENABLE_THUMBNAIL_GENERATOR void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thumbnail_cb) -#else -void GCode::_do_export(Print& print, FILE* file) -#endif // ENABLE_THUMBNAIL_GENERATOR { PROFILE_FUNC(); diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 650fb8860..7fc75c92b 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -17,9 +17,7 @@ #include "GCodeTimeEstimator.hpp" #include "EdgeGrid.hpp" #include "GCode/Analyzer.hpp" -#if ENABLE_THUMBNAIL_GENERATOR #include "GCode/ThumbnailData.hpp" -#endif // ENABLE_THUMBNAIL_GENERATOR #include #include @@ -166,11 +164,7 @@ public: // throws std::runtime_exception on error, // throws CanceledException through print->throw_if_canceled(). -#if ENABLE_THUMBNAIL_GENERATOR void do_export(Print* print, const char* path, GCodePreviewData* preview_data = nullptr, ThumbnailsGeneratorCallback thumbnail_cb = nullptr); -#else - void do_export(Print *print, const char *path, GCodePreviewData *preview_data = nullptr); -#endif // ENABLE_THUMBNAIL_GENERATOR // Exported for the helper classes (OozePrevention, Wipe) and for the Perl binding for unit tests. const Vec2d& origin() const { return m_origin; } @@ -210,11 +204,7 @@ public: }; private: -#if ENABLE_THUMBNAIL_GENERATOR void _do_export(Print &print, FILE *file, ThumbnailsGeneratorCallback thumbnail_cb); -#else - void _do_export(Print &print, FILE *file); -#endif //ENABLE_THUMBNAIL_GENERATOR static std::vector collect_layers_to_print(const PrintObject &object); static std::vector>> collect_layers_to_print(const Print &print); diff --git a/src/libslic3r/GCode/ThumbnailData.cpp b/src/libslic3r/GCode/ThumbnailData.cpp index 80165916b..09d564e95 100644 --- a/src/libslic3r/GCode/ThumbnailData.cpp +++ b/src/libslic3r/GCode/ThumbnailData.cpp @@ -1,8 +1,6 @@ #include "libslic3r/libslic3r.h" #include "ThumbnailData.hpp" -#if ENABLE_THUMBNAIL_GENERATOR - namespace Slic3r { void ThumbnailData::set(unsigned int w, unsigned int h) @@ -32,5 +30,3 @@ bool ThumbnailData::is_valid() const } } // namespace Slic3r - -#endif // ENABLE_THUMBNAIL_GENERATOR \ No newline at end of file diff --git a/src/libslic3r/GCode/ThumbnailData.hpp b/src/libslic3r/GCode/ThumbnailData.hpp index 4acfe4374..473ef274b 100644 --- a/src/libslic3r/GCode/ThumbnailData.hpp +++ b/src/libslic3r/GCode/ThumbnailData.hpp @@ -1,8 +1,6 @@ #ifndef slic3r_ThumbnailData_hpp_ #define slic3r_ThumbnailData_hpp_ -#if ENABLE_THUMBNAIL_GENERATOR - #include #include "libslic3r/Point.hpp" @@ -26,6 +24,4 @@ typedef std::function #include -#if ENABLE_THUMBNAIL_GENERATOR #include -#endif // ENABLE_THUMBNAIL_GENERATOR // Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx. #include "libslic3r/Print.hpp" @@ -89,11 +87,7 @@ void BackgroundSlicingProcess::process_fff() assert(m_print == m_fff_print); m_print->process(); wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_slicing_completed_id)); -#if ENABLE_THUMBNAIL_GENERATOR m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data, m_thumbnail_cb); -#else - m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data); -#endif // ENABLE_THUMBNAIL_GENERATOR if (this->set_step_started(bspsGCodeFinalize)) { if (! m_export_path.empty()) { @@ -135,7 +129,6 @@ void BackgroundSlicingProcess::process_fff() } } -#if ENABLE_THUMBNAIL_GENERATOR static void write_thumbnail(Zipper& zipper, const ThumbnailData& data) { size_t png_size = 0; @@ -146,7 +139,6 @@ static void write_thumbnail(Zipper& zipper, const ThumbnailData& data) mz_free(png_data); } } -#endif // ENABLE_THUMBNAIL_GENERATOR void BackgroundSlicingProcess::process_sla() { @@ -159,7 +151,6 @@ void BackgroundSlicingProcess::process_sla() Zipper zipper(export_path); m_sla_print->export_raster(zipper); -#if ENABLE_THUMBNAIL_GENERATOR if (m_thumbnail_cb != nullptr) { ThumbnailsList thumbnails; @@ -171,7 +162,6 @@ void BackgroundSlicingProcess::process_sla() write_thumbnail(zipper, data); } } -#endif // ENABLE_THUMBNAIL_GENERATOR zipper.finalize(); @@ -486,7 +476,6 @@ void BackgroundSlicingProcess::prepare_upload() Zipper zipper{source_path.string()}; m_sla_print->export_raster(zipper, m_upload_job.upload_data.upload_path.string()); -#if ENABLE_THUMBNAIL_GENERATOR if (m_thumbnail_cb != nullptr) { ThumbnailsList thumbnails; @@ -498,7 +487,6 @@ void BackgroundSlicingProcess::prepare_upload() write_thumbnail(zipper, data); } } -#endif // ENABLE_THUMBNAIL_GENERATOR zipper.finalize(); } diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp index 02f65d482..b868a233f 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp @@ -49,9 +49,7 @@ public: void set_fff_print(Print *print) { m_fff_print = print; } void set_sla_print(SLAPrint *print) { m_sla_print = print; } void set_gcode_preview_data(GCodePreviewData *gpd) { m_gcode_preview_data = gpd; } -#if ENABLE_THUMBNAIL_GENERATOR void set_thumbnail_cb(ThumbnailsGeneratorCallback cb) { m_thumbnail_cb = cb; } -#endif // ENABLE_THUMBNAIL_GENERATOR // The following wxCommandEvent will be sent to the UI thread / Plater window, when the slicing is finished // and the background processing will transition into G-code export. @@ -155,10 +153,8 @@ private: SLAPrint *m_sla_print = nullptr; // Data structure, to which the G-code export writes its annotations. GCodePreviewData *m_gcode_preview_data = nullptr; -#if ENABLE_THUMBNAIL_GENERATOR // Callback function, used to write thumbnails into gcode. ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr; -#endif // ENABLE_THUMBNAIL_GENERATOR // 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, diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 74c21d3e8..7ae4a7a1b 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -1,9 +1,6 @@ #include "libslic3r/libslic3r.h" #include "Camera.hpp" -#if !ENABLE_THUMBNAIL_GENERATOR -#include "3DScene.hpp" -#endif // !ENABLE_THUMBNAIL_GENERATOR #include "GUI_App.hpp" #include "AppConfig.hpp" #if ENABLE_CAMERA_STATISTICS @@ -25,10 +22,8 @@ namespace Slic3r { namespace GUI { const double Camera::DefaultDistance = 1000.0; -#if ENABLE_THUMBNAIL_GENERATOR const double Camera::DefaultZoomToBoxMarginFactor = 1.025; const double Camera::DefaultZoomToVolumesMarginFactor = 1.025; -#endif // ENABLE_THUMBNAIL_GENERATOR double Camera::FrustrumMinZRange = 50.0; double Camera::FrustrumMinNearZ = 100.0; double Camera::FrustrumZMargin = 10.0; @@ -219,18 +214,10 @@ void Camera::apply_projection(const BoundingBoxf3& box, double near_z, double fa glsafe(::glMatrixMode(GL_MODELVIEW)); } -#if ENABLE_THUMBNAIL_GENERATOR void Camera::zoom_to_box(const BoundingBoxf3& box, double margin_factor) -#else -void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h) -#endif // ENABLE_THUMBNAIL_GENERATOR { // Calculate the zoom factor needed to adjust the view around the given box. -#if ENABLE_THUMBNAIL_GENERATOR double zoom = calc_zoom_to_bounding_box_factor(box, margin_factor); -#else - double zoom = calc_zoom_to_bounding_box_factor(box, canvas_w, canvas_h); -#endif // ENABLE_THUMBNAIL_GENERATOR if (zoom > 0.0) { m_zoom = zoom; @@ -239,7 +226,6 @@ void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h) } } -#if ENABLE_THUMBNAIL_GENERATOR void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor) { Vec3d center; @@ -251,7 +237,6 @@ void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor) set_target(center); } } -#endif // ENABLE_THUMBNAIL_GENERATOR #if ENABLE_CAMERA_STATISTICS void Camera::debug_render() const @@ -387,11 +372,7 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo return ret; } -#if ENABLE_THUMBNAIL_GENERATOR double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor) const -#else -double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const -#endif // ENABLE_THUMBNAIL_GENERATOR { double max_bb_size = box.max_size(); if (max_bb_size == 0.0) @@ -423,11 +404,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int ca double max_x = -DBL_MAX; double max_y = -DBL_MAX; -#if !ENABLE_THUMBNAIL_GENERATOR - // margin factor to give some empty space around the box - double margin_factor = 1.25; -#endif // !ENABLE_THUMBNAIL_GENERATOR - for (const Vec3d& v : vertices) { // project vertex on the plane perpendicular to camera forward axis @@ -458,7 +434,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int ca return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy); } -#if ENABLE_THUMBNAIL_GENERATOR double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor) const { if (volumes.empty()) @@ -519,7 +494,6 @@ double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& c return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy); } -#endif // ENABLE_THUMBNAIL_GENERATOR void Camera::set_distance(double distance) const { diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index b784e7b96..ece999c07 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -2,9 +2,7 @@ #define slic3r_Camera_hpp_ #include "libslic3r/BoundingBox.hpp" -#if ENABLE_THUMBNAIL_GENERATOR #include "3DScene.hpp" -#endif // ENABLE_THUMBNAIL_GENERATOR #include namespace Slic3r { @@ -13,10 +11,8 @@ namespace GUI { struct Camera { static const double DefaultDistance; -#if ENABLE_THUMBNAIL_GENERATOR static const double DefaultZoomToBoxMarginFactor; static const double DefaultZoomToVolumesMarginFactor; -#endif // ENABLE_THUMBNAIL_GENERATOR static double FrustrumMinZRange; static double FrustrumMinNearZ; static double FrustrumZMargin; @@ -97,12 +93,8 @@ public: // If larger z span is needed, pass the desired values of near and far z (negative values are ignored) void apply_projection(const BoundingBoxf3& box, double near_z = -1.0, double far_z = -1.0) const; -#if ENABLE_THUMBNAIL_GENERATOR void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor); void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor); -#else - void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h); -#endif // ENABLE_THUMBNAIL_GENERATOR #if ENABLE_CAMERA_STATISTICS void debug_render() const; @@ -138,12 +130,8 @@ private: // returns tight values for nearZ and farZ plane around the given bounding box // the camera MUST be outside of the bounding box in eye coordinate of the given box std::pair calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const; -#if ENABLE_THUMBNAIL_GENERATOR double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor) const; double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const; -#else - double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const; -#endif // ENABLE_THUMBNAIL_GENERATOR void set_distance(double distance) const; void set_default_orientation(); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 90820df61..5d77fc1d4 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -7,9 +7,7 @@ #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/PrintConfig.hpp" #include "libslic3r/GCode/PreviewData.hpp" -#if ENABLE_THUMBNAIL_GENERATOR #include "libslic3r/GCode/ThumbnailData.hpp" -#endif // ENABLE_THUMBNAIL_GENERATOR #include "libslic3r/Geometry.hpp" #include "libslic3r/ExtrusionEntity.hpp" #include "libslic3r/Utils.hpp" @@ -1457,9 +1455,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event); wxDEFINE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent); wxDEFINE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent); -#if ENABLE_THUMBNAIL_GENERATOR const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25; -#endif // ENABLE_THUMBNAIL_GENERATOR GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar) : m_canvas(canvas) @@ -2060,7 +2056,6 @@ void GLCanvas3D::render() #endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI } -#if ENABLE_THUMBNAIL_GENERATOR void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const { switch (GLCanvas3DManager::get_framebuffers_type()) @@ -2070,7 +2065,6 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, default: { _render_thumbnail_legacy(thumbnail_data, w, h, printable_only, parts_only, show_bed, transparent_background); break; } } } -#endif // ENABLE_THUMBNAIL_GENERATOR void GLCanvas3D::select_all() { @@ -4221,7 +4215,6 @@ bool GLCanvas3D::_render_undo_redo_stack(const bool is_undo, float pos_x) const return action_taken; } -#if ENABLE_THUMBNAIL_GENERATOR #define ENABLE_THUMBNAIL_GENERATOR_DEBUG_OUTPUT 0 #if ENABLE_THUMBNAIL_GENERATOR_DEBUG_OUTPUT static void debug_output_thumbnail(const ThumbnailData& thumbnail_data) @@ -4571,7 +4564,6 @@ void GLCanvas3D::_render_thumbnail_legacy(ThumbnailData& thumbnail_data, unsigne // restore the default framebuffer size to avoid flickering on the 3D scene m_camera.apply_viewport(0, 0, cnv_size.get_width(), cnv_size.get_height()); } -#endif // ENABLE_THUMBNAIL_GENERATOR bool GLCanvas3D::_init_toolbars() { @@ -4899,20 +4891,11 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_be return bb; } -#if ENABLE_THUMBNAIL_GENERATOR void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box, double margin_factor) { m_camera.zoom_to_box(box, margin_factor); m_dirty = true; } -#else -void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box) -{ - const Size& cnv_size = get_canvas_size(); - m_camera.zoom_to_box(box, cnv_size.get_width(), cnv_size.get_height()); - m_dirty = true; -} -#endif // ENABLE_THUMBNAIL_GENERATOR void GLCanvas3D::_update_camera_zoom(double zoom) { @@ -5115,9 +5098,6 @@ void GLCanvas3D::_render_objects() const if (m_volumes.empty()) return; -#if !ENABLE_THUMBNAIL_GENERATOR - glsafe(::glEnable(GL_LIGHTING)); -#endif // !ENABLE_THUMBNAIL_GENERATOR glsafe(::glEnable(GL_DEPTH_TEST)); m_camera_clipping_plane = m_gizmos.get_sla_clipping_plane(); @@ -5161,9 +5141,6 @@ void GLCanvas3D::_render_objects() const m_shader.stop_using(); m_camera_clipping_plane = ClippingPlane::ClipsNothing(); -#if !ENABLE_THUMBNAIL_GENERATOR - glsafe(::glDisable(GL_LIGHTING)); -#endif // !ENABLE_THUMBNAIL_GENERATOR } void GLCanvas3D::_render_selection() const diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index f450133f8..c50935b87 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -38,9 +38,7 @@ class Bed3D; struct Camera; class BackgroundSlicingProcess; class GCodePreviewData; -#if ENABLE_THUMBNAIL_GENERATOR struct ThumbnailData; -#endif // ENABLE_THUMBNAIL_GENERATOR struct SlicingParameters; enum LayerHeightEditActionType : unsigned int; @@ -113,9 +111,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent); class GLCanvas3D { -#if ENABLE_THUMBNAIL_GENERATOR static const double DefaultCameraZoomToBoxMarginFactor; -#endif // ENABLE_THUMBNAIL_GENERATOR public: struct GCodePreviewVolumeIndex @@ -577,11 +573,9 @@ public: bool is_dragging() const { return m_gizmos.is_dragging() || m_moving; } void render(); -#if ENABLE_THUMBNAIL_GENERATOR // printable_only == false -> render also non printable volumes as grayed // parts_only == false -> render also sla support and pad void render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const; -#endif // ENABLE_THUMBNAIL_GENERATOR void select_all(); void deselect_all(); @@ -702,11 +696,7 @@ private: BoundingBoxf3 _max_bounding_box(bool include_gizmos, bool include_bed_model) const; -#if ENABLE_THUMBNAIL_GENERATOR void _zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultCameraZoomToBoxMarginFactor); -#else - void _zoom_to_box(const BoundingBoxf3& box); -#endif // ENABLE_THUMBNAIL_GENERATOR void _update_camera_zoom(double zoom); void _refresh_if_shown_on_screen(); @@ -735,7 +725,6 @@ private: void _render_sla_slices() const; void _render_selection_sidebar_hints() const; bool _render_undo_redo_stack(const bool is_undo, float pos_x) const; -#if ENABLE_THUMBNAIL_GENERATOR void _render_thumbnail_internal(ThumbnailData& thumbnail_data, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const; // render thumbnail using an off-screen framebuffer void _render_thumbnail_framebuffer(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const; @@ -743,7 +732,6 @@ private: void _render_thumbnail_framebuffer_ext(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const; // render thumbnail using the default framebuffer void _render_thumbnail_legacy(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const; -#endif // ENABLE_THUMBNAIL_GENERATOR void _update_volumes_hover_state() const; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5aabfc9a2..47bc6dd4a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -33,9 +33,7 @@ #include "libslic3r/Format/AMF.hpp" #include "libslic3r/Format/3mf.hpp" #include "libslic3r/GCode/PreviewData.hpp" -#if ENABLE_THUMBNAIL_GENERATOR #include "libslic3r/GCode/ThumbnailData.hpp" -#endif // ENABLE_THUMBNAIL_GENERATOR #include "libslic3r/Model.hpp" #include "libslic3r/SLA/Hollowing.hpp" #include "libslic3r/SLA/Rotfinder.hpp" @@ -92,9 +90,7 @@ using Slic3r::_3DScene; using Slic3r::Preset; using Slic3r::PrintHostJob; -#if ENABLE_THUMBNAIL_GENERATOR static const std::pair THUMBNAIL_SIZE_3MF = { 256, 256 }; -#endif // ENABLE_THUMBNAIL_GENERATOR namespace Slic3r { namespace GUI { @@ -1955,10 +1951,8 @@ struct Plater::priv bool can_mirror() const; bool can_reload_from_disk() const; -#if ENABLE_THUMBNAIL_GENERATOR void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background); void generate_thumbnails(ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background); -#endif // ENABLE_THUMBNAIL_GENERATOR void msw_rescale_object_menu(); @@ -2032,7 +2026,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) background_process.set_fff_print(&fff_print); background_process.set_sla_print(&sla_print); background_process.set_gcode_preview_data(&gcode_preview_data); -#if ENABLE_THUMBNAIL_GENERATOR background_process.set_thumbnail_cb([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) { std::packaged_task task([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) { @@ -2042,7 +2035,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) wxTheApp->CallAfter([&]() { task(thumbnails, sizes, printable_only, parts_only, show_bed, transparent_background); }); result.wait(); }); -#endif // ENABLE_THUMBNAIL_GENERATOR background_process.set_slicing_completed_event(EVT_SLICING_COMPLETED); background_process.set_finished_event(EVT_PROCESS_COMPLETED); // Default printer technology for default config. @@ -3852,7 +3844,6 @@ bool Plater::priv::init_object_menu() return true; } -#if ENABLE_THUMBNAIL_GENERATOR void Plater::priv::generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) { view3D->get_canvas3d()->render_thumbnail(data, w, h, printable_only, parts_only, show_bed, transparent_background); @@ -3870,7 +3861,6 @@ void Plater::priv::generate_thumbnails(ThumbnailsList& thumbnails, const Vec2ds& thumbnails.pop_back(); } } -#endif // ENABLE_THUMBNAIL_GENERATOR void Plater::priv::msw_rescale_object_menu() { @@ -4999,13 +4989,9 @@ void Plater::export_3mf(const boost::filesystem::path& output_path) const std::string path_u8 = into_u8(path); wxBusyCursor wait; bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1"; -#if ENABLE_THUMBNAIL_GENERATOR ThumbnailData thumbnail_data; p->generate_thumbnail(thumbnail_data, THUMBNAIL_SIZE_3MF.first, THUMBNAIL_SIZE_3MF.second, false, true, true, true); if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames, &thumbnail_data)) { -#else - if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) { -#endif // ENABLE_THUMBNAIL_GENERATOR // Success p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("3MF file exported to %s"))) % path).str())); p->set_project_filename(path);