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.
This commit is contained in:
bubnikv 2019-02-22 10:11:57 +01:00
parent 14b4685ecb
commit 53ccac6925
3 changed files with 9 additions and 4 deletions

View file

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

View file

@ -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<float>() * direction_to_camera.eval();
direction_to_camera = (instance_matrix_no_translation.inverse().cast<float>() * 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.size(); ++i) {
Vec3f pos = instance_matrix.cast<float>() * m_editing_mode_cache[i].first.pos;
const sla::SupportPoint &support_point = m_editing_mode_cache[i].first;
Vec3f pos = instance_matrix.cast<float>() * 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<igl::Hit> 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)

View file

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