Several minor improvements and fixed warnings

This commit is contained in:
Lukas Matena 2021-10-01 14:31:22 +02:00
parent 1edbdcfecf
commit 4ca2401b69
5 changed files with 8 additions and 7 deletions

View file

@ -1922,7 +1922,7 @@ namespace Slic3r {
{
int min_id = its.indices.front()[0];
int max_id = min_id;
for (const Vec3i face : its.indices) {
for (const Vec3i& face : its.indices) {
for (const int tri_id : face) {
if (tri_id < 0 || tri_id >= int(geometry.vertices.size())) {
add_error("Found invalid vertex id");

View file

@ -626,7 +626,7 @@ void AMFParserContext::endElement(const char * /* name */)
// Verify validity of face indices, find the vertex span.
int min_id = m_volume_facets.front()[0];
int max_id = min_id;
for (const Vec3i face : m_volume_facets) {
for (const Vec3i& face : m_volume_facets) {
for (const int tri_id : face) {
if (tri_id < 0 || tri_id >= int(m_object_vertices.size())) {
this->stop("Malformed triangle mesh");

View file

@ -1456,7 +1456,7 @@ void GCodeProcessor::apply_config_simplify3d(const std::string& filename)
begin = skip_whitespaces(begin, end);
end = remove_eols(begin, end);
if (begin != end)
if (begin != end) {
if (*begin == ';') {
// Comment.
begin = skip_whitespaces(++ begin, end);
@ -1485,6 +1485,7 @@ void GCodeProcessor::apply_config_simplify3d(const std::string& filename)
// Some non-empty G-code line detected, stop parsing config comments.
reader.quit_parsing();
}
}
});
if (m_result.extruders_count == 0)

View file

@ -1300,7 +1300,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
num_extruders,
painting_extruders,
*print_object_regions,
[&print_object, it_print_object, it_print_object_end, &update_apply_status](const PrintRegionConfig &old_config, const PrintRegionConfig &new_config, const t_config_option_keys &diff_keys) {
[it_print_object, it_print_object_end, &update_apply_status](const PrintRegionConfig &old_config, const PrintRegionConfig &new_config, const t_config_option_keys &diff_keys) {
for (auto it = it_print_object; it != it_print_object_end; ++it)
if ((*it)->m_shared_regions != nullptr)
update_apply_status((*it)->invalidate_state_by_config_options(old_config, new_config, diff_keys));

View file

@ -465,7 +465,7 @@ TriangleMesh TriangleMesh::convex_hull_3d() const
std::vector<int> map_dst_vertices;
#ifndef NDEBUG
Vec3f centroid = Vec3f::Zero();
for (auto pt : this->its.vertices)
for (const stl_vertex& pt : this->its.vertices)
centroid += pt;
centroid /= float(this->its.vertices.size());
#endif // NDEBUG
@ -1261,7 +1261,7 @@ bool its_write_stl_ascii(const char *file, const char *label, const std::vector<
fprintf(fp, "solid %s\n", label);
for (const stl_triangle_vertex_indices face : indices) {
for (const stl_triangle_vertex_indices& face : indices) {
Vec3f vertex[3] = { vertices[face(0)], vertices[face(1)], vertices[face(2)] };
Vec3f normal = (vertex[1] - vertex[0]).cross(vertex[2] - vertex[1]).normalized();
fprintf(fp, " facet normal % .8E % .8E % .8E\n", normal(0), normal(1), normal(2));
@ -1301,7 +1301,7 @@ bool its_write_stl_binary(const char *file, const char *label, const std::vector
stl_facet f;
f.extra[0] = 0;
f.extra[1] = 0;
for (const stl_triangle_vertex_indices face : indices) {
for (const stl_triangle_vertex_indices& face : indices) {
f.vertex[0] = vertices[face(0)];
f.vertex[1] = vertices[face(1)];
f.vertex[2] = vertices[face(2)];