From 135660decfd2cdb6d8b26059c05fa084e399bff2 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 12 Dec 2019 10:37:15 +0100 Subject: [PATCH] SLA gizmos fix: clipping of points/holes always used coords from the first instance Few warnings fixed --- src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 16 ++++++++-------- src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index 6b4f00a8c..0bbaa19c4 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -323,7 +323,7 @@ bool GLGizmoHollow::is_mesh_point_clipped(const Vec3d& point) const if (m_clipping_plane_distance == 0.f) return false; - Vec3d transformed_point = m_model_object->instances.front()->get_transformation().get_matrix() * point; + Vec3d transformed_point = m_model_object->instances[m_active_instance]->get_transformation().get_matrix() * point; transformed_point(2) += m_z_shift; return m_clipping_plane->is_point_clipped(transformed_point); } @@ -534,7 +534,7 @@ bool GLGizmoHollow::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_pos return false; } -void GLGizmoHollow::delete_selected_points(bool force) +void GLGizmoHollow::delete_selected_points() { Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("Delete drainage hole"))); @@ -564,10 +564,10 @@ std::pair GLGizmoHollow::get_hollowi // FIXME this function is probably obsolete, caller could // get the data from model config himself std::vector opts = get_config_options({"hollowing_min_thickness", "hollowing_quality", "hollowing_closing_distance"}); - float offset = static_cast(opts[0])->value; - float quality = static_cast(opts[1])->value; - float closing_d = static_cast(opts[2])->value; - return std::make_pair(m_mesh, sla::HollowingConfig{double(offset), double(quality), double(closing_d)}); + double offset = static_cast(opts[0])->value; + double quality = static_cast(opts[1])->value; + double closing_d = static_cast(opts[2])->value; + return std::make_pair(m_mesh, sla::HollowingConfig{offset, quality, closing_d}); } void GLGizmoHollow::update_mesh_raycaster(std::unique_ptr &&rc) @@ -833,10 +833,10 @@ RENDER_AGAIN: if (remove_all) { select_point(AllPoints); - delete_selected_points(true); // true - delete regardless of locked status + delete_selected_points(); } if (remove_selected) - delete_selected_points(false); // leave locked points + delete_selected_points(); if (first_run) { first_run = false; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp index 1c548e14a..8e022eb1e 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp @@ -48,7 +48,7 @@ public: ~GLGizmoHollow() override; void set_sla_support_data(ModelObject* model_object, const Selection& selection); bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down); - void delete_selected_points(bool force = false); + void delete_selected_points(); ClippingPlane get_sla_clipping_plane() const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index ac3dd8058..cf3f91dac 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -377,7 +377,7 @@ bool GLGizmoSlaSupports::is_mesh_point_clipped(const Vec3d& point) const if (m_clipping_plane_distance == 0.f) return false; - Vec3d transformed_point = m_model_object->instances.front()->get_transformation().get_matrix() * point; + Vec3d transformed_point = m_model_object->instances[m_active_instance]->get_transformation().get_matrix() * point; transformed_point(2) += m_z_shift; return m_clipping_plane->is_point_clipped(transformed_point); }