Reduction on compiler warnings, mainly on MSVC.

Fix of the new gap_fill_enable flag: Take it into account when comparing
regions.
This commit is contained in:
Vojtech Bubnik 2021-02-10 17:28:56 +01:00
parent 2964421618
commit db2d78ff21
21 changed files with 61 additions and 44 deletions

View file

@ -380,7 +380,7 @@ ExtrusionEntityCollection make_brim(const Print &print, PrintTryCancel try_cance
}
#endif // BRIM_DEBUG_TO_SVG
all_loops = connect_brim_lines(std::move(all_loops), offset(islands_area_ex,SCALED_EPSILON), flow.scaled_spacing() * 2);
all_loops = connect_brim_lines(std::move(all_loops), offset(islands_area_ex, float(SCALED_EPSILON)), flow.scaled_spacing() * 2.f);
#ifdef BRIM_DEBUG_TO_SVG
{

View file

@ -15,7 +15,7 @@ static constexpr float ENFORCER_BLOCKER_PENALTY = 100;
// In case there are custom enforcers/blockers, the loop polygon shall always have
// sides smaller than this (so it isn't limited to original resolution).
static constexpr float MINIMAL_POLYGON_SIDE = scale_(0.2f);
static constexpr float MINIMAL_POLYGON_SIDE = scaled<float>(0.2f);
// When spAligned is active and there is a support enforcer,
// add this penalty to its center.

View file

@ -11,7 +11,16 @@
#include <cereal/access.hpp>
#define BOOST_VORONOI_USE_GMP 1
#ifdef _MSC_VER
// Suppress warning C4146 in include/gmp.h(2177,31): unary minus operator applied to unsigned type, result still unsigned
#pragma warning(push)
#pragma warning(disable : 4146)
#endif // _MSC_VER
#include "boost/polygon/voronoi.hpp"
#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER
namespace ClipperLib {
class PolyNode;

View file

@ -147,7 +147,8 @@ void Layer::make_perimeters()
&& config.perimeters == other_config.perimeters
&& config.perimeter_speed == other_config.perimeter_speed
&& config.external_perimeter_speed == other_config.external_perimeter_speed
&& config.gap_fill_speed == other_config.gap_fill_speed
&& (config.gap_fill_enabled ? config.gap_fill_speed.value : 0.) ==
(other_config.gap_fill_enabled ? other_config.gap_fill_speed.value : 0.)
&& config.overhangs == other_config.overhangs
&& config.opt_serialize("perimeter_extrusion_width") == other_config.opt_serialize("perimeter_extrusion_width")
&& config.thin_walls == other_config.thin_walls

View file

@ -305,7 +305,7 @@ void PerimeterGenerator::process()
// internal flow which is unrelated.
coord_t min_spacing = coord_t(perimeter_spacing * (1 - INSET_OVERLAP_TOLERANCE));
coord_t ext_min_spacing = coord_t(ext_perimeter_spacing * (1 - INSET_OVERLAP_TOLERANCE));
bool has_gap_fill = this->config->gap_fill_speed.value > 0 && this->config->gap_fill_enabled.value;
bool has_gap_fill = this->config->gap_fill_enabled.value && this->config->gap_fill_speed.value > 0;
// prepare grown lower layer slices for overhang detection
if (this->lower_slices != NULL && this->config->overhangs) {
@ -316,10 +316,6 @@ void PerimeterGenerator::process()
m_lower_slices_polygons = offset(*this->lower_slices, float(scale_(+nozzle_diameter/2)));
}
// fuzzy skin configuration
double fuzzy_skin_thickness = scale_(this->config->fuzzy_skin_thickness);
double fuzzy_skin_point_dist = scale_(this->config->fuzzy_skin_point_dist);
// we need to process each island separately because we might have different
// extra perimeters for each one
for (const Surface &surface : this->slices->surfaces) {

View file

@ -290,6 +290,12 @@ void Preset::normalize(DynamicPrintConfig &config)
static_cast<ConfigOptionStrings*>(opt)->values.resize(n, std::string());
}
}
if (const auto *gap_fill_speed = config.option<ConfigOptionFloat>("gap_fill_speed", false); gap_fill_speed && gap_fill_speed->value <= 0.) {
// Legacy conversion. If the gap fill speed is zero, it means the gap fill is not enabled.
// Set the new gap_fill_enabled value, so that it will show up in the UI as disabled.
if (auto *gap_fill_enabled = config.option<ConfigOptionBool>("gap_fill_enabled", false); gap_fill_enabled)
gap_fill_enabled->value = false;
}
}
std::string Preset::remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config)
@ -406,7 +412,7 @@ const std::vector<std::string>& Preset::print_options()
"layer_height", "first_layer_height", "perimeters", "spiral_vase", "slice_closing_radius",
"top_solid_layers", "top_solid_min_thickness", "bottom_solid_layers", "bottom_solid_min_thickness",
"extra_perimeters", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters", "thin_walls", "overhangs",
"seam_position", "external_perimeters_first", "gap_fill_enabled", "fill_density", "fill_pattern", "top_fill_pattern", "bottom_fill_pattern",
"seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "top_fill_pattern", "bottom_fill_pattern",
"infill_every_layers", "infill_only_where_needed", "solid_infill_every_layers", "fill_angle", "bridge_angle",
"solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first",
"ironing", "ironing_type", "ironing_flowrate", "ironing_speed", "ironing_spacing",
@ -417,7 +423,7 @@ const std::vector<std::string>& Preset::print_options()
#endif /* HAS_PRESSURE_EQUALIZER */
"perimeter_speed", "small_perimeter_speed", "external_perimeter_speed", "infill_speed", "solid_infill_speed",
"top_solid_infill_speed", "support_material_speed", "support_material_xy_spacing", "support_material_interface_speed",
"bridge_speed", "gap_fill_speed", "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration",
"bridge_speed", "gap_fill_speed", "gap_fill_enabled", "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration",
"bridge_acceleration", "first_layer_acceleration", "default_acceleration", "skirts", "skirt_distance", "skirt_height", "draft_shield",
"min_skirt_length", "brim_width", "brim_offset", "brim_type", "support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers",
"raft_layers", "support_material_pattern", "support_material_with_sheath", "support_material_spacing",

View file

@ -558,13 +558,6 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("gap_fill_enabled", coBool);
def->label = L("Fill gaps");
def->category = L("Layers and Perimeters");
def->tooltip = L("Enables small gap fill.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def = this->add("extra_perimeters", coBool);
def->label = L("Extra perimeters if needed");
def->category = L("Layers and Perimeters");
@ -1072,6 +1065,13 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.8));
def = this->add("gap_fill_enabled", coBool);
def->label = L("Fill gaps");
def->category = L("Layers and Perimeters");
def->tooltip = L("Enables filling of gaps between perimeters and between the inner most perimeters and infill.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def = this->add("gap_fill_speed", coFloat);
def->label = L("Gap fill");
def->category = L("Speed");

View file

@ -567,13 +567,13 @@ public:
ConfigOptionFloatOrPercent external_perimeter_speed;
ConfigOptionBool external_perimeters_first;
ConfigOptionBool extra_perimeters;
ConfigOptionBool gap_fill_enabled;
ConfigOptionFloat fill_angle;
ConfigOptionPercent fill_density;
ConfigOptionEnum<InfillPattern> fill_pattern;
ConfigOptionEnum<FuzzySkinType> fuzzy_skin;
ConfigOptionFloat fuzzy_skin_thickness;
ConfigOptionFloat fuzzy_skin_point_dist;
ConfigOptionBool gap_fill_enabled;
ConfigOptionFloat gap_fill_speed;
ConfigOptionFloatOrPercent infill_anchor;
ConfigOptionFloatOrPercent infill_anchor_max;
@ -624,13 +624,13 @@ protected:
OPT_PTR(external_perimeter_speed);
OPT_PTR(external_perimeters_first);
OPT_PTR(extra_perimeters);
OPT_PTR(gap_fill_enabled);
OPT_PTR(fill_angle);
OPT_PTR(fill_density);
OPT_PTR(fill_pattern);
OPT_PTR(fuzzy_skin);
OPT_PTR(fuzzy_skin_thickness);
OPT_PTR(fuzzy_skin_point_dist);
OPT_PTR(gap_fill_enabled);
OPT_PTR(gap_fill_speed);
OPT_PTR(infill_anchor);
OPT_PTR(infill_anchor_max);

View file

@ -136,7 +136,7 @@ public:
const TColor & background,
GammaFn && gammafn)
: m_resolution(res)
, m_pxdim_scaled(SCALING_FACTOR / pd.w_mm, SCALING_FACTOR / pd.h_mm)
, m_pxdim_scaled(SCALING_FACTOR, SCALING_FACTOR)
, m_buf(res.pixels())
, m_rbuf(reinterpret_cast<TValue *>(m_buf.data()),
unsigned(res.width_px),
@ -147,6 +147,9 @@ public:
, m_renderer(m_raw_renderer)
, m_trafo(trafo)
{
// suppress false MSVC warning C4723: possible division by zero
m_pxdim_scaled.w_mm /= pd.w_mm;
m_pxdim_scaled.h_mm /= pd.h_mm;
m_renderer.color(foreground);
clear(background);

View file

@ -1128,8 +1128,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
// Subtracting them as they are may leave unwanted narrow
// residues of diff_polygons that would then be supported.
diff_polygons = diff(diff_polygons,
offset(union_(to_polygons(std::move(blockers[layer_id]))),
1000.*SCALED_EPSILON));
offset(union_(to_polygons(std::move(blockers[layer_id]))), float(1000.*SCALED_EPSILON)));
}
#ifdef SLIC3R_DEBUG