Skip to content

Commit

Permalink
fix linux
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jun 27, 2024
2 parents 6881be5 + 4aa6f4c commit d56de1b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/PlaceholderParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ void PlaceholderParser::parse_custom_variables(const ConfigOptionStrings& filame
std::map<std::string, std::vector<std::string>> name2var_array;
const std::vector<std::string> empty_array(filament_custom_variables.size());

for (int extruder_id = 0; extruder_id < filament_custom_variables.size(); ++extruder_id)
for (size_t extruder_id = 0; extruder_id < filament_custom_variables.size(); ++extruder_id)
{
std::string raw_text = filament_custom_variables.get_at(extruder_id);
boost::erase_all(raw_text, "\r");
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void Preset::normalize(DynamicPrintConfig &config)
static_cast<ConfigOptionVectorBase*>(opt)->resize(n, defaults.option(key));
}
// The following keys are mandatory for the UI, but they are not part of FullPrintConfig, therefore they are handled separately.
for (const std::string &key : { "filament_settings_id" }) {
for (const char *key : {"filament_settings_id"}) {
auto *opt = config.option(key, false);
assert(opt == nullptr || opt->type() == coStrings);
if (opt != nullptr && opt->type() == coStrings)
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ DynamicConfig PrintStatistics::config() const
DynamicConfig PrintStatistics::placeholders()
{
DynamicConfig config;
for (const std::string &key : {
for (const char *key : {
"print_time", "normal_print_time", "silent_print_time",
"used_filament", "extruded_volume", "total_cost", "total_weight",
"total_toolchanges", "total_wipe_tower_cost", "total_wipe_tower_filament",
Expand Down
63 changes: 35 additions & 28 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7917,17 +7917,19 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va

// In PrusaSlicer 2.3.0-alpha0 the "monotonic" infill was introduced, which was later renamed to "monotonous".
if (value == "monotonous" && (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern" || opt_key == "fill_pattern"
|| opt_key == "solid_fill_pattern" || opt_key == "bridge_fill_pattern" || opt_key == "support_material_interface_pattern"))
|| opt_key == "solid_fill_pattern" || opt_key == "bridge_fill_pattern" || opt_key == "support_material_interface_pattern")) {
value = "monotonic";
}
// some changes has occurs between rectilineargapfill and monotonicgapfill. Set them at the right value for each type
if (value == "rectilineargapfill" && (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern") )
value = "monotonicgapfill";
if (opt_key == "fill_pattern" || opt_key == "support_material_interface_pattern")
if (value == "rectilineargapfill")
if (opt_key == "fill_pattern" || opt_key == "support_material_interface_pattern") {
if (value == "rectilineargapfill") {
value = "rectilinear";
else if (value == "monotonicgapfill")
} else if (value == "monotonicgapfill") {
value = "monotonic";

}
}
if (ignore.find(opt_key) != ignore.end()) {
opt_key = "";
return;
Expand All @@ -7937,9 +7939,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
opt_key = "raft_first_layer_density";
value = "100";
}
if (boost::starts_with(opt_key, "thin_perimeters") && value == "1")
if (boost::starts_with(opt_key, "thin_perimeters") && value == "1") {
value = "100%";

}
if ("fan_always_on" == opt_key) {
if (value != "1") {
//min_fan_speed is already converted to default_fan_speed, just has to deactivate it if not always_on
Expand Down Expand Up @@ -7968,8 +7970,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
}
}
}
if (remove_unkown_keys)
if (remove_unkown_keys) {
opt_key = "";
}
return;
}
}
Expand Down Expand Up @@ -8149,13 +8152,13 @@ void _convert_from_prusa(CONFIG_CLASS& conf, const DynamicPrintConfig& global_co
// set phony entries
if (with_phony) {
for (auto &[opt_key_width, opt_key_spacing] :
{std::pair<char *, char *>{"extrusion_width", "extrusion_spacing"},
std::pair<char *, char *>{"perimeter_extrusion_width", "perimeter_extrusion_spacing"},
std::pair<char *, char *>{"external_perimeter_extrusion_width", "external_perimeter_extrusion_spacing"},
std::pair<char *, char *>{"first_layer_extrusion_width", "first_layer_extrusion_spacing"},
std::pair<char *, char *>{"infill_extrusion_width", "infill_extrusion_spacing"},
std::pair<char *, char *>{"solid_infill_extrusion_width", "solid_infill_extrusion_spacing"},
std::pair<char *, char *>{"top_infill_extrusion_width", "top_infill_extrusion_spacing"}}) {
{std::pair<const char *, const char *>{"extrusion_width", "extrusion_spacing"},
std::pair<const char *, const char *>{"perimeter_extrusion_width", "perimeter_extrusion_spacing"},
std::pair<const char *, const char *>{"external_perimeter_extrusion_width", "external_perimeter_extrusion_spacing"},
std::pair<const char *, const char *>{"first_layer_extrusion_width", "first_layer_extrusion_spacing"},
std::pair<const char *, const char *>{"infill_extrusion_width", "infill_extrusion_spacing"},
std::pair<const char *, const char *>{"solid_infill_extrusion_width", "solid_infill_extrusion_spacing"},
std::pair<const char *, const char *>{"top_infill_extrusion_width", "top_infill_extrusion_spacing"}}) {
// if prusa has defined a width, or if the conf has a default spacing that need to be overwritten
if (conf.option(opt_key_width) != nullptr || conf.option(opt_key_spacing) != nullptr) {
ConfigOption *opt_new = print_config_def.get(opt_key_spacing)->default_value.get()->clone();
Expand Down Expand Up @@ -8256,13 +8259,13 @@ void _deserialize_maybe_from_prusa(const std::map<t_config_option_key, std::stri
if (with_phony) {
const ConfigDef *def = config.def();
for (const auto& [opt_key_width, opt_key_spacing] :
{std::pair<char *, char *>{"extrusion_width", "extrusion_spacing"},
std::pair<char *, char *>{"perimeter_extrusion_width", "perimeter_extrusion_spacing"},
std::pair<char *, char *>{"external_perimeter_extrusion_width", "external_perimeter_extrusion_spacing"},
std::pair<char *, char *>{"first_layer_extrusion_width", "first_layer_extrusion_spacing"},
std::pair<char *, char *>{"infill_extrusion_width", "infill_extrusion_spacing"},
std::pair<char *, char *>{"solid_infill_extrusion_width", "solid_infill_extrusion_spacing"},
std::pair<char *, char *>{"top_infill_extrusion_width", "top_infill_extrusion_spacing"}}) {
{std::pair<const char *, const char *>{"extrusion_width", "extrusion_spacing"},
std::pair<const char *, const char *>{"perimeter_extrusion_width", "perimeter_extrusion_spacing"},
std::pair<const char *, const char *>{"external_perimeter_extrusion_width", "external_perimeter_extrusion_spacing"},
std::pair<const char *, const char *>{"first_layer_extrusion_width", "first_layer_extrusion_spacing"},
std::pair<const char *, const char *>{"infill_extrusion_width", "infill_extrusion_spacing"},
std::pair<const char *, const char *>{"solid_infill_extrusion_width", "solid_infill_extrusion_spacing"},
std::pair<const char *, const char *>{"top_infill_extrusion_width", "top_infill_extrusion_spacing"}}) {
const ConfigOption *opt_width = config.option(opt_key_width);
const ConfigOption *opt_spacing = config.option(opt_key_spacing);
if (opt_width && opt_spacing) {
Expand Down Expand Up @@ -8771,8 +8774,6 @@ std::map<std::string, std::string> PrintConfigDef::to_prusa(t_config_option_key&
std::string coma = "";
for (std::string &size : sizes) {
//if first or second dimension is 0: ignore.
size_t test1 = size.find("0x");
size_t test2 = size.find("x0");
if (size.find("0x") == 0 || size.find("x0") + 2 == size.size())
continue;
assert(size.find('/') == std::string::npos);
Expand Down Expand Up @@ -8822,8 +8823,10 @@ DynamicPrintConfig* DynamicPrintConfig::new_from_defaults_keys(const std::vector

const ConfigOption *MultiPtrPrintConfig::optptr(const t_config_option_key &opt_key) const
{
for (auto conf : storages) {
for (ConfigBase *conf : storages) {
#ifdef _DEBUG
assert(conf->exists());
#endif
const ConfigOption *opt = conf->optptr(opt_key);
if (opt)
return opt;
Expand All @@ -8833,8 +8836,10 @@ const ConfigOption *MultiPtrPrintConfig::optptr(const t_config_option_key &opt_k
ConfigOption *MultiPtrPrintConfig::optptr(const t_config_option_key &opt_key, bool create)
{
assert(!create);
for (auto conf : storages) {
for (ConfigBase *conf : storages) {
#ifdef _DEBUG
assert(conf->exists());
#endif
ConfigOption *opt = conf->optptr(opt_key);
if (opt)
return opt;
Expand All @@ -8846,8 +8851,10 @@ t_config_option_keys MultiPtrPrintConfig::keys() const
assert(false);
// shouldn't need ot call that
t_config_option_keys keys;
for (auto conf : storages) {
for (ConfigBase *conf : storages) {
#ifdef _DEBUG
assert(conf->exists());
#endif
append(keys, conf->keys());
}
return keys;
Expand Down Expand Up @@ -8919,7 +8926,7 @@ double min_object_distance(const ConfigBase *config, double ref_height /* = 0*/)
double base_dist = 0;
//std::cout << "START min_object_distance =>" << base_dist << "\n";
const ConfigOptionBool* co_opt = config->option<ConfigOptionBool>("complete_objects");
if (config->option("parallel_objects_step")->get_float() > 0 || co_opt && co_opt->value) {
if ((config->option("parallel_objects_step")->get_float() > 0) || (co_opt && co_opt->value)) {
double skirt_dist = 0;
try {
std::vector<double> vals = dynamic_cast<const ConfigOptionFloats*>(config->option("nozzle_diameter"))->get_values();
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GraphDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ GraphPanel::GraphPanel(wxWindow *parent, GraphData data, const GraphSettings &se
//stream.get();

// min & max
Pointfs &data_points = data.data();
Pointfs data_points = data.data();
if (!data_points.empty()) {
for (Vec2d &point : data_points) {
m_last_min_y = std::min(m_last_min_y, (point.y()));
Expand Down

0 comments on commit d56de1b

Please sign in to comment.