mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 23:35:59 +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;
|
||||
if (! path.empty()) {
|
||||
out.reserve(path.size() + Open ? 1 : 0);
|
||||
out.reserve((path.size() + Open) ? 1 : 0);
|
||||
for (const Point &p : path)
|
||||
out.emplace_back(p.x(), p.y(), z);
|
||||
if (Open)
|
||||
@ -75,7 +75,7 @@ inline Points from_zpath(const ZPoints &path)
|
||||
{
|
||||
Points out;
|
||||
if (! path.empty()) {
|
||||
out.reserve(path.size() + Open ? 1 : 0);
|
||||
out.reserve((path.size() + Open) ? 1 : 0);
|
||||
for (const ZPoint &p : path)
|
||||
out.emplace_back(p.x(), p.y());
|
||||
if (Open)
|
||||
|
@ -3051,12 +3051,12 @@ ThickPolylines FillBoundedRectilinear::fill_surface_arachne(const Surface *surfa
|
||||
// Create the infills for each of the regions.
|
||||
ThickPolylines thick_polylines_out;
|
||||
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;
|
||||
}
|
||||
|
||||
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(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;
|
||||
|
||||
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; }
|
||||
|
||||
|
@ -372,7 +372,8 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
||||
size_t axis = (*c >= 'X' && *c <= 'Z') ? (*c - 'X') :
|
||||
(*c == extrusion_axis) ? 3 : (*c == 'F') ? 4 : 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) {
|
||||
// Convert mm/min to mm/sec.
|
||||
new_pos[4] /= 60.f;
|
||||
@ -462,7 +463,8 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
||||
active_speed_modifier = size_t(-1);
|
||||
} else if (boost::starts_with(sline, m_toolchange_prefix)) {
|
||||
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.
|
||||
if (new_extruder < map_extruder_to_per_extruder_adjustment.size()) {
|
||||
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_P = pos_P > 0;
|
||||
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)
|
||||
line.time *= 0.001f;
|
||||
} else
|
||||
@ -786,7 +789,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
new_gcode.append(pos, line_start - pos);
|
||||
if (line->type & CoolingLine::TYPE_SET_TOOL) {
|
||||
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) {
|
||||
m_current_extruder = new_extruder;
|
||||
change_extruder_set_fan();
|
||||
@ -815,7 +819,8 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
if (line->slowdown)
|
||||
new_feedrate = int(floor(60. * line->feedrate + 0.5));
|
||||
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) {
|
||||
// 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.)
|
||||
|
@ -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)
|
||||
// note: this keeps twins, so it inserts twice the number of the valid edges
|
||||
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) {
|
||||
if (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) {
|
||||
// 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.
|
||||
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);
|
||||
std::string &inherits = Preset::inherits(cfg);
|
||||
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;
|
||||
for (auto it = this->data.begin(); it != this->data.end(); ++ it)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2188,11 +2188,9 @@ static void merge_influence_areas(
|
||||
// 1st merge iteration, merge one with each other.
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, num_buckets_initial),
|
||||
[&](const tbb::blocked_range<size_t> &range) {
|
||||
for (size_t idx = range.begin(); idx < range.end(); ++ idx) {
|
||||
const size_t bucket_pair_idx = idx * 2;
|
||||
for (size_t idx = range.begin(); idx < range.end(); ++ idx)
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
|
||||
// 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,
|
||||
SupportGeneratorLayerStorage &layer_storage)
|
||||
{
|
||||
static int irun = 0;
|
||||
|
||||
const SlicingParameters& slicing_params = print_object.slicing_parameters();
|
||||
|
||||
// All SupportElements are put into a layer independent storage to improve parallelization.
|
||||
@ -3420,8 +3416,12 @@ static void draw_branches(
|
||||
// Only one link points to a node above from below.
|
||||
assert(!(++it != map_downwards_old.end() && it->first == &elem));
|
||||
}
|
||||
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);
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
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);
|
||||
}
|
||||
#endif // NDEBUG
|
||||
}
|
||||
for (int32_t parent_idx : elem.parents) {
|
||||
SupportElement &parent = (*layer_above)[parent_idx];
|
||||
@ -3581,19 +3581,22 @@ static void draw_branches(
|
||||
partial_mesh.clear();
|
||||
extrude_branch(path, config, slicing_params, move_bounds, partial_mesh);
|
||||
#if 0
|
||||
char fname[2048];
|
||||
sprintf(fname, "d:\\temp\\meshes\\tree-raw-%d.obj", ++ irun);
|
||||
its_write_obj(partial_mesh, fname);
|
||||
#if 0
|
||||
temp_mesh.clear();
|
||||
cut_mesh(partial_mesh, layer_z(slicing_params, path.back()->state.layer_idx) + EPSILON, nullptr, &temp_mesh, false);
|
||||
sprintf(fname, "d:\\temp\\meshes\\tree-trimmed1-%d.obj", irun);
|
||||
its_write_obj(temp_mesh, fname);
|
||||
partial_mesh.clear();
|
||||
cut_mesh(temp_mesh, layer_z(slicing_params, path.front()->state.layer_idx) - EPSILON, &partial_mesh, nullptr, false);
|
||||
sprintf(fname, "d:\\temp\\meshes\\tree-trimmed2-%d.obj", irun);
|
||||
#endif
|
||||
its_write_obj(partial_mesh, fname);
|
||||
{
|
||||
char fname[2048];
|
||||
static int irun = 0;
|
||||
sprintf(fname, "d:\\temp\\meshes\\tree-raw-%d.obj", ++ irun);
|
||||
its_write_obj(partial_mesh, fname);
|
||||
#if 0
|
||||
temp_mesh.clear();
|
||||
cut_mesh(partial_mesh, layer_z(slicing_params, path.back()->state.layer_idx) + EPSILON, nullptr, &temp_mesh, false);
|
||||
sprintf(fname, "d:\\temp\\meshes\\tree-trimmed1-%d.obj", irun);
|
||||
its_write_obj(temp_mesh, fname);
|
||||
partial_mesh.clear();
|
||||
cut_mesh(temp_mesh, layer_z(slicing_params, path.front()->state.layer_idx) - EPSILON, &partial_mesh, nullptr, false);
|
||||
sprintf(fname, "d:\\temp\\meshes\\tree-trimmed2-%d.obj", irun);
|
||||
#endif
|
||||
its_write_obj(partial_mesh, fname);
|
||||
}
|
||||
#endif
|
||||
its_merge(cummulative_mesh, partial_mesh);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user