From 53ccac6925175a9f10ce0ababc116e890c377978 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 22 Feb 2019 10:11:57 +0100 Subject: [PATCH] Show wait cursor when exporting an STL. Fix of SLA gizmo picking by rectangle: point is occluded only if an object is half its radius away from the point center. Don't show the temp G-code file name in the status bar when exporting. --- src/libslic3r/Print.cpp | 3 ++- src/slic3r/GUI/GLGizmo.cpp | 8 +++++--- src/slic3r/GUI/Plater.cpp | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 9ff913a1e..da7e882f4 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1506,7 +1506,8 @@ void Print::export_gcode(const std::string &path_template, GCodePreviewData *pre // The following call may die if the output_filename_format template substitution fails. std::string path = this->output_filepath(path_template); std::string message = "Exporting G-code"; - if (! path.empty()) { + if (! path.empty() && preview_data == nullptr) { + // Only show the path if preview_data is not set -> running from command line. message += " to "; message += path; } diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index 086dbfdb1..1ccb5ae81 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -2106,11 +2106,12 @@ bool GLGizmoSlaSupports::mouse_event(SLAGizmoEventType action, const Vec2d& mous // we'll recover current look direction from the modelview matrix (in world coords)... Vec3f direction_to_camera(modelview_matrix[2], modelview_matrix[6], modelview_matrix[10]); // ...and transform it to model coords. - direction_to_camera = instance_matrix_no_translation.inverse().cast() * direction_to_camera.eval(); + direction_to_camera = (instance_matrix_no_translation.inverse().cast() * direction_to_camera).normalized().eval(); // Iterate over all points, check if they're in the rectangle and if so, check that they are not obscured by the mesh: for (unsigned int i=0; i() * m_editing_mode_cache[i].first.pos; + const sla::SupportPoint &support_point = m_editing_mode_cache[i].first; + Vec3f pos = instance_matrix.cast() * support_point.pos; pos(2) += z_offset; GLdouble out_x, out_y, out_z; ::gluProject((GLdouble)pos(0), (GLdouble)pos(1), (GLdouble)pos(2), modelview_matrix, projection_matrix, viewport, &out_x, &out_y, &out_z); @@ -2120,7 +2121,8 @@ bool GLGizmoSlaSupports::mouse_event(SLAGizmoEventType action, const Vec2d& mous bool is_obscured = false; // Cast a ray in the direction of the camera and look for intersection with the mesh: std::vector hits; - if (m_AABB.intersect_ray(m_V, m_F, m_editing_mode_cache[i].first.pos, direction_to_camera, hits)) + // Offset the start of the ray to the front of the ball + EPSILON to account for numerical inaccuracies. + if (m_AABB.intersect_ray(m_V, m_F, support_point.pos + direction_to_camera * (support_point.head_front_radius + EPSILON), direction_to_camera, hits)) // FIXME: the intersection could in theory be behind the camera, but as of now we only have camera direction. // Also, the threshold is in mesh coordinates, not in actual dimensions. if (hits.size() > 1 || hits.front().t > 0.001f) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index eee9e76e2..114875637 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2972,6 +2972,8 @@ void Plater::export_stl(bool selection_only) const wxString path = dialog->GetPath(); const std::string path_u8 = into_u8(path); + wxBusyCursor wait; + TriangleMesh mesh; if (selection_only) { const auto &selection = p->get_selection();