mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-10 05:21:47 +08:00
Several minor improvements and fixed warnings
This commit is contained in:
parent
1edbdcfecf
commit
4ca2401b69
@ -1922,7 +1922,7 @@ namespace Slic3r {
|
|||||||
{
|
{
|
||||||
int min_id = its.indices.front()[0];
|
int min_id = its.indices.front()[0];
|
||||||
int max_id = min_id;
|
int max_id = min_id;
|
||||||
for (const Vec3i face : its.indices) {
|
for (const Vec3i& face : its.indices) {
|
||||||
for (const int tri_id : face) {
|
for (const int tri_id : face) {
|
||||||
if (tri_id < 0 || tri_id >= int(geometry.vertices.size())) {
|
if (tri_id < 0 || tri_id >= int(geometry.vertices.size())) {
|
||||||
add_error("Found invalid vertex id");
|
add_error("Found invalid vertex id");
|
||||||
|
@ -626,7 +626,7 @@ void AMFParserContext::endElement(const char * /* name */)
|
|||||||
// Verify validity of face indices, find the vertex span.
|
// Verify validity of face indices, find the vertex span.
|
||||||
int min_id = m_volume_facets.front()[0];
|
int min_id = m_volume_facets.front()[0];
|
||||||
int max_id = min_id;
|
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) {
|
for (const int tri_id : face) {
|
||||||
if (tri_id < 0 || tri_id >= int(m_object_vertices.size())) {
|
if (tri_id < 0 || tri_id >= int(m_object_vertices.size())) {
|
||||||
this->stop("Malformed triangle mesh");
|
this->stop("Malformed triangle mesh");
|
||||||
|
@ -1456,7 +1456,7 @@ void GCodeProcessor::apply_config_simplify3d(const std::string& filename)
|
|||||||
|
|
||||||
begin = skip_whitespaces(begin, end);
|
begin = skip_whitespaces(begin, end);
|
||||||
end = remove_eols(begin, end);
|
end = remove_eols(begin, end);
|
||||||
if (begin != end)
|
if (begin != end) {
|
||||||
if (*begin == ';') {
|
if (*begin == ';') {
|
||||||
// Comment.
|
// Comment.
|
||||||
begin = skip_whitespaces(++ begin, end);
|
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.
|
// Some non-empty G-code line detected, stop parsing config comments.
|
||||||
reader.quit_parsing();
|
reader.quit_parsing();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_result.extruders_count == 0)
|
if (m_result.extruders_count == 0)
|
||||||
|
@ -1300,7 +1300,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
|||||||
num_extruders,
|
num_extruders,
|
||||||
painting_extruders,
|
painting_extruders,
|
||||||
*print_object_regions,
|
*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)
|
for (auto it = it_print_object; it != it_print_object_end; ++it)
|
||||||
if ((*it)->m_shared_regions != nullptr)
|
if ((*it)->m_shared_regions != nullptr)
|
||||||
update_apply_status((*it)->invalidate_state_by_config_options(old_config, new_config, diff_keys));
|
update_apply_status((*it)->invalidate_state_by_config_options(old_config, new_config, diff_keys));
|
||||||
|
@ -465,7 +465,7 @@ TriangleMesh TriangleMesh::convex_hull_3d() const
|
|||||||
std::vector<int> map_dst_vertices;
|
std::vector<int> map_dst_vertices;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
Vec3f centroid = Vec3f::Zero();
|
Vec3f centroid = Vec3f::Zero();
|
||||||
for (auto pt : this->its.vertices)
|
for (const stl_vertex& pt : this->its.vertices)
|
||||||
centroid += pt;
|
centroid += pt;
|
||||||
centroid /= float(this->its.vertices.size());
|
centroid /= float(this->its.vertices.size());
|
||||||
#endif // NDEBUG
|
#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);
|
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 vertex[3] = { vertices[face(0)], vertices[face(1)], vertices[face(2)] };
|
||||||
Vec3f normal = (vertex[1] - vertex[0]).cross(vertex[2] - vertex[1]).normalized();
|
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));
|
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;
|
stl_facet f;
|
||||||
f.extra[0] = 0;
|
f.extra[0] = 0;
|
||||||
f.extra[1] = 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[0] = vertices[face(0)];
|
||||||
f.vertex[1] = vertices[face(1)];
|
f.vertex[1] = vertices[face(1)];
|
||||||
f.vertex[2] = vertices[face(2)];
|
f.vertex[2] = vertices[face(2)];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user