diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index d374b21f6..fe7606041 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -40,8 +40,6 @@ #define ENABLE_MOVE_MIN_THRESHOLD (1 && ENABLE_1_42_0_ALPHA4) // Modified initial default placement of generic subparts #define ENABLE_GENERIC_SUBPARTS_PLACEMENT (1 && ENABLE_1_42_0_ALPHA4) -// Reworked management of bed shape changes -#define ENABLE_REWORKED_BED_SHAPE_CHANGE (1 && ENABLE_1_42_0_ALPHA4) // Use anisotropic filtering on bed plate texture #define ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES (1 && ENABLE_1_42_0_ALPHA4) // Bunch of fixes related to volumes centering diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 06e897499..8024e6a46 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -367,11 +367,7 @@ const Pointfs& GLCanvas3D::Bed::get_shape() const bool GLCanvas3D::Bed::set_shape(const Pointfs& shape) { -#if ENABLE_REWORKED_BED_SHAPE_CHANGE EType new_type = _detect_type(shape); -#else - EType new_type = _detect_type(); -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE if (m_shape == shape && m_type == new_type) // No change, no need to update the UI. return false; @@ -489,11 +485,7 @@ void GLCanvas3D::Bed::_calc_gridlines(const ExPolygon& poly, const BoundingBox& printf("Unable to create bed grid lines\n"); } -#if ENABLE_REWORKED_BED_SHAPE_CHANGE GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type(const Pointfs& shape) const -#else -GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE { EType type = Custom; @@ -505,7 +497,6 @@ GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const { if (curr->config.has("bed_shape")) { -#if ENABLE_REWORKED_BED_SHAPE_CHANGE if ((curr->vendor != nullptr) && (curr->vendor->name == "Prusa Research") && (shape == dynamic_cast(curr->config.option("bed_shape"))->values)) { if (boost::contains(curr->name, "SL1")) @@ -524,29 +515,6 @@ GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const break; } } -#else - if (boost::contains(curr->name, "SL1")) - { - //FIXME add a condition on the size of the print bed? - type = SL1; - break; - } - else if (_are_equal(m_shape, dynamic_cast(curr->config.option("bed_shape"))->values)) - { - if ((curr->vendor != nullptr) && (curr->vendor->name == "Prusa Research")) - { - if (boost::contains(curr->name, "MK3") || boost::contains(curr->name, "MK2.5")) - { - type = MK3; - break; - } else if (boost::contains(curr->name, "MK2")) - { - type = MK2; - break; - } - } - } -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE } curr = bundle->printers.get_preset_parent(*curr); @@ -718,22 +686,6 @@ void GLCanvas3D::Bed::_render_custom() const } } -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE -bool GLCanvas3D::Bed::_are_equal(const Pointfs& bed_1, const Pointfs& bed_2) -{ - if (bed_1.size() != bed_2.size()) - return false; - - for (unsigned int i = 0; i < (unsigned int)bed_1.size(); ++i) - { - if (bed_1[i] != bed_2[i]) - return false; - } - - return true; -} -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE - const double GLCanvas3D::Axes::Radius = 0.5; const double GLCanvas3D::Axes::ArrowBaseRadius = 2.5 * GLCanvas3D::Axes::Radius; const double GLCanvas3D::Axes::ArrowLength = 5.0; @@ -4039,11 +3991,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) , m_dirty(true) , m_initialized(false) , m_use_VBOs(false) -#if ENABLE_REWORKED_BED_SHAPE_CHANGE , m_requires_zoom_to_bed(false) -#else - , m_force_zoom_to_bed_enabled(false) -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE , m_apply_zoom_to_volumes_filter(false) , m_hover_volume_id(-1) , m_toolbar_action_running(false) @@ -4236,7 +4184,6 @@ void GLCanvas3D::set_bed_shape(const Pointfs& shape) { bool new_shape = m_bed.set_shape(shape); -#if ENABLE_REWORKED_BED_SHAPE_CHANGE if (new_shape) { // Set the origin and size for painting of the coordinate system axes. @@ -4247,16 +4194,6 @@ void GLCanvas3D::set_bed_shape(const Pointfs& shape) m_dirty = true; } -#else - // Set the origin and size for painting of the coordinate system axes. - m_axes.origin = Vec3d(0.0, 0.0, (double)GROUND_Z); - set_bed_axes_length(0.1 * m_bed.get_bounding_box().max_size()); - - if (new_shape) - zoom_to_bed(); - - m_dirty = true; -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE } void GLCanvas3D::set_bed_axes_length(double length) @@ -4356,13 +4293,6 @@ void GLCanvas3D::enable_toolbar(bool enable) m_toolbar.set_enabled(enable); } -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE -void GLCanvas3D::enable_force_zoom_to_bed(bool enable) -{ - m_force_zoom_to_bed_enabled = enable; -} -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE - void GLCanvas3D::enable_dynamic_background(bool enable) { m_dynamic_background_enabled = enable; @@ -4501,7 +4431,6 @@ void GLCanvas3D::render() if (!_set_current() || !_3DScene::init(m_canvas)) return; -#if ENABLE_REWORKED_BED_SHAPE_CHANGE if (m_bed.get_shape().empty()) { // this happens at startup when no data is still saved under <>\AppData\Roaming\Slic3rPE @@ -4516,10 +4445,6 @@ void GLCanvas3D::render() _resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height()); m_requires_zoom_to_bed = false; } -#else - if (m_force_zoom_to_bed_enabled) - _force_zoom_to_bed(); -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE _camera_tranform(); @@ -4815,10 +4740,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re if (m_reload_delayed) return; -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - set_bed_shape(dynamic_cast(m_config->option("bed_shape"))->values); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE - if (m_regenerate_volumes) { m_volumes.volumes = std::move(glvolumes_new); @@ -6059,14 +5980,6 @@ bool GLCanvas3D::_is_shown_on_screen() const return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false; } -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE -void GLCanvas3D::_force_zoom_to_bed() -{ - zoom_to_bed(); - m_force_zoom_to_bed_enabled = false; -} -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE - bool GLCanvas3D::_init_toolbar() { if (!m_toolbar.is_enabled()) @@ -6292,11 +6205,7 @@ void GLCanvas3D::_zoom_to_bounding_box(const BoundingBoxf3& bbox) viewport_changed(); -#if ENABLE_REWORKED_BED_SHAPE_CHANGE m_dirty = true; -#else - _refresh_if_shown_on_screen(); -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE } } @@ -6376,15 +6285,7 @@ void GLCanvas3D::_refresh_if_shown_on_screen() // Because of performance problems on macOS, where PaintEvents are not delivered // frequently enough, we call render() here directly when we can. -#if ENABLE_REWORKED_BED_SHAPE_CHANGE render(); -#else - // We can't do that when m_force_zoom_to_bed_enabled == true, because then render() - // ends up calling back here via _force_zoom_to_bed(), causing a stack overflow. - if (m_canvas != nullptr) { - m_force_zoom_to_bed_enabled ? m_canvas->Refresh() : render(); - } -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE } } diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 1cba644aa..44e8ee0b2 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -224,9 +224,7 @@ class GLCanvas3D public: Bed(); -#if ENABLE_REWORKED_BED_SHAPE_CHANGE EType get_type() const { return m_type; } -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE bool is_prusa() const; bool is_custom() const; @@ -245,16 +243,9 @@ class GLCanvas3D void _calc_bounding_box(); void _calc_triangles(const ExPolygon& poly); void _calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox); -#if ENABLE_REWORKED_BED_SHAPE_CHANGE EType _detect_type(const Pointfs& shape) const; -#else - EType _detect_type() const; -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE void _render_prusa(const std::string &key, float theta, bool useVBOs) const; void _render_custom() const; -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - static bool _are_equal(const Pointfs& bed_1, const Pointfs& bed_2); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE }; struct Axes @@ -897,11 +888,7 @@ private: bool m_dirty; bool m_initialized; bool m_use_VBOs; -#if ENABLE_REWORKED_BED_SHAPE_CHANGE bool m_requires_zoom_to_bed; -#else - bool m_force_zoom_to_bed_enabled; -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE bool m_apply_zoom_to_volumes_filter; mutable int m_hover_volume_id; bool m_toolbar_action_running; @@ -987,9 +974,6 @@ public: void enable_moving(bool enable); void enable_gizmos(bool enable); void enable_toolbar(bool enable); -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - void enable_force_zoom_to_bed(bool enable); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE void enable_dynamic_background(bool enable); void allow_multisample(bool allow); @@ -1074,9 +1058,6 @@ public: private: bool _is_shown_on_screen() const; -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - void _force_zoom_to_bed(); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE bool _init_toolbar(); diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 0ad6c3562..6f758f375 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -69,9 +69,6 @@ bool View3D::init(wxWindow* parent, Model* model, DynamicPrintConfig* config, Ba m_canvas->set_config(config); m_canvas->enable_gizmos(true); m_canvas->enable_toolbar(true); -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - m_canvas->enable_force_zoom_to_bed(true); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE #if !ENABLE_IMGUI m_gizmo_widget = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); @@ -107,12 +104,7 @@ void View3D::set_as_dirty() void View3D::set_bed_shape(const Pointfs& shape) { if (m_canvas != nullptr) - { m_canvas->set_bed_shape(shape); -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - m_canvas->zoom_to_bed(); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE - } } void View3D::select_view(const std::string& direction) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f5471cdff..e970a30dc 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1136,12 +1136,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) this->background_process_timer.SetOwner(this->q, 0); this->q->Bind(wxEVT_TIMER, [this](wxTimerEvent &evt) { this->update_restart_background_process(false, false); }); -#if !ENABLE_REWORKED_BED_SHAPE_CHANGE - auto *bed_shape = config->opt("bed_shape"); - view3D->set_bed_shape(bed_shape->values); - preview->set_bed_shape(bed_shape->values); -#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE - update(); auto *hsizer = new wxBoxSizer(wxHORIZONTAL); @@ -3023,20 +3017,13 @@ void Plater::on_extruders_change(int num_extruders) void Plater::on_config_change(const DynamicPrintConfig &config) { bool update_scheduled = false; -#if ENABLE_REWORKED_BED_SHAPE_CHANGE bool bed_shape_changed = false; -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE for (auto opt_key : p->config->diff(config)) { p->config->set_key_value(opt_key, config.option(opt_key)->clone()); if (opt_key == "printer_technology") this->set_printer_technology(config.opt_enum(opt_key)); else if (opt_key == "bed_shape") { -#if ENABLE_REWORKED_BED_SHAPE_CHANGE bed_shape_changed = true; -#else - if (p->view3D) p->view3D->set_bed_shape(p->config->option(opt_key)->values); - if (p->preview) p->preview->set_bed_shape(p->config->option(opt_key)->values); -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE update_scheduled = true; } else if (boost::starts_with(opt_key, "wipe_tower") || @@ -3062,12 +3049,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) } else if (opt_key == "printer_model") { // update to force bed selection(for texturing) -#if ENABLE_REWORKED_BED_SHAPE_CHANGE bed_shape_changed = true; -#else - if (p->view3D) p->view3D->set_bed_shape(p->config->option("bed_shape")->values); - if (p->preview) p->preview->set_bed_shape(p->config->option("bed_shape")->values); -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE update_scheduled = true; } else if (opt_key == "host_type" && this->p->printer_technology == ptSLA) { @@ -3080,13 +3062,11 @@ void Plater::on_config_change(const DynamicPrintConfig &config) p->sidebar->show_send(prin_host_opt != nullptr && !prin_host_opt->value.empty()); } -#if ENABLE_REWORKED_BED_SHAPE_CHANGE if (bed_shape_changed) { if (p->view3D) p->view3D->set_bed_shape(p->config->option("bed_shape")->values); if (p->preview) p->preview->set_bed_shape(p->config->option("bed_shape")->values); } -#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE if (update_scheduled) update();