diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 0da5e7380..41d5231f1 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -705,7 +705,7 @@ bool CLI::setup(int argc, char **argv) // Initialize with defaults. for (const t_optiondef_map *options : { &cli_actions_config_def.options, &cli_transform_config_def.options, &cli_misc_config_def.options }) - for (const std::pair &optdef : *options) + for (const t_optiondef_map::value_type &optdef : *options) m_config.option(optdef.first, true); set_data_dir(m_config.opt_string("datadir")); diff --git a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index 47ba7bbdc..00f6a999f 100644 --- a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -577,7 +577,7 @@ private: template - Shapes calcnfp(const Item &trsh, Level) + Shapes calcnfp(const Item &/*trsh*/, Level) { // Function for arbitrary level of nfp implementation // TODO: implement diff --git a/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp b/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp index dc1bbd4f1..486996f0d 100644 --- a/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp +++ b/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp @@ -33,7 +33,8 @@ public: PackResult(Item& item): item_ptr_(&item), move_(item.translation()), - rot_(item.rotation()) {} + rot_(item.rotation()), + overfit_(1.0) {} PackResult(double overfit = 1.0): item_ptr_(nullptr), overfit_(overfit) {} diff --git a/src/libslic3r/SLA/ConcaveHull.cpp b/src/libslic3r/SLA/ConcaveHull.cpp index 172408989..cfce36d16 100644 --- a/src/libslic3r/SLA/ConcaveHull.cpp +++ b/src/libslic3r/SLA/ConcaveHull.cpp @@ -40,36 +40,6 @@ Point ConcaveHull::centroid(const Points &pp) return c; } -// As it shows, the current offset_ex in ClipperUtils hangs if used in jtRound -// mode -template -static ClipperLib::Paths fast_offset(PolygonsProvider &&paths, - coord_t delta, - ClipperLib::JoinType jointype) -{ - using ClipperLib::ClipperOffset; - using ClipperLib::etClosedPolygon; - using ClipperLib::Paths; - using ClipperLib::Path; - - ClipperOffset offs; - offs.ArcTolerance = scaled(0.01); - - for (auto &p : paths) - // If the input is not at least a triangle, we can not do this algorithm - if(p.size() < 3) { - BOOST_LOG_TRIVIAL(error) << "Invalid geometry for offsetting!"; - return {}; - } - - offs.AddPaths(std::forward(paths), jointype, etClosedPolygon); - - Paths result; - offs.Execute(result, static_cast(delta)); - - return result; -} - Points ConcaveHull::calculate_centroids() const { // We get the centroids of all the islands in the 2D slice @@ -158,15 +128,17 @@ ExPolygons ConcaveHull::to_expolygons() const ExPolygons offset_waffle_style_ex(const ConcaveHull &hull, coord_t delta) { - ExPolygons ret = ClipperPaths_to_Slic3rExPolygons( - fast_offset(fast_offset(ClipperUtils::PolygonsProvider(hull.polygons()), 2 * delta, ClipperLib::jtRound), -delta, ClipperLib::jtRound)); - for (ExPolygon &p : ret) p.holes.clear(); - return ret; + return to_expolygons(offset_waffle_style(hull, delta)); } Polygons offset_waffle_style(const ConcaveHull &hull, coord_t delta) { - return to_polygons(offset_waffle_style_ex(hull, delta)); + Polygons res = closing(hull.polygons(), 2 * delta, delta, ClipperLib::jtRound); + + auto it = std::remove_if(res.begin(), res.end(), [](Polygon &p) { return p.is_clockwise(); }); + res.erase(it, res.end()); + + return res; } }} // namespace Slic3r::sla diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 1bc548914..43ac958b5 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1216,7 +1216,7 @@ DynamicConfig SLAPrintStatistics::config() const DynamicConfig SLAPrintStatistics::placeholders() { DynamicConfig config; - for (const std::string &key : { + for (const char *key : { "print_time", "total_cost", "total_weight", "objects_used_material", "support_used_material" }) config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}")); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d6a8cbe04..78806b2d3 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2568,12 +2568,15 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) if (camera_space) { Eigen::Matrix inv_view_3x3 = wxGetApp().plater()->get_camera().get_view_matrix().inverse().matrix().block(0, 0, 3, 3); displacement = multiplier * (inv_view_3x3 * direction); - displacement(2) = 0.0; + displacement.z() = 0.0; } else displacement = multiplier * direction; m_selection.translate(displacement); +#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS + m_selection.stop_dragging(); +#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS m_dirty = true; } ); @@ -2672,6 +2675,9 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) auto do_rotate = [this](double angle_z_rad) { m_selection.start_dragging(); m_selection.rotate(Vec3d(0.0, 0.0, angle_z_rad), TransformationType(TransformationType::World_Relative_Joint)); +#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS + m_selection.stop_dragging(); +#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS m_dirty = true; // wxGetApp().obj_manipul()->set_dirty(); }; diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 09492db09..c279fad90 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -820,6 +820,9 @@ void ObjectManipulation::change_position_value(int axis, double value) Selection& selection = canvas->get_selection(); selection.start_dragging(); selection.translate(position - m_cache.position, selection.requires_local_axes()); +#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS + selection.stop_dragging(); +#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS canvas->do_move(L("Set Position")); m_cache.position = position; @@ -851,6 +854,9 @@ void ObjectManipulation::change_rotation_value(int axis, double value) selection.rotate( (M_PI / 180.0) * (transformation_type.absolute() ? rotation : rotation - m_cache.rotation), transformation_type); +#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS + selection.stop_dragging(); +#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS canvas->do_rotate(L("Set Orientation")); m_cache.rotation = rotation; @@ -923,6 +929,9 @@ void ObjectManipulation::do_scale(int axis, const Vec3d &scale) const selection.start_dragging(); selection.scale(scaling_factor, transformation_type); +#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS + selection.stop_dragging(); +#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale")); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 09480492b..5f46ad3b7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -723,6 +723,12 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt) gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down); processed = true; } +#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS + else if (evt.LeftUp()) { + selection.stop_dragging(); + wxGetApp().obj_manipul()->set_dirty(); + } +#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS } else { // mouse inside toolbar