Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-07-26 21:55:21 +0300
committersupermerill <merill@free.fr>2022-08-10 23:56:21 +0300
commit5dc49e57665a90b975cd1e8da001eb375db7a745 (patch)
tree5d1d0b9402131591ec16aee25d94878eb2193616 /src
parenta16466ab6ff3c2c9023bc46fdecc7dcef9003811 (diff)
Fix some warnings.
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/AppConfig.cpp2
-rw-r--r--src/libslic3r/Flow.cpp6
-rw-r--r--src/libslic3r/GCode/SeamPlacer.cpp6
-rw-r--r--src/libslic3r/Geometry.hpp10
-rw-r--r--src/libslic3r/PresetBundle.cpp3
-rw-r--r--src/libslic3r/Print.cpp32
-rw-r--r--src/libslic3r/PrintApply.cpp5
-rw-r--r--src/libslic3r/PrintBase.cpp6
-rw-r--r--src/libslic3r/PrintObject.cpp13
-rw-r--r--src/libslic3r/Utils.hpp1
-rw-r--r--src/libslic3r/utils.cpp4
-rw-r--r--src/slic3r/GUI/3DBed.cpp4
-rw-r--r--src/slic3r/GUI/GCodeViewer.cpp4
-rw-r--r--src/slic3r/GUI/PresetComboBoxes.cpp8
14 files changed, 56 insertions, 48 deletions
diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp
index 5ba93c36c..f029b3d72 100644
--- a/src/libslic3r/AppConfig.cpp
+++ b/src/libslic3r/AppConfig.cpp
@@ -562,7 +562,7 @@ void AppConfig::set_defaults()
std::string color_code = tree_colors.get<std::string>(it.first);
if (!color_code.empty()) {
std::string tag = it.first.substr(4);
- color_code = (tag, color_code[0] == '#' ? color_code : ("#" + color_code));
+ color_code = (color_code[0] == '#' ? color_code : ("#" + color_code));
// get/set into ConfigOptionDef
auto it = ConfigOptionDef::names_2_tag_mode.find(tag);
diff --git a/src/libslic3r/Flow.cpp b/src/libslic3r/Flow.cpp
index 15b443481..a84cea003 100644
--- a/src/libslic3r/Flow.cpp
+++ b/src/libslic3r/Flow.cpp
@@ -222,7 +222,7 @@ Flow Flow::new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent
if (height <= 0)
throw Slic3r::InvalidArgument("Invalid flow height supplied to new_from_config_width()");
- float w;
+ float w = 0.f;
if (bridge_flow_ratio > 0) {
// If bridge flow was requested, calculate the bridge width.
height = w = (bridge_flow_ratio == 1.) ?
@@ -379,8 +379,8 @@ float Flow::spacing(const Flow &other) const
float Flow::rounded_rectangle_extrusion_spacing(float width, float height)
{
if (width == height && width == 0)
- return 0;
- auto out = width - height * float(1. - 0.25 * PI);
+ return 0.f;
+ float out = width - height * float(1. - 0.25 * PI);
if (out <= 0.f)
throw FlowErrorNegativeSpacing();
return out;
diff --git a/src/libslic3r/GCode/SeamPlacer.cpp b/src/libslic3r/GCode/SeamPlacer.cpp
index e1fd8badf..12730b84c 100644
--- a/src/libslic3r/GCode/SeamPlacer.cpp
+++ b/src/libslic3r/GCode/SeamPlacer.cpp
@@ -551,9 +551,9 @@ Point SeamPlacer::calculate_seam(const Layer& layer, SeamPosition seam_position,
// Look for all lambda-seam-modifiers below current z, choose the highest one
ModelVolume* v_lambda_seam = nullptr;
Vec3d lambda_pos;
- double lambda_z;
- double lambda_dist;
- double lambda_radius;
+ double lambda_z = 0;
+ double lambda_dist = 0;
+ double lambda_radius = 0;
//get model_instance (like from po->model_object()->instances, but we don't have the index for that array)
const ModelInstance* model_instance = po->instances()[print_object_instance_idx].model_instance;
for (ModelVolume* v : po->model_object()->volumes) {
diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp
index 10ab57624..5dfd81ce4 100644
--- a/src/libslic3r/Geometry.hpp
+++ b/src/libslic3r/Geometry.hpp
@@ -368,14 +368,14 @@ class Transformation
void set(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror);
};
- Vec3d m_offset; // In unscaled coordinates
- Vec3d m_rotation; // Rotation around the three axes, in radians around mesh center point
- Vec3d m_scaling_factor; // Scaling factors along the three axes
- Vec3d m_mirror; // Mirroring along the three axes
+ Vec3d m_offset = { 0,0,0 }; // In unscaled coordinates
+ Vec3d m_rotation = { 0,0,0 }; // Rotation around the three axes, in radians around mesh center point
+ Vec3d m_scaling_factor = { 0,0,0 }; // Scaling factors along the three axes
+ Vec3d m_mirror = { 0,0,0 }; // Mirroring along the three axes
mutable Transform3d m_matrix;
mutable Flags m_flags;
- mutable bool m_dirty;
+ mutable bool m_dirty = false;
public:
Transformation();
diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp
index 3dfc8ee8f..51c66b969 100644
--- a/src/libslic3r/PresetBundle.cpp
+++ b/src/libslic3r/PresetBundle.cpp
@@ -837,8 +837,9 @@ ConfigSubstitutions PresetBundle::load_config_file(const std::string &path, Forw
config.apply(FullPrintConfig::defaults());
config_substitutions = config.load(tree, compatibility_rule);
Preset::normalize(config);
- if (from_prusa)
+ if (from_prusa) {
config.convert_from_prusa();
+ }
load_config_file_config(path, true, std::move(config));
return config_substitutions;
}
diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp
index b2f4ed9bf..c405a61c7 100644
--- a/src/libslic3r/Print.cpp
+++ b/src/libslic3r/Print.cpp
@@ -488,11 +488,13 @@ bool Print::has_brim() const
bool Print::sequential_print_horizontal_clearance_valid(const Print &print, Polygons* polygons)
{
- if (print.config().extruder_clearance_radius == 0)
+ if (print.config().extruder_clearance_radius == 0) {
return true;
- Polygons convex_hulls_other;
- if (polygons != nullptr)
+ }
+ Polygons convex_hulls_other;
+ if (polygons != nullptr) {
polygons->clear();
+ }
std::vector<size_t> intersecting_idxs;
std::map<ObjectID, Polygon> map_model_object_to_convex_hull;
@@ -975,15 +977,14 @@ Flow Print::skirt_flow(size_t extruder_id, bool first_layer/*=false*/) const
throw Slic3r::InvalidArgument("skirt_first_layer_height() can't be called without PrintObjects");
//get extruder used to compute first layer height
- double max_nozzle_diam;
+ double max_nozzle_diam = 0.f;
for (PrintObject* pobject : m_objects) {
PrintObject& object = *pobject;
std::set<uint16_t> object_extruders;
for (const PrintRegion& region : pobject->all_regions()) {
PrintRegion::collect_object_printing_extruders(config(), object.config(), region.config(), object_extruders);
}
- //get object first layer extruder
- int first_layer_extruder = 0;
+ //get object first layer extruder diam
for (uint16_t extruder_id : object_extruders) {
double nozzle_diameter = config().nozzle_diameter.values[extruder_id];
max_nozzle_diam = std::max(max_nozzle_diam, nozzle_diameter);
@@ -1034,17 +1035,21 @@ void Print::process()
name_tbb_thread_pool_threads_set_locale();
bool something_done = !is_step_done_unguarded(psSkirtBrim);
BOOST_LOG_TRIVIAL(info) << "Starting the slicing process." << log_memory_info();
- for (PrintObject *obj : m_objects)
+ for (PrintObject* obj : m_objects) {
obj->make_perimeters();
+ }
//note: as object seems to be sliced independantly, it's maybe possible to add a tbb parallel_loop with simple partitioner on infill,
// as prepare_infill has some function not //
- for (PrintObject *obj : m_objects)
+ for (PrintObject* obj : m_objects) {
obj->infill();
- for (PrintObject *obj : m_objects)
+ }
+ for (PrintObject* obj : m_objects) {
obj->ironing();
+ }
this->set_status(50, L("Generating support material"));
- for (PrintObject *obj : m_objects)
+ for (PrintObject* obj : m_objects) {
obj->generate_support_material();
+ }
if (this->set_started(psWipeTower)) {
m_wipe_tower_data.clear();
m_tool_ordering.clear();
@@ -1121,9 +1126,9 @@ void Print::process()
for (const PrintObject *object : obj_group)
if (!object->m_layers.empty())
for (const PrintInstance &pt : object->m_instances) {
- int first_idx = brim_area.size();
+ size_t first_idx = brim_area.size();
brim_area.insert(brim_area.end(), object->m_layers.front()->lslices.begin(), object->m_layers.front()->lslices.end());
- for (int i = first_idx; i < brim_area.size(); i++) {
+ for (size_t i = first_idx; i < brim_area.size(); i++) {
brim_area[i].translate(pt.shift.x(), pt.shift.y());
}
}
@@ -1374,7 +1379,7 @@ void Print::_make_skirt(const PrintObjectPtrs &objects, ExtrusionEntityCollectio
assert(extruded_length[extruder_idx] >= m_config.min_skirt_length.value);
// Enough extruded with the current extruder. Extrude with the next one,
// until the prescribed number of skirt loops is extruded.
- if (extruder_idx + 1 < extruders.size())
+ if (extruder_idx + 1 < extruders.size()) {
if (nb_skirts < current_lines_per_extruder) {
nb_skirts++;
} else {
@@ -1382,6 +1387,7 @@ void Print::_make_skirt(const PrintObjectPtrs &objects, ExtrusionEntityCollectio
nb_skirts = 1;
++extruder_idx;
}
+ }
}
} else {
// The skirt lenght is not limited, extrude the skirt with the 1st extruder only.
diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp
index 32a539437..1c62773d0 100644
--- a/src/libslic3r/PrintApply.cpp
+++ b/src/libslic3r/PrintApply.cpp
@@ -1452,11 +1452,12 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
#endif /* _DEBUG */
} // exit the mutex before re-using it via is_step_done
- if(!is_step_done(PrintObjectStep::posSlice))
+ if (!is_step_done(PrintObjectStep::posSlice)) {
this->m_timestamp_last_change = std::time(0);
- else if(!is_step_done(PrintStep::psSkirtBrim))
+ } else if (!is_step_done(PrintStep::psSkirtBrim)) {
// reset the modify time if not all step done
this->m_timestamp_last_change = std::time(0);
+ }
return static_cast<ApplyStatus>(apply_status);
}
diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp
index 43e9759bc..e5f299b22 100644
--- a/src/libslic3r/PrintBase.cpp
+++ b/src/libslic3r/PrintBase.cpp
@@ -94,7 +94,7 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
std::smatch matches;
std::string::const_iterator searchStart(filename_init.cbegin());
while (std::regex_search(searchStart, filename_init.cend(), matches, placehoder)) {
- for (int i = 0; i < matches.size(); i++) {
+ for (size_t i = 0; i < matches.size(); i++) {
filename.replace(matches.position(i), matches.length(i), matches.length(i), '_');
}
searchStart = matches.suffix().first;
@@ -108,13 +108,13 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
}catch(std::exception){}
}
if (!regexp_used) {
- for(int i=0; i< forbidden_base.size(); i++)
+ for(size_t i = 0; i < forbidden_base.size(); i++)
std::replace(filename.begin(), filename.end(), forbidden_base.at(i), '_');
}
//re-put {print_time} and things like that
searchStart = (filename_init.cbegin());
while (std::regex_search(searchStart, filename_init.cend(), matches, placehoder)) {
- for (int i = 0; i < matches.size(); i++) {
+ for (size_t i = 0; i < matches.size(); i++) {
filename.replace(matches.position(i), matches.length(i), matches.str());
}
searchStart = matches.suffix().first;
diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp
index 8a967bc5f..8fbc24f3f 100644
--- a/src/libslic3r/PrintObject.cpp
+++ b/src/libslic3r/PrintObject.cpp
@@ -135,8 +135,8 @@ std::vector<std::reference_wrapper<const PrintRegion>> PrintObject::all_regions(
for (int i_poly = 0; i_poly < nb_polyhole; i_poly++) {
Polygon& pts = (((i_poly % 2) == 0) ? list[i_poly / 2] : list[(nb_polyhole + 1) / 2 + i_poly / 2]);
const float new_radius = radius / float(std::cos(PI / nb_edges));
- for (int i_edge = 0; i_edge < nb_edges; ++i_edge) {
- float angle = rotation * i_poly + (float(PI) * 2 * i_edge) / nb_edges;
+ for (size_t i_edge = 0; i_edge < nb_edges; ++i_edge) {
+ float angle = rotation * i_poly + (float(PI) * 2 * (float)i_edge) / nb_edges;
pts.points.emplace_back(center.x() + new_radius * cos(angle), center.y() + new_radius * sin(angle));
}
pts.make_clockwise();
@@ -206,7 +206,6 @@ std::vector<std::reference_wrapper<const PrintRegion>> PrintObject::all_regions(
//search & find hole that span at least X layers
const size_t min_nb_layers = 2;
- float max_layer_height = config().layer_height * 2;
for (size_t layer_idx = 0; layer_idx < this->m_layers.size(); ++layer_idx) {
for (size_t hole_idx = 0; hole_idx < layerid2center[layer_idx].size(); ++hole_idx) {
//get all other same polygons
@@ -1046,7 +1045,6 @@ bool PrintObject::invalidate_state_by_config_options(
ExPolygon polygon_reduced = polygon_to_check;
size_t pos_check = 0;
- bool has_del = false;
while ((polygon_reduced.contour.points.begin() + pos_check) != polygon_reduced.contour.points.end()) {
Point best_point = polygon_reduced.contour.points[pos_check].projection_onto(allowedPoints.contour);
for (const Polygon& hole : allowedPoints.holes) {
@@ -1085,7 +1083,6 @@ bool PrintObject::invalidate_state_by_config_options(
polygon_reduced = try_fit_to_size2(bigger_polygon[0], growing_area);
}
//ExPolygons to_check = offset_ex(polygon_to_cover, -offset);
- int idx = 0;
ExPolygons not_covered = diff_ex(polygon_to_cover, polygon_reduced, ApplySafetyOffset::Yes);
while (!not_covered.empty()) {
//not enough, use a bigger offset
@@ -1093,7 +1090,6 @@ bool PrintObject::invalidate_state_by_config_options(
float next_coverage = percent_coverage + (percent_coverage - current_coverage) * 4;
previous_offset = current_offset;
current_offset *= 2;
- double area = 0;
if (next_coverage < 0.1) current_offset *= 2;
//create the bigger polygon and test it
ExPolygons bigger_polygon = offset_ex(polygon_to_cover, double(current_offset));
@@ -1261,7 +1257,6 @@ bool PrintObject::invalidate_state_by_config_options(
} else {
double sparse_area = surf_with_overlap.area();
double area_to_cover = 0;
- double min_area_to_cover = 0;
if (dfaAutoNotFull == algo) {
// calculate area to decide if area is small enough for autofill
for (ExPolygon poly_inter : intersect)
@@ -1316,7 +1311,7 @@ bool PrintObject::invalidate_state_by_config_options(
dense = dense_test;
}
dense_polys.insert(dense_polys.end(), dense.begin(), dense.end());
- for (int i = 0; i < dense.size(); i++)
+ for (size_t i = 0; i < dense.size(); i++)
dense_priority.push_back(priority);
}
//assign (copy)
@@ -1339,7 +1334,7 @@ bool PrintObject::invalidate_state_by_config_options(
if (area_sparse > area_dense * 0.1) {
//split
//dense_polys = union_ex(dense_polys);
- for (int idx_dense = 0; idx_dense < dense_polys.size(); idx_dense++) {
+ for (size_t idx_dense = 0; idx_dense < dense_polys.size(); idx_dense++) {
ExPolygon dense_poly = dense_polys[idx_dense];
//remove overlap with perimeter
ExPolygons offseted_dense_polys = layerm->fill_no_overlap_expolygons.empty()
diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp
index 7d7422240..59ef689d8 100644
--- a/src/libslic3r/Utils.hpp
+++ b/src/libslic3r/Utils.hpp
@@ -17,6 +17,7 @@ namespace Slic3r {
extern void set_logging_level(unsigned int level);
extern unsigned get_logging_level();
+extern void trace(unsigned int level, const std::string& message);
extern void trace(unsigned int level, const char *message);
// Format memory allocated, separate thousands by comma.
extern std::string format_memsize_MB(size_t n);
diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp
index e90871d79..df14ee7bc 100644
--- a/src/libslic3r/utils.cpp
+++ b/src/libslic3r/utils.cpp
@@ -125,6 +125,10 @@ static struct RunOnInit {
}
} g_RunOnInit;
+void trace(unsigned int level, const std::string& message)
+{
+ trace(level, message.c_str());
+}
void trace(unsigned int level, const char *message)
{
boost::log::trivial::severity_level severity = level_to_boost(level);
diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp
index 2ad9703d8..b5caa25d1 100644
--- a/src/slic3r/GUI/3DBed.cpp
+++ b/src/slic3r/GUI/3DBed.cpp
@@ -175,10 +175,10 @@ Bed3D::Bed3D()
}
}
catch (const std::ifstream::failure& err) {
- trace(1, (std::string("The color file cannot be loaded. Reason: ") + err.what(), path_colors.string()).c_str());
+ trace(1, (std::string("The color file cannot be loaded. Reason: ") + err.what(), path_colors.string()));
}
catch (const std::runtime_error& err) {
- trace(1, (std::string("Failed loading the color file. Reason: ") + err.what(), path_colors.string()).c_str());
+ trace(1, (std::string("Failed loading the color file. Reason: ") + err.what(), path_colors.string()));
}
}
diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp
index 5705ff8a3..61bc1b978 100644
--- a/src/slic3r/GUI/GCodeViewer.cpp
+++ b/src/slic3r/GUI/GCodeViewer.cpp
@@ -637,10 +637,10 @@ GCodeViewer::GCodeViewer()
}
}
catch (const std::ifstream::failure& err) {
- trace(1, (std::string("The color file cannot be loaded. Reason: ") + err.what(), path_colors.string()).c_str());
+ trace(1, (std::string("The color file cannot be loaded. Reason: ") + err.what(), path_colors.string()));
}
catch (const std::runtime_error& err) {
- trace(1, (std::string("Failed loading the color file. Reason: ") + err.what(), path_colors.string()).c_str());
+ trace(1, (std::string("Failed loading the color file. Reason: ") + err.what(), path_colors.string()));
}
}
diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp
index 1d0e4679f..36240abf9 100644
--- a/src/slic3r/GUI/PresetComboBoxes.cpp
+++ b/src/slic3r/GUI/PresetComboBoxes.cpp
@@ -134,7 +134,7 @@ void PresetComboBox::OnSelect(wxCommandEvent& evt)
auto selected_item = evt.GetSelection();
//protected as selected_item is often at a weird value
- if (selected_item < this->GetCount() && selected_item >= 0) {
+ if (selected_item < (int)this->GetCount() && selected_item >= 0) {
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX)
this->SetSelection(m_last_selected);
@@ -502,7 +502,7 @@ wxBitmap* PresetComboBox::get_bmp( std::string bitmap_key, const std::string& m
bool PresetComboBox::is_selected_physical_printer()
{
auto selected_item = this->GetSelection();
- if (selected_item >= this->GetCount() || selected_item < 0)
+ if (selected_item >= (int)this->GetCount() || selected_item < 0)
std::cout << "qfohadfh \n";
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
return marker == LABEL_ITEM_PHYSICAL_PRINTER;
@@ -615,7 +615,7 @@ void PlaterPresetComboBox::OnSelect(wxCommandEvent &evt)
{
auto selected_item = evt.GetSelection();
- if (selected_item >= this->GetCount() || selected_item < 0)
+ if (selected_item >= (int)this->GetCount() || selected_item < 0)
std::cout << "qfoshiofh \n";
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
@@ -952,7 +952,7 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt)
// m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive.
// So, use GetSelection() from event parameter
auto selected_item = evt.GetSelection();
- if (selected_item >= this->GetCount() || selected_item < 0)
+ if (selected_item >= (int)this->GetCount() || selected_item < 0)
std::cout << "qfoazfhasuiofh \n";
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX) {