diff options
author | bubnikv <bubnikv@gmail.com> | 2017-12-01 20:55:57 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-12-01 20:55:57 +0300 |
commit | ca0626b168a15381ab499fe7d8153934a7889078 (patch) | |
tree | a8c86f5031658ef01d06521b0419267d472d91f1 /xs/src/slic3r/GUI/PresetBundle.cpp | |
parent | 354408c7e62f022d86a87fbc13301d4f6d488298 (diff) |
Fixed regression bugs regarding print validation,
fixed crashes when loading a config.ini with "compatible_printers"
disabled export of "compatible_printers" into gcode and config.ini
Enabled compatibility of printing multiple objects with support / no support
with a wipe tower.
Diffstat (limited to 'xs/src/slic3r/GUI/PresetBundle.cpp')
-rw-r--r-- | xs/src/slic3r/GUI/PresetBundle.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/xs/src/slic3r/GUI/PresetBundle.cpp b/xs/src/slic3r/GUI/PresetBundle.cpp index 143e34e7f..1f872ffd6 100644 --- a/xs/src/slic3r/GUI/PresetBundle.cpp +++ b/xs/src/slic3r/GUI/PresetBundle.cpp @@ -1,4 +1,4 @@ -//#undef NDEBUGc +//#undef NDEBUG #include <cassert> #include "PresetBundle.hpp" @@ -216,6 +216,8 @@ DynamicPrintConfig PresetBundle::full_config() const } } } + + out.erase("compatible_printers"); static const char *keys[] = { "perimeter", "infill", "solid_infill", "support_material", "support_material_interface" }; for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++ i) { @@ -278,8 +280,19 @@ void PresetBundle::load_config_file(const std::string &path) } // Load a config file from a boost property_tree. This is a private method called from load_config_file. -void PresetBundle::load_config_file_config(const std::string &path, const DynamicPrintConfig &config) +void PresetBundle::load_config_file_config(const std::string &path, DynamicPrintConfig &&config) { + // The "compatible_printers" field should not have been exported into a config.ini or a G-code anyway, + // but some of the alpha versions of Slic3r did. + { + ConfigOption *opt_compatible = config.optptr("compatible_printers"); + if (opt_compatible != nullptr) { + assert(opt_compatible->type() == coStrings); + if (opt_compatible->type() == coStrings) + static_cast<ConfigOptionStrings*>(opt_compatible)->values.clear(); + } + } + // 1) Create a name from the file name. // Keep the suffix (.ini, .gcode, .amf, .3mf etc) to differentiate it from the normal profiles. std::string name = boost::filesystem::path(path).filename().string(); @@ -310,7 +323,7 @@ void PresetBundle::load_config_file_config(const std::string &path, const Dynami if (other_opt->is_scalar()) { for (size_t i = 0; i < configs.size(); ++ i) configs[i].option(key, false)->set(other_opt); - } else { + } else if (key != "compatible_printers") { for (size_t i = 0; i < configs.size(); ++ i) static_cast<ConfigOptionVectorBase*>(configs[i].option(key, false))->set_at(other_opt, 0, i); } @@ -368,6 +381,14 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const } assert(! preset_name_dst.empty()); // Save preset_src->config into collection_dst under preset_name_dst. + // The "compatible_printers" field should not have been exported into a config.ini or a G-code anyway, + // but some of the alpha versions of Slic3r did. + ConfigOption *opt_compatible = preset_src->config.optptr("compatible_printers"); + if (opt_compatible != nullptr) { + assert(opt_compatible->type() == coStrings); + if (opt_compatible->type() == coStrings) + static_cast<ConfigOptionStrings*>(opt_compatible)->values.clear(); + } collection_dst.load_preset(path, preset_name_dst, std::move(preset_src->config), activate).is_external = true; return preset_name_dst; }; |