Skip to content

Commit

Permalink
Removed confusing STL warning (fixes #57 and #58)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Jul 31, 2020
1 parent 9ca5a62 commit 78d0c92
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
15 changes: 4 additions & 11 deletions src/loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,12 @@ Mesh* Loader::load_stl()
file.seek(0);
return read_stl_ascii(file);
}
confusing_stl = true;
}
else
{
confusing_stl = false;
// Otherwise, this STL is a binary stl but contains 'solid' as
// the first five characters. This is a bad life choice, but
// we can gracefully handle it by falling through to the binary
// STL reader below.
}

// Otherwise, skip the rest of the header material and read as binary
file.seek(0);
return read_stl_binary(file);
}
Expand Down Expand Up @@ -179,11 +177,6 @@ Mesh* Loader::read_stl_binary(QFile& file)
b += 3 * sizeof(float) + sizeof(uint16_t);
}

if (confusing_stl)
{
emit warning_confusing_stl();
}

return mesh_from_verts(tri_count, verts);
}

Expand Down
5 changes: 0 additions & 5 deletions src/loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ class Loader : public QThread

void error_bad_stl();
void error_empty_mesh();
void warning_confusing_stl();
void error_missing_file();

private:
const QString filename;
bool is_reload;

/* Used to warn on binary STLs that begin with the word 'solid'" */
bool confusing_stl;

};

#endif // LOADER_H
10 changes: 0 additions & 10 deletions src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,6 @@ void Window::on_empty_mesh()
"This file is syntactically correct<br>but contains no triangles.");
}

void Window::on_confusing_stl()
{
QMessageBox::warning(this, "Warning",
"<b>Warning:</b><br>"
"This <code>.stl</code> file begins with <code>solid </code>but appears to be a binary file.<br>"
"<code>fstl</code> loaded it, but other programs may be confused by this file.");
}

void Window::on_missing_file()
{
QMessageBox::critical(this, "Error",
Expand Down Expand Up @@ -347,8 +339,6 @@ bool Window::load_stl(const QString& filename, bool is_reload)
this, &Window::on_bad_stl);
connect(loader, &Loader::error_empty_mesh,
this, &Window::on_empty_mesh);
connect(loader, &Loader::warning_confusing_stl,
this, &Window::on_confusing_stl);
connect(loader, &Loader::error_missing_file,
this, &Window::on_missing_file);

Expand Down
1 change: 0 additions & 1 deletion src/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public slots:
void on_bad_stl();
void on_empty_mesh();
void on_missing_file();
void on_confusing_stl();

void enable_open();
void disable_open();
Expand Down

0 comments on commit 78d0c92

Please sign in to comment.