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
diff options
context:
space:
mode:
-rw-r--r--xs/src/libslic3r/GCode.cpp3
-rw-r--r--xs/src/libslic3r/Slicing.hpp2
-rw-r--r--xs/src/slic3r/GUI/PresetBundle.cpp27
-rw-r--r--xs/src/slic3r/GUI/PresetBundle.hpp2
-rw-r--r--xs/xsp/Print.xsp7
5 files changed, 32 insertions, 9 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index 4e5f8b8fa..a19fd8b53 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -794,7 +794,8 @@ bool GCode::_do_export(Print &print, FILE *file)
for (size_t i = 0; i < sizeof(configs) / sizeof(configs[0]); ++ i) {
StaticPrintConfig *cfg = configs[i];
for (const std::string &key : cfg->keys())
- fprintf(file, "; %s = %s\n", key.c_str(), cfg->serialize(key).c_str());
+ if (key != "compatible_printers")
+ fprintf(file, "; %s = %s\n", key.c_str(), cfg->serialize(key).c_str());
}
}
diff --git a/xs/src/libslic3r/Slicing.hpp b/xs/src/libslic3r/Slicing.hpp
index 1534e19f5..b4a074bb5 100644
--- a/xs/src/libslic3r/Slicing.hpp
+++ b/xs/src/libslic3r/Slicing.hpp
@@ -103,7 +103,7 @@ inline bool equal_layering(const SlicingParameters &sp1, const SlicingParameters
sp1.layer_height == sp2.layer_height &&
sp1.min_layer_height == sp2.min_layer_height &&
sp1.max_layer_height == sp2.max_layer_height &&
- sp1.max_suport_layer_height == sp2.max_suport_layer_height &&
+// sp1.max_suport_layer_height == sp2.max_suport_layer_height &&
sp1.first_print_layer_height == sp2.first_print_layer_height &&
sp1.first_object_layer_height == sp2.first_object_layer_height &&
sp1.first_object_layer_bridging == sp2.first_object_layer_bridging &&
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;
};
diff --git a/xs/src/slic3r/GUI/PresetBundle.hpp b/xs/src/slic3r/GUI/PresetBundle.hpp
index 571dea0be..451ec69c1 100644
--- a/xs/src/slic3r/GUI/PresetBundle.hpp
+++ b/xs/src/slic3r/GUI/PresetBundle.hpp
@@ -78,7 +78,7 @@ public:
void update_compatible_with_printer(bool select_other_if_incompatible);
private:
- void load_config_file_config(const std::string &path, const DynamicPrintConfig &config);
+ void load_config_file_config(const std::string &path, DynamicPrintConfig &&config);
void load_config_file_config_bundle(const std::string &path, const boost::property_tree::ptree &tree);
bool load_compatible_bitmaps();
diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp
index 852f0dde0..bdf7b8991 100644
--- a/xs/xsp/Print.xsp
+++ b/xs/xsp/Print.xsp
@@ -215,10 +215,11 @@ _constant()
bool has_infinite_skirt();
bool has_skirt();
std::vector<unsigned int> extruders() const;
- void validate() %code%{
+ int validate() %code%{
std::string err = THIS->validate();
- if (! err.empty())
- throw std::invalid_argument(err.c_str());
+ if (! err.empty())
+ croak("Configuration is not valid: %s\n", err.c_str());
+ RETVAL = 1;
%};
Clone<BoundingBox> bounding_box();
Clone<BoundingBox> total_bounding_box();