SLA gizmos fix: clipping of points/holes always used coords from the first instance

Few warnings fixed
This commit is contained in:
Lukas Matena 2019-12-12 10:37:15 +01:00
parent 0c4297b4f9
commit 135660decf
3 changed files with 10 additions and 10 deletions

View File

@ -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<const TriangleMesh *, sla::HollowingConfig> GLGizmoHollow::get_hollowi
// FIXME this function is probably obsolete, caller could
// get the data from model config himself
std::vector<const ConfigOption*> opts = get_config_options({"hollowing_min_thickness", "hollowing_quality", "hollowing_closing_distance"});
float offset = static_cast<const ConfigOptionFloat*>(opts[0])->value;
float quality = static_cast<const ConfigOptionFloat*>(opts[1])->value;
float closing_d = static_cast<const ConfigOptionFloat*>(opts[2])->value;
return std::make_pair(m_mesh, sla::HollowingConfig{double(offset), double(quality), double(closing_d)});
double offset = static_cast<const ConfigOptionFloat*>(opts[0])->value;
double quality = static_cast<const ConfigOptionFloat*>(opts[1])->value;
double closing_d = static_cast<const ConfigOptionFloat*>(opts[2])->value;
return std::make_pair(m_mesh, sla::HollowingConfig{offset, quality, closing_d});
}
void GLGizmoHollow::update_mesh_raycaster(std::unique_ptr<MeshRaycaster> &&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;

View File

@ -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;

View File

@ -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);
}