mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 23:06:13 +08:00
Fixed some compiler warnings
This commit is contained in:
parent
f5662458a2
commit
479a39ce0e
@ -28,7 +28,7 @@ inline ZPath to_zpath(const Points &path, coord_t z)
|
|||||||
{
|
{
|
||||||
ZPath out;
|
ZPath out;
|
||||||
if (! path.empty()) {
|
if (! path.empty()) {
|
||||||
out.reserve(path.size() + Open ? 1 : 0);
|
out.reserve((path.size() + Open) ? 1 : 0);
|
||||||
for (const Point &p : path)
|
for (const Point &p : path)
|
||||||
out.emplace_back(p.x(), p.y(), z);
|
out.emplace_back(p.x(), p.y(), z);
|
||||||
if (Open)
|
if (Open)
|
||||||
@ -75,7 +75,7 @@ inline Points from_zpath(const ZPoints &path)
|
|||||||
{
|
{
|
||||||
Points out;
|
Points out;
|
||||||
if (! path.empty()) {
|
if (! path.empty()) {
|
||||||
out.reserve(path.size() + Open ? 1 : 0);
|
out.reserve((path.size() + Open) ? 1 : 0);
|
||||||
for (const ZPoint &p : path)
|
for (const ZPoint &p : path)
|
||||||
out.emplace_back(p.x(), p.y());
|
out.emplace_back(p.x(), p.y());
|
||||||
if (Open)
|
if (Open)
|
||||||
|
@ -3051,12 +3051,12 @@ ThickPolylines FillBoundedRectilinear::fill_surface_arachne(const Surface *surfa
|
|||||||
// Create the infills for each of the regions.
|
// Create the infills for each of the regions.
|
||||||
ThickPolylines thick_polylines_out;
|
ThickPolylines thick_polylines_out;
|
||||||
for (ExPolygon &ex_poly : expp)
|
for (ExPolygon &ex_poly : expp)
|
||||||
_fill_surface_single(Surface(*surface, std::move(ex_poly)), params, thick_polylines_out);
|
fill_surface_single_arachne(Surface(*surface, std::move(ex_poly)), params, thick_polylines_out);
|
||||||
|
|
||||||
return thick_polylines_out;
|
return thick_polylines_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillBoundedRectilinear::_fill_surface_single(const Surface &surface, const FillParams ¶ms, ThickPolylines &thick_polylines_out)
|
void FillBoundedRectilinear::fill_surface_single_arachne(const Surface &surface, const FillParams ¶ms, ThickPolylines &thick_polylines_out)
|
||||||
{
|
{
|
||||||
assert(params.use_arachne);
|
assert(params.use_arachne);
|
||||||
assert(this->print_config != nullptr && this->print_object_config != nullptr && this->print_region_config != nullptr);
|
assert(this->print_config != nullptr && this->print_object_config != nullptr && this->print_region_config != nullptr);
|
||||||
|
@ -119,7 +119,7 @@ public:
|
|||||||
ThickPolylines fill_surface_arachne(const Surface *surface, const FillParams ¶ms) override;
|
ThickPolylines fill_surface_arachne(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _fill_surface_single(const Surface &surface, const FillParams ¶ms, ThickPolylines &thick_polylines_out);
|
void fill_surface_single_arachne(const Surface &surface, const FillParams ¶ms, ThickPolylines &thick_polylines_out);
|
||||||
|
|
||||||
bool no_sort() const override { return true; }
|
bool no_sort() const override { return true; }
|
||||||
|
|
||||||
|
@ -372,7 +372,8 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
|||||||
size_t axis = (*c >= 'X' && *c <= 'Z') ? (*c - 'X') :
|
size_t axis = (*c >= 'X' && *c <= 'Z') ? (*c - 'X') :
|
||||||
(*c == extrusion_axis) ? 3 : (*c == 'F') ? 4 : size_t(-1);
|
(*c == extrusion_axis) ? 3 : (*c == 'F') ? 4 : size_t(-1);
|
||||||
if (axis != size_t(-1)) {
|
if (axis != size_t(-1)) {
|
||||||
auto [pend, ec] = fast_float::from_chars(&*(++ c), sline.data() + sline.size(), new_pos[axis]);
|
//auto [pend, ec] =
|
||||||
|
fast_float::from_chars(&*(++ c), sline.data() + sline.size(), new_pos[axis]);
|
||||||
if (axis == 4) {
|
if (axis == 4) {
|
||||||
// Convert mm/min to mm/sec.
|
// Convert mm/min to mm/sec.
|
||||||
new_pos[4] /= 60.f;
|
new_pos[4] /= 60.f;
|
||||||
@ -462,7 +463,8 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
|||||||
active_speed_modifier = size_t(-1);
|
active_speed_modifier = size_t(-1);
|
||||||
} else if (boost::starts_with(sline, m_toolchange_prefix)) {
|
} else if (boost::starts_with(sline, m_toolchange_prefix)) {
|
||||||
unsigned int new_extruder;
|
unsigned int new_extruder;
|
||||||
auto res = std::from_chars(sline.data() + m_toolchange_prefix.size(), sline.data() + sline.size(), new_extruder);
|
//auto res =
|
||||||
|
std::from_chars(sline.data() + m_toolchange_prefix.size(), sline.data() + sline.size(), new_extruder);
|
||||||
// Only change extruder in case the number is meaningful. User could provide an out-of-range index through custom gcodes - those shall be ignored.
|
// Only change extruder in case the number is meaningful. User could provide an out-of-range index through custom gcodes - those shall be ignored.
|
||||||
if (new_extruder < map_extruder_to_per_extruder_adjustment.size()) {
|
if (new_extruder < map_extruder_to_per_extruder_adjustment.size()) {
|
||||||
if (new_extruder != current_extruder) {
|
if (new_extruder != current_extruder) {
|
||||||
@ -490,7 +492,8 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
|||||||
bool has_S = pos_S > 0;
|
bool has_S = pos_S > 0;
|
||||||
bool has_P = pos_P > 0;
|
bool has_P = pos_P > 0;
|
||||||
if (has_S || has_P) {
|
if (has_S || has_P) {
|
||||||
auto [pend, ec] = fast_float::from_chars(sline.data() + (has_S ? pos_S : pos_P) + 1, sline.data() + sline.size(), line.time);
|
//auto [pend, ec] =
|
||||||
|
fast_float::from_chars(sline.data() + (has_S ? pos_S : pos_P) + 1, sline.data() + sline.size(), line.time);
|
||||||
if (has_P)
|
if (has_P)
|
||||||
line.time *= 0.001f;
|
line.time *= 0.001f;
|
||||||
} else
|
} else
|
||||||
@ -786,7 +789,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
|||||||
new_gcode.append(pos, line_start - pos);
|
new_gcode.append(pos, line_start - pos);
|
||||||
if (line->type & CoolingLine::TYPE_SET_TOOL) {
|
if (line->type & CoolingLine::TYPE_SET_TOOL) {
|
||||||
unsigned int new_extruder;
|
unsigned int new_extruder;
|
||||||
auto res = std::from_chars(line_start + m_toolchange_prefix.size(), line_end, new_extruder);
|
//auto res =
|
||||||
|
std::from_chars(line_start + m_toolchange_prefix.size(), line_end, new_extruder);
|
||||||
if (new_extruder != m_current_extruder) {
|
if (new_extruder != m_current_extruder) {
|
||||||
m_current_extruder = new_extruder;
|
m_current_extruder = new_extruder;
|
||||||
change_extruder_set_fan();
|
change_extruder_set_fan();
|
||||||
@ -815,7 +819,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
|||||||
if (line->slowdown)
|
if (line->slowdown)
|
||||||
new_feedrate = int(floor(60. * line->feedrate + 0.5));
|
new_feedrate = int(floor(60. * line->feedrate + 0.5));
|
||||||
else
|
else
|
||||||
auto res = std::from_chars(fpos, line_end, new_feedrate);
|
//auto res =
|
||||||
|
std::from_chars(fpos, line_end, new_feedrate);
|
||||||
if (new_feedrate == current_feedrate) {
|
if (new_feedrate == current_feedrate) {
|
||||||
// No need to change the F value.
|
// No need to change the F value.
|
||||||
if ((line->type & (CoolingLine::TYPE_ADJUSTABLE | CoolingLine::TYPE_ADJUSTABLE_EMPTY | CoolingLine::TYPE_EXTERNAL_PERIMETER | CoolingLine::TYPE_WIPE)) || line->length == 0.)
|
if ((line->type & (CoolingLine::TYPE_ADJUSTABLE | CoolingLine::TYPE_ADJUSTABLE_EMPTY | CoolingLine::TYPE_EXTERNAL_PERIMETER | CoolingLine::TYPE_WIPE)) || line->length == 0.)
|
||||||
|
@ -468,9 +468,6 @@ void MedialAxis::build(ThickPolylines* polylines)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//typedef const VD::vertex_type vert_t;
|
|
||||||
using edge_t = const VD::edge_type;
|
|
||||||
|
|
||||||
// collect valid edges (i.e. prune those not belonging to MAT)
|
// collect valid edges (i.e. prune those not belonging to MAT)
|
||||||
// note: this keeps twins, so it inserts twice the number of the valid edges
|
// note: this keeps twins, so it inserts twice the number of the valid edges
|
||||||
m_edge_data.assign(m_vd.edges().size() / 2, EdgeData{});
|
m_edge_data.assign(m_vd.edges().size() / 2, EdgeData{});
|
||||||
|
@ -253,7 +253,7 @@ Surfaces expand_bridges_detect_orientations(
|
|||||||
for (; it_bridge_anchor != bridge_anchors.end() && it_bridge_anchor->src == bridge_id; ++ it_bridge_anchor) {
|
for (; it_bridge_anchor != bridge_anchors.end() && it_bridge_anchor->src == bridge_id; ++ it_bridge_anchor) {
|
||||||
if (last_anchor_id != int(it_bridge_anchor->boundary)) {
|
if (last_anchor_id != int(it_bridge_anchor->boundary)) {
|
||||||
last_anchor_id = int(it_bridge_anchor->boundary);
|
last_anchor_id = int(it_bridge_anchor->boundary);
|
||||||
append(anchor_areas, std::move(to_polygons(shells[last_anchor_id])));
|
append(anchor_areas, to_polygons(shells[last_anchor_id]));
|
||||||
}
|
}
|
||||||
// if (Points &polyline = it_bridge_anchor->path; polyline.size() >= 2) {
|
// if (Points &polyline = it_bridge_anchor->path; polyline.size() >= 2) {
|
||||||
// reserve_more_power_of_2(lines, polyline.size() - 1);
|
// reserve_more_power_of_2(lines, polyline.size() - 1);
|
||||||
|
@ -749,7 +749,7 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
|||||||
{
|
{
|
||||||
// Load the preset over a default preset, so that the missing fields are filled in from the default preset.
|
// Load the preset over a default preset, so that the missing fields are filled in from the default preset.
|
||||||
DynamicPrintConfig cfg(this->default_preset_for(combined_config).config);
|
DynamicPrintConfig cfg(this->default_preset_for(combined_config).config);
|
||||||
t_config_option_keys keys = std::move(cfg.keys());
|
t_config_option_keys keys = cfg.keys();
|
||||||
cfg.apply_only(combined_config, keys, true);
|
cfg.apply_only(combined_config, keys, true);
|
||||||
std::string &inherits = Preset::inherits(cfg);
|
std::string &inherits = Preset::inherits(cfg);
|
||||||
if (select == LoadAndSelect::Never) {
|
if (select == LoadAndSelect::Never) {
|
||||||
|
@ -825,7 +825,7 @@ std::vector<std::pair<TreeModelVolumes::RadiusLayerPair, std::reference_wrapper<
|
|||||||
std::vector<std::pair<RadiusLayerPair, std::reference_wrapper<const Polygons>>> out;
|
std::vector<std::pair<RadiusLayerPair, std::reference_wrapper<const Polygons>>> out;
|
||||||
for (auto it = this->data.begin(); it != this->data.end(); ++ it)
|
for (auto it = this->data.begin(); it != this->data.end(); ++ it)
|
||||||
out.emplace_back(it->first, it->second);
|
out.emplace_back(it->first, it->second);
|
||||||
std::sort(out.begin(), out.end(), [](auto &l, auto &r){ return l.first.second < r.first.second || (l.first.second == r.first.second) && l.first.first < r.first.first; });
|
std::sort(out.begin(), out.end(), [](auto &l, auto &r){ return l.first.second < r.first.second || (l.first.second == r.first.second && l.first.first < r.first.first); });
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2188,11 +2188,9 @@ static void merge_influence_areas(
|
|||||||
// 1st merge iteration, merge one with each other.
|
// 1st merge iteration, merge one with each other.
|
||||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, num_buckets_initial),
|
tbb::parallel_for(tbb::blocked_range<size_t>(0, num_buckets_initial),
|
||||||
[&](const tbb::blocked_range<size_t> &range) {
|
[&](const tbb::blocked_range<size_t> &range) {
|
||||||
for (size_t idx = range.begin(); idx < range.end(); ++ idx) {
|
for (size_t idx = range.begin(); idx < range.end(); ++ idx)
|
||||||
const size_t bucket_pair_idx = idx * 2;
|
|
||||||
// Merge bucket_count adjacent to each other, merging uneven bucket numbers into even buckets
|
// Merge bucket_count adjacent to each other, merging uneven bucket numbers into even buckets
|
||||||
buckets[idx].second = merge_influence_areas_leaves(volumes, config, layer_idx, buckets[idx].first, buckets[idx].second);
|
buckets[idx].second = merge_influence_areas_leaves(volumes, config, layer_idx, buckets[idx].first, buckets[idx].second);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Further merge iterations, merging one AABB subtree with another one, hopefully minimizing intersections between the elements
|
// Further merge iterations, merging one AABB subtree with another one, hopefully minimizing intersections between the elements
|
||||||
@ -3394,8 +3392,6 @@ static void draw_branches(
|
|||||||
SupportGeneratorLayersPtr &intermediate_layers,
|
SupportGeneratorLayersPtr &intermediate_layers,
|
||||||
SupportGeneratorLayerStorage &layer_storage)
|
SupportGeneratorLayerStorage &layer_storage)
|
||||||
{
|
{
|
||||||
static int irun = 0;
|
|
||||||
|
|
||||||
const SlicingParameters& slicing_params = print_object.slicing_parameters();
|
const SlicingParameters& slicing_params = print_object.slicing_parameters();
|
||||||
|
|
||||||
// All SupportElements are put into a layer independent storage to improve parallelization.
|
// All SupportElements are put into a layer independent storage to improve parallelization.
|
||||||
@ -3420,9 +3416,13 @@ static void draw_branches(
|
|||||||
// Only one link points to a node above from below.
|
// Only one link points to a node above from below.
|
||||||
assert(!(++it != map_downwards_old.end() && it->first == &elem));
|
assert(!(++it != map_downwards_old.end() && it->first == &elem));
|
||||||
}
|
}
|
||||||
|
#ifndef NDEBUG
|
||||||
|
{
|
||||||
const SupportElement *pchild = child == -1 ? nullptr : &move_bounds[layer_idx - 1][child];
|
const SupportElement *pchild = child == -1 ? nullptr : &move_bounds[layer_idx - 1][child];
|
||||||
assert(pchild ? pchild->state.result_on_layer_is_set() : elem.state.target_height > layer_idx);
|
assert(pchild ? pchild->state.result_on_layer_is_set() : elem.state.target_height > layer_idx);
|
||||||
}
|
}
|
||||||
|
#endif // NDEBUG
|
||||||
|
}
|
||||||
for (int32_t parent_idx : elem.parents) {
|
for (int32_t parent_idx : elem.parents) {
|
||||||
SupportElement &parent = (*layer_above)[parent_idx];
|
SupportElement &parent = (*layer_above)[parent_idx];
|
||||||
if (parent.state.result_on_layer_is_set())
|
if (parent.state.result_on_layer_is_set())
|
||||||
@ -3581,7 +3581,9 @@ static void draw_branches(
|
|||||||
partial_mesh.clear();
|
partial_mesh.clear();
|
||||||
extrude_branch(path, config, slicing_params, move_bounds, partial_mesh);
|
extrude_branch(path, config, slicing_params, move_bounds, partial_mesh);
|
||||||
#if 0
|
#if 0
|
||||||
|
{
|
||||||
char fname[2048];
|
char fname[2048];
|
||||||
|
static int irun = 0;
|
||||||
sprintf(fname, "d:\\temp\\meshes\\tree-raw-%d.obj", ++ irun);
|
sprintf(fname, "d:\\temp\\meshes\\tree-raw-%d.obj", ++ irun);
|
||||||
its_write_obj(partial_mesh, fname);
|
its_write_obj(partial_mesh, fname);
|
||||||
#if 0
|
#if 0
|
||||||
@ -3594,6 +3596,7 @@ static void draw_branches(
|
|||||||
sprintf(fname, "d:\\temp\\meshes\\tree-trimmed2-%d.obj", irun);
|
sprintf(fname, "d:\\temp\\meshes\\tree-trimmed2-%d.obj", irun);
|
||||||
#endif
|
#endif
|
||||||
its_write_obj(partial_mesh, fname);
|
its_write_obj(partial_mesh, fname);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
its_merge(cummulative_mesh, partial_mesh);
|
its_merge(cummulative_mesh, partial_mesh);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user