Fixing GCC warnings 1

This commit is contained in:
Lukas Matena 2021-01-11 10:23:56 +01:00
parent a2a0a86138
commit b5280fbed9
9 changed files with 107 additions and 129 deletions

View file

@ -1483,8 +1483,8 @@ bool EdgeGrid::Grid::has_intersecting_edges() const
void EdgeGrid::save_png(const EdgeGrid::Grid &grid, const BoundingBox &bbox, coord_t resolution, const char *path, size_t scale)
{
unsigned int w = (bbox.max(0) - bbox.min(0) + resolution - 1) / resolution;
unsigned int h = (bbox.max(1) - bbox.min(1) + resolution - 1) / resolution;
coord_t w = (bbox.max(0) - bbox.min(0) + resolution - 1) / resolution;
coord_t h = (bbox.max(1) - bbox.min(1) + resolution - 1) / resolution;
std::vector<uint8_t> pixels(w * h * 3, 0);

View file

@ -88,10 +88,10 @@ public:
assert(m_bbox.contains(p2));
p1 -= m_bbox.min;
p2 -= m_bbox.min;
assert(p1.x() >= 0 && p1.x() < m_cols * m_resolution);
assert(p1.y() >= 0 && p1.y() < m_rows * m_resolution);
assert(p2.x() >= 0 && p2.x() < m_cols * m_resolution);
assert(p2.y() >= 0 && p2.y() < m_rows * m_resolution);
assert(p1.x() >= 0 && size_t(p1.x()) < m_cols * m_resolution);
assert(p1.y() >= 0 && size_t(p1.y()) < m_rows * m_resolution);
assert(p2.x() >= 0 && size_t(p2.x()) < m_cols * m_resolution);
assert(p2.y() >= 0 && size_t(p2.y()) < m_rows * m_resolution);
// Get the cells of the end points.
coord_t ix = p1(0) / m_resolution;
coord_t iy = p1(1) / m_resolution;
@ -245,12 +245,10 @@ public:
return;
}
std::pair<std::vector<std::pair<size_t, size_t>>::const_iterator, std::vector<std::pair<size_t, size_t>>::const_iterator> cell_data_range(coord_t row, coord_t col) const
std::pair<std::vector<std::pair<size_t, size_t>>::const_iterator, std::vector<std::pair<size_t, size_t>>::const_iterator> cell_data_range(coord_t row, coord_t col) const
{
assert(row >= 0);
assert(row < m_rows);
assert(col >= 0);
assert(col < m_cols);
assert(row >= 0 && size_t(row) < m_rows);
assert(col >= 0 && size_t(col) < m_cols);
const EdgeGrid::Grid::Cell &cell = m_cells[row * m_cols + col];
return std::make_pair(m_cell_data.begin() + cell.begin, m_cell_data.begin() + cell.end);
}

View file

@ -160,66 +160,66 @@ bool triangle_AABB_intersects(const Vector &a, const Vector &b, const Vector &c,
return true;
}
static double dist2_to_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, const Vec3d &p)
{
double out = std::numeric_limits<double>::max();
const Vec3d v1 = b - a;
auto l1 = v1.squaredNorm();
const Vec3d v2 = c - b;
auto l2 = v2.squaredNorm();
const Vec3d v3 = a - c;
auto l3 = v3.squaredNorm();
// static double dist2_to_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, const Vec3d &p)
// {
// double out = std::numeric_limits<double>::max();
// const Vec3d v1 = b - a;
// auto l1 = v1.squaredNorm();
// const Vec3d v2 = c - b;
// auto l2 = v2.squaredNorm();
// const Vec3d v3 = a - c;
// auto l3 = v3.squaredNorm();
// Is the triangle valid?
if (l1 > 0. && l2 > 0. && l3 > 0.)
{
// 1) Project point into the plane of the triangle.
const Vec3d n = v1.cross(v2);
double d = (p - a).dot(n);
const Vec3d foot_pt = p - n * d / n.squaredNorm();
// // Is the triangle valid?
// if (l1 > 0. && l2 > 0. && l3 > 0.)
// {
// // 1) Project point into the plane of the triangle.
// const Vec3d n = v1.cross(v2);
// double d = (p - a).dot(n);
// const Vec3d foot_pt = p - n * d / n.squaredNorm();
// 2) Maximum projection of n.
int proj_axis;
n.array().cwiseAbs().maxCoeff(&proj_axis);
// // 2) Maximum projection of n.
// int proj_axis;
// n.array().cwiseAbs().maxCoeff(&proj_axis);
// 3) Test whether the foot_pt is inside the triangle.
{
auto inside_triangle = [](const Vec2d& v1, const Vec2d& v2, const Vec2d& v3, const Vec2d& pt) {
const double d1 = cross2(v1, pt);
const double d2 = cross2(v2, pt);
const double d3 = cross2(v3, pt);
// Testing both CCW and CW orientations.
return (d1 >= 0. && d2 >= 0. && d3 >= 0.) || (d1 <= 0. && d2 <= 0. && d3 <= 0.);
};
bool inside;
switch (proj_axis) {
case 0:
inside = inside_triangle({v1.y(), v1.z()}, {v2.y(), v2.z()}, {v3.y(), v3.z()}, {foot_pt.y(), foot_pt.z()}); break;
case 1:
inside = inside_triangle({v1.z(), v1.x()}, {v2.z(), v2.x()}, {v3.z(), v3.x()}, {foot_pt.z(), foot_pt.x()}); break;
default:
assert(proj_axis == 2);
inside = inside_triangle({v1.x(), v1.y()}, {v2.x(), v2.y()}, {v3.x(), v3.y()}, {foot_pt.x(), foot_pt.y()}); break;
}
if (inside)
return (p - foot_pt).squaredNorm();
}
// // 3) Test whether the foot_pt is inside the triangle.
// {
// auto inside_triangle = [](const Vec2d& v1, const Vec2d& v2, const Vec2d& v3, const Vec2d& pt) {
// const double d1 = cross2(v1, pt);
// const double d2 = cross2(v2, pt);
// const double d3 = cross2(v3, pt);
// // Testing both CCW and CW orientations.
// return (d1 >= 0. && d2 >= 0. && d3 >= 0.) || (d1 <= 0. && d2 <= 0. && d3 <= 0.);
// };
// bool inside;
// switch (proj_axis) {
// case 0:
// inside = inside_triangle({v1.y(), v1.z()}, {v2.y(), v2.z()}, {v3.y(), v3.z()}, {foot_pt.y(), foot_pt.z()}); break;
// case 1:
// inside = inside_triangle({v1.z(), v1.x()}, {v2.z(), v2.x()}, {v3.z(), v3.x()}, {foot_pt.z(), foot_pt.x()}); break;
// default:
// assert(proj_axis == 2);
// inside = inside_triangle({v1.x(), v1.y()}, {v2.x(), v2.y()}, {v3.x(), v3.y()}, {foot_pt.x(), foot_pt.y()}); break;
// }
// if (inside)
// return (p - foot_pt).squaredNorm();
// }
// 4) Find minimum distance to triangle vertices and edges.
out = std::min((p - a).squaredNorm(), std::min((p - b).squaredNorm(), (p - c).squaredNorm()));
auto t = (p - a).dot(v1);
if (t > 0. && t < l1)
out = std::min(out, (a + v1 * (t / l1) - p).squaredNorm());
t = (p - b).dot(v2);
if (t > 0. && t < l2)
out = std::min(out, (b + v2 * (t / l2) - p).squaredNorm());
t = (p - c).dot(v3);
if (t > 0. && t < l3)
out = std::min(out, (c + v3 * (t / l3) - p).squaredNorm());
}
// // 4) Find minimum distance to triangle vertices and edges.
// out = std::min((p - a).squaredNorm(), std::min((p - b).squaredNorm(), (p - c).squaredNorm()));
// auto t = (p - a).dot(v1);
// if (t > 0. && t < l1)
// out = std::min(out, (a + v1 * (t / l1) - p).squaredNorm());
// t = (p - b).dot(v2);
// if (t > 0. && t < l2)
// out = std::min(out, (b + v2 * (t / l2) - p).squaredNorm());
// t = (p - c).dot(v3);
// if (t > 0. && t < l3)
// out = std::min(out, (c + v3 * (t / l3) - p).squaredNorm());
// }
return out;
}
// return out;
// }
// Ordering of children cubes.
static const std::array<Vec3d, 8> child_centers {
@ -690,7 +690,8 @@ static void add_hook(
// Trim the hook start by the infill line it will connect to.
Point hook_start;
bool intersection_found = intersection.intersect_line->intersection(
[[maybe_unused]] bool intersection_found = intersection.intersect_line->intersection(
create_offset_line(*intersection.closest_line, intersection, scaled_offset),
&hook_start);
assert(intersection_found);
@ -703,7 +704,7 @@ static void add_hook(
Vector hook_vector = ((hook_length + 1.16 * scaled_trim_distance) * hook_vector_norm).cast<coord_t>();
Line hook_forward(hook_start, hook_start + hook_vector);
auto filter_itself = [&intersection, &lines_src](const auto &item) { return item.second != intersection.intersect_line - lines_src.data(); };
auto filter_itself = [&intersection, &lines_src](const auto &item) { return item.second != (long unsigned int)(intersection.intersect_line - lines_src.data()); };
std::vector<std::pair<rtree_segment_t, size_t>> hook_intersections;
rtree.query(bgi::intersects(mk_rtree_seg(hook_forward)) && bgi::satisfies(filter_itself), std::back_inserter(hook_intersections));
@ -1178,7 +1179,8 @@ static Polylines connect_lines_using_hooks(Polylines &&lines, const ExPolygon &b
rtree.query(
bgi::intersects(mk_rtree_seg(first_i_point, nearest_i_point)) &&
bgi::satisfies([&first_i, &nearest_i, &lines_src](const auto &item)
{ return item.second != first_i.intersect_line - lines_src.data() && item.second != nearest_i.intersect_line - lines_src.data(); }),
{ return item.second != (long unsigned int)(first_i.intersect_line - lines_src.data())
&& item.second != (long unsigned int)(nearest_i.intersect_line - lines_src.data()); }),
std::back_inserter(closest));
could_connect = closest.empty();
#if 0
@ -1252,7 +1254,7 @@ static Polylines connect_lines_using_hooks(Polylines &&lines, const ExPolygon &b
}
#ifdef ADAPTIVE_CUBIC_INFILL_DEBUG_OUTPUT
++ iStep;
#endif ADAPTIVE_CUBIC_INFILL_DEBUG_OUTPUT
#endif // ADAPTIVE_CUBIC_INFILL_DEBUG_OUTPUT
first_i.used = true;
}
}
@ -1410,15 +1412,15 @@ void Filler::_fill_surface_single(
#endif /* ADAPTIVE_CUBIC_INFILL_DEBUG_OUTPUT */
}
static double bbox_max_radius(const BoundingBoxf3 &bbox, const Vec3d &center)
{
const auto p = (bbox.min - center);
const auto s = bbox.size();
double r2max = 0.;
for (int i = 0; i < 8; ++ i)
r2max = std::max(r2max, (p + Vec3d(s.x() * double(i & 1), s.y() * double(i & 2), s.z() * double(i & 4))).squaredNorm());
return sqrt(r2max);
}
//static double bbox_max_radius(const BoundingBoxf3 &bbox, const Vec3d &center)
//{
// const auto p = (bbox.min - center);
// const auto s = bbox.size();
// double r2max = 0.;
// for (int i = 0; i < 8; ++ i)
// r2max = std::max(r2max, (p + Vec3d(s.x() * double(i & 1), s.y() * double(i & 2), s.z() * double(i & 4))).squaredNorm());
// return sqrt(r2max);
//}
static std::vector<CubeProperties> make_cubes_properties(double max_cube_edge_length, double line_spacing)
{
@ -1513,8 +1515,10 @@ void Octree::insert_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, Cub
assert(current_cube);
assert(depth > 0);
--depth;
// Squared radius of a sphere around the child cube.
const double r2_cube = Slic3r::sqr(0.5 * this->cubes_properties[-- depth].height + EPSILON);
// const double r2_cube = Slic3r::sqr(0.5 * this->cubes_properties[depth].height + EPSILON);
for (size_t i = 0; i < 8; ++ i) {
const Vec3d &child_center_dir = child_centers[i];
@ -1532,6 +1536,7 @@ void Octree::insert_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, Cub
}
Vec3d child_center = current_cube->center + (child_center_dir * (this->cubes_properties[depth].edge_length / 2.));
//if (dist2_to_triangle(a, b, c, child_center) < r2_cube) {
// dist2_to_triangle and r2_cube are commented out too.
if (triangle_AABB_intersects(a, b, c, bbox)) {
if (! current_cube->children[i])
current_cube->children[i] = this->pool.construct(child_center);

View file

@ -59,7 +59,7 @@ public:
~Filler() override {}
protected:
Fill* clone() const override { return new Filler(*this); };
Fill* clone() const override { return new Filler(*this); }
void _fill_surface_single(
const FillParams &params,
unsigned int thickness_layers,
@ -73,7 +73,7 @@ protected:
bool no_sort() const override { return false; }
};
}; // namespace FillAdaptive
} // namespace FillAdaptive
} // namespace Slic3r
#endif // slic3r_FillAdaptive_hpp_

View file

@ -1170,15 +1170,15 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector<const Po
// Add these points to the destination contour.
const Polyline &infill_line = infill_ordered[it->second / 2];
const Point &pt = (it->second & 1) ? infill_line.points.back() : infill_line.points.front();
#ifndef NDEBUG
{
const Vec2d pt1 = ipt.cast<double>();
const Vec2d pt2 = (idx_point + 1 == contour_src.size() ? contour_src.points.front() : contour_src.points[idx_point + 1]).cast<double>();
const Vec2d ptx = lerp(pt1, pt2, it->first.t);
assert(std::abs(pt.x() - pt.x()) < SCALED_EPSILON);
assert(std::abs(pt.y() - pt.y()) < SCALED_EPSILON);
}
#endif // NDEBUG
//#ifndef NDEBUG
// {
// const Vec2d pt1 = ipt.cast<double>();
// const Vec2d pt2 = (idx_point + 1 == contour_src.size() ? contour_src.points.front() : contour_src.points[idx_point + 1]).cast<double>();
// const Vec2d ptx = lerp(pt1, pt2, it->first.t);
// assert(std::abs(ptx.x() - pt.x()) < SCALED_EPSILON);
// assert(std::abs(ptx.y() - pt.y()) < SCALED_EPSILON);
// }
//#endif // NDEBUG
size_t idx_tjoint_pt = 0;
if (idx_point + 1 < contour_src.size() || pt != contour_dst.front()) {
if (pt != contour_dst.back())
@ -1261,8 +1261,6 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector<const Po
std::vector<ConnectionCost> connections_sorted;
connections_sorted.reserve(infill_ordered.size() * 2 - 2);
for (size_t idx_chain = 1; idx_chain < infill_ordered.size(); ++ idx_chain) {
const Polyline &pl1 = infill_ordered[idx_chain - 1];
const Polyline &pl2 = infill_ordered[idx_chain];
const ContourIntersectionPoint *cp1 = &map_infill_end_point_to_boundary[(idx_chain - 1) * 2 + 1];
const ContourIntersectionPoint *cp2 = &map_infill_end_point_to_boundary[idx_chain * 2];
if (cp1->contour_idx != boundary_idx_unconnected && cp1->contour_idx == cp2->contour_idx) {
@ -1396,7 +1394,6 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector<const Po
if (! contour_point.consumed && contour_point.contour_idx != boundary_idx_unconnected) {
const Points &contour = boundary[contour_point.contour_idx];
const std::vector<double> &contour_params = boundary_params[contour_point.contour_idx];
const size_t contour_pt_idx = contour_point.point_idx;
double lprev = contour_point.could_connect_prev() ?
path_length_along_contour_ccw(contour_point.prev_on_contour, &contour_point, contour_params.back()) :

View file

@ -515,8 +515,7 @@ static inline bool intersection_on_prev_next_vertical_line_valid(
const SegmentedIntersectionLine &vline_other = segs[side == SegmentIntersection::Side::Right ? (iVerticalLine + 1) : (iVerticalLine - 1)];
const SegmentIntersection &it_other = vline_other.intersections[iIntersectionOther];
assert(it_other.is_inner());
assert(iIntersectionOther > 0);
assert(iIntersectionOther + 1 < vline_other.intersections.size());
assert(iIntersectionOther > 0 && size_t(iIntersectionOther + 1) < vline_other.intersections.size());
// Is iIntersectionOther at the boundary of a vertical segment?
const SegmentIntersection &it_other2 = vline_other.intersections[it_other.is_low() ? iIntersectionOther - 1 : iIntersectionOther + 1];
if (it_other2.is_inner())
@ -1176,8 +1175,7 @@ static void pinch_contours_insert_phony_outer_intersections(std::vector<Segmente
assert(it->type == SegmentIntersection::OUTER_LOW);
++ it;
} else {
auto lo = it;
assert(lo->type == SegmentIntersection::INNER_LOW);
assert(it->type == SegmentIntersection::INNER_LOW);
auto hi = ++ it;
assert(hi->type == SegmentIntersection::INNER_HIGH);
auto lo2 = ++ it;
@ -1186,11 +1184,11 @@ static void pinch_contours_insert_phony_outer_intersections(std::vector<Segmente
// In that case one shall insert a phony OUTER_HIGH / OUTER_LOW pair.
int up = hi->vertical_up();
int dn = lo2->vertical_down();
#ifndef _NDEBUG
assert(up == -1 || up > 0);
assert(dn == -1 || dn >= 0);
assert((up == -1 && dn == -1) || (dn + 1 == up));
#endif // _NDEBUG
bool pinched = dn + 1 != up;
if (pinched) {
// hi is not connected with its inner contour to lo2.
@ -1267,10 +1265,6 @@ static const SegmentIntersection& end_of_vertical_run_raw(const SegmentIntersect
}
return *it;
}
static SegmentIntersection& end_of_vertical_run_raw(SegmentIntersection &start)
{
return const_cast<SegmentIntersection&>(end_of_vertical_run_raw(std::as_const(start)));
}
// Find the last INNER_HIGH intersection starting with INNER_LOW, that is followed by OUTER_HIGH intersection, traversing vertical up contours if enabled.
// Such intersection shall always exist.
@ -1383,7 +1377,7 @@ static void traverse_graph_generate_polylines(
bool try_connect = false;
if (going_up) {
assert(! it->consumed_vertical_up);
assert(i_intersection + 1 < vline.intersections.size());
assert(size_t(i_intersection + 1) < vline.intersections.size());
// Step back to the beginning of the vertical segment to mark it as consumed.
if (it->is_inner()) {
assert(i_intersection > 0);
@ -1395,7 +1389,7 @@ static void traverse_graph_generate_polylines(
it->consumed_vertical_up = true;
++ it;
++ i_intersection;
assert(i_intersection < vline.intersections.size());
assert(size_t(i_intersection) < vline.intersections.size());
} while (it->type != SegmentIntersection::OUTER_HIGH);
if ((it - 1)->is_inner()) {
// Step back.
@ -1815,7 +1809,7 @@ static std::vector<MonotonicRegion> generate_montonous_regions(std::vector<Segme
return false;
};
#else
auto test_overlap = [](int, int, int) { return false; };
[[maybe_unused]] auto test_overlap = [](int, int, int) { return false; };
#endif
for (int i_vline_seed = 0; i_vline_seed < int(segs.size()); ++ i_vline_seed) {
@ -2033,8 +2027,7 @@ static void connect_monotonic_regions(std::vector<MonotonicRegion> &regions, con
map_intersection_to_region_end.emplace_back(&segs[region.right.vline].intersections[region.right.low], &region);
}
auto intersections_lower = [](const MapType &l, const MapType &r){ return l.first < r.first ; };
auto intersections_equal = [](const MapType &l, const MapType &r){ return l.first == r.first ; };
std::sort(map_intersection_to_region_start.begin(), map_intersection_to_region_start.end(), intersections_lower);
std::sort(map_intersection_to_region_start.begin(), map_intersection_to_region_start.end(), intersections_lower);
std::sort(map_intersection_to_region_end.begin(), map_intersection_to_region_end.end(), intersections_lower);
// Scatter links to neighboring regions.
@ -2193,7 +2186,7 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
};
std::vector<NextCandidate> next_candidates;
auto validate_unprocessed =
[[maybe_unused]]auto validate_unprocessed =
#ifdef NDEBUG
[]() { return true; };
#else
@ -2222,7 +2215,7 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
} else {
// Some left neihgbor should not be processed yet.
assert(left_neighbors_unprocessed[i] > 1);
size_t num_predecessors_unprocessed = 0;
int32_t num_predecessors_unprocessed = 0;
bool has_left_last_on_path = false;
for (const MonotonicRegion* left : region.left_neighbors) {
size_t iprev = left - regions.data();
@ -2290,8 +2283,7 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
NextCandidate next_candidate;
next_candidate.probability = 0;
for (MonotonicRegion *next : region.right_neighbors) {
int &unprocessed = left_neighbors_unprocessed[next - regions.data()];
assert(unprocessed > 1);
assert(left_neighbors_unprocessed[next - regions.data()] > 1);
if (left_neighbors_unprocessed[next - regions.data()] == 2) {
// Dependencies of the successive blocks are satisfied.
AntPath &path1 = path_matrix(region, dir, *next, false);
@ -2844,8 +2836,6 @@ bool FillRectilinear::fill_surface_by_multilines(const Surface *surface, FillPar
coord_t line_spacing = coord_t(scale_(this->spacing) / params.density);
std::pair<float, Point> rotate_vector = this->_infill_direction(surface);
for (const SweepParams &sweep : sweep_params) {
size_t n_fill_lines_initial = fill_lines.size();
// Rotate polygons so that we can work with vertical lines here
double angle = rotate_vector.first + sweep.angle_base;
ExPolygonWithOffset poly_with_offset(poly_with_offset_base, - angle);

View file

@ -50,11 +50,6 @@ const std::string GCodeProcessor::Width_Tag = "WIDTH:";
const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "MM3_PER_MM:";
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
static bool is_valid_extrusion_role(int value)
{
return (static_cast<int>(erNone) <= value) && (value <= static_cast<int>(erMixed));
}
static void set_option_value(ConfigOptionFloats& option, size_t id, float value)
{
if (id < option.values.size())
@ -2343,7 +2338,7 @@ void GCodeProcessor::process_T(const GCodeReader::GCodeLine& line)
void GCodeProcessor::process_T(const std::string_view command)
{
if (command.length() > 1) {
int eid;
int eid = 0;
if (! parse_number(command.substr(1), eid) || eid < 0 || eid > 255) {
// T-1 is a valid gcode line for RepRap Firmwares (used to deselects all tools) see https://github.com/prusa3d/PrusaSlicer/issues/5677
if ((m_flavor != gcfRepRapFirmware && m_flavor != gcfRepRapSprinter) || eid != -1)

View file

@ -59,7 +59,7 @@ void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollec
const PrintRegionConfig &region_config = this->region()->config();
// This needs to be in sync with PrintObject::_slice() slicing_mode_normal_below_layer!
bool spiral_vase = print_config.spiral_vase &&
(this->layer()->id() >= region_config.bottom_solid_layers.value &&
(this->layer()->id() >= size_t(region_config.bottom_solid_layers.value) &&
this->layer()->print_z >= region_config.bottom_solid_min_thickness - EPSILON);
PerimeterGenerator g(

View file

@ -1145,33 +1145,26 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
for (const auto &section : tree) {
PresetCollection *presets = nullptr;
std::vector<std::string> *loaded = nullptr;
std::string preset_name;
PhysicalPrinterCollection *ph_printers = nullptr;
std::string ph_printer_name;
if (boost::starts_with(section.first, "print:")) {
presets = &this->prints;
loaded = &loaded_prints;
preset_name = section.first.substr(6);
} else if (boost::starts_with(section.first, "filament:")) {
presets = &this->filaments;
loaded = &loaded_filaments;
preset_name = section.first.substr(9);
} else if (boost::starts_with(section.first, "sla_print:")) {
presets = &this->sla_prints;
loaded = &loaded_sla_prints;
preset_name = section.first.substr(10);
} else if (boost::starts_with(section.first, "sla_material:")) {
presets = &this->sla_materials;
loaded = &loaded_sla_materials;
preset_name = section.first.substr(13);
} else if (boost::starts_with(section.first, "printer:")) {
presets = &this->printers;
loaded = &loaded_printers;
preset_name = section.first.substr(8);
} else if (boost::starts_with(section.first, "physical_printer:")) {
ph_printers = &this->physical_printers;
loaded = &loaded_physical_printers;
ph_printer_name = section.first.substr(17);
} else if (section.first == "presets") {
// Load the names of the active presets.