From 0cb0f56a8025a0080c6693bda51c67ef392f3e89 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 12 Jan 2022 14:12:13 +0100 Subject: [PATCH] Tech ENABLE_ENHANCED_PRINT_VOLUME_FIT set as default --- src/libslic3r/Technologies.hpp | 9 ------ src/slic3r/GUI/GUI_Factories.cpp | 5 ---- src/slic3r/GUI/Plater.cpp | 10 ------- src/slic3r/GUI/Plater.hpp | 2 -- src/slic3r/GUI/Selection.cpp | 47 -------------------------------- src/slic3r/GUI/Selection.hpp | 6 ---- 6 files changed, 79 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index b72dbd32c..f2dddca07 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -36,15 +36,6 @@ #define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS 1 -//==================== -// 2.4.0.beta2 techs -//==================== -#define ENABLE_2_4_0_BETA2 1 - -// Enable fit print volume command for circular printbeds -#define ENABLE_ENHANCED_PRINT_VOLUME_FIT (1 && ENABLE_2_4_0_BETA2) - - //================ // 2.4.1.rc techs //================ diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index aaa0a1dce..c3aaa2f4e 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -792,14 +792,9 @@ void MenuFactory::append_menu_item_change_extruder(wxMenu* menu) void MenuFactory::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu) { -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT append_menu_item(menu, wxID_ANY, _L("Scale to print volume"), _L("Scale the selected object to fit the print volume"), [](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu, []() { return plater()->can_scale_to_print_volume(); }, m_parent); -#else - append_menu_item(menu, wxID_ANY, _L("Scale to print volume"), _L("Scale the selected object to fit the print volume"), - [](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu); -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT } void MenuFactory::append_menu_items_convert_unit(wxMenu* menu, int insert_pos/* = 1*/) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a5ef5ffed..2a4ba6f48 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1941,9 +1941,7 @@ struct Plater::priv bool can_reload_from_disk() const; bool can_replace_with_stl() const; bool can_split(bool to_objects) const; -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT bool can_scale_to_print_volume() const; -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, Camera::EType camera_type); ThumbnailsList generate_thumbnails(const ThumbnailsParams& params, Camera::EType camera_type); @@ -3117,11 +3115,7 @@ void Plater::priv::split_volume() void Plater::priv::scale_selection_to_fit_print_volume() { -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(this->bed.build_volume()); -#else - this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(*config); -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT } void Plater::priv::schedule_background_process() @@ -4536,13 +4530,11 @@ bool Plater::priv::can_split(bool to_objects) const return sidebar->obj_list()->is_splittable(to_objects); } -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT bool Plater::priv::can_scale_to_print_volume() const { const BuildVolume::Type type = this->bed.build_volume().type(); return !view3D->get_canvas3d()->get_selection().is_empty() && (type == BuildVolume::Type::Rectangle || type == BuildVolume::Type::Circle); } -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT bool Plater::priv::layers_height_allowed() const { @@ -6863,9 +6855,7 @@ bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); } bool Plater::can_replace_with_stl() const { return p->can_replace_with_stl(); } bool Plater::can_mirror() const { return p->can_mirror(); } bool Plater::can_split(bool to_objects) const { return p->can_split(to_objects); } -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT bool Plater::can_scale_to_print_volume() const { return p->can_scale_to_print_volume(); } -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); } void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index d3eead4ed..3b4236a61 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -323,9 +323,7 @@ public: bool can_replace_with_stl() const; bool can_mirror() const; bool can_split(bool to_objects) const; -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT bool can_scale_to_print_volume() const; -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT void msw_rescale(); void sys_color_changed(); diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 8d99bd48b..50249dd8c 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -15,9 +15,7 @@ #include "libslic3r/LocalesUtils.hpp" #include "libslic3r/Model.hpp" #include "libslic3r/PresetBundle.hpp" -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT #include "libslic3r/BuildVolume.hpp" -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT #include @@ -943,7 +941,6 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type wxGetApp().plater()->canvas3D()->requires_check_outside_state(); } -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT void Selection::scale_to_fit_print_volume(const BuildVolume& volume) { auto fit = [this](double s, Vec3d offset) { @@ -1031,50 +1028,6 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume) default: { break; } } } -#else -void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config) -{ - if (is_empty() || m_mode == Volume) - return; - - // adds 1/100th of a mm on all sides to avoid false out of print volume detections due to floating-point roundings - Vec3d box_size = get_bounding_box().size() + 0.01 * Vec3d::Ones(); - - const ConfigOptionPoints* opt = dynamic_cast(config.option("bed_shape")); - if (opt != nullptr) { - BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values)); - BoundingBoxf3 print_volume({ unscale(bed_box_2D.min(0)), unscale(bed_box_2D.min(1)), 0.0 }, { unscale(bed_box_2D.max(0)), unscale(bed_box_2D.max(1)), config.opt_float("max_print_height") }); - Vec3d print_volume_size = print_volume.size(); - double sx = (box_size(0) != 0.0) ? print_volume_size(0) / box_size(0) : 0.0; - double sy = (box_size(1) != 0.0) ? print_volume_size(1) / box_size(1) : 0.0; - double sz = (box_size(2) != 0.0) ? print_volume_size(2) / box_size(2) : 0.0; - if (sx != 0.0 && sy != 0.0 && sz != 0.0) - { - double s = std::min(sx, std::min(sy, sz)); - if (s != 1.0) { - wxGetApp().plater()->take_snapshot(_L("Scale To Fit")); - - TransformationType type; - type.set_world(); - type.set_relative(); - type.set_joint(); - - // apply scale - start_dragging(); - scale(s * Vec3d::Ones(), type); - wxGetApp().plater()->canvas3D()->do_scale(""); // avoid storing another snapshot - - // center selection on print bed - start_dragging(); - translate(print_volume.center() - get_bounding_box().center()); - wxGetApp().plater()->canvas3D()->do_move(""); // avoid storing another snapshot - - wxGetApp().obj_manipul()->set_dirty(); - } - } - } -} -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT void Selection::mirror(Axis axis) { diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index c18d24eab..537c07207 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -17,9 +17,7 @@ class GLArrow; class GLCurvedArrow; class DynamicPrintConfig; class GLShaderProgram; -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT class BuildVolume; -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT using GLVolumePtrs = std::vector; using ModelObjectPtrs = std::vector; @@ -323,11 +321,7 @@ public: void rotate(const Vec3d& rotation, TransformationType transformation_type); void flattening_rotate(const Vec3d& normal); void scale(const Vec3d& scale, TransformationType transformation_type); -#if ENABLE_ENHANCED_PRINT_VOLUME_FIT void scale_to_fit_print_volume(const BuildVolume& volume); -#else - void scale_to_fit_print_volume(const DynamicPrintConfig& config); -#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT void mirror(Axis axis); void translate(unsigned int object_idx, const Vec3d& displacement);