From 474e06ac858bf53956030fe45f47aa5d9c731178 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 3 Jan 2019 15:04:29 +0100 Subject: [PATCH 1/3] Fixed missing mirror transform data when increasing instances count --- src/libslic3r/Model.cpp | 3 ++- src/libslic3r/Model.hpp | 2 +- src/slic3r/GUI/Plater.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 20c4a44b2..900397f70 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -719,12 +719,13 @@ ModelInstance* ModelObject::add_instance(const ModelInstance &other) return i; } -ModelInstance* ModelObject::add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation) +ModelInstance* ModelObject::add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation, const Vec3d &mirror) { auto *instance = add_instance(); instance->set_offset(offset); instance->set_scaling_factor(scaling_factor); instance->set_rotation(rotation); + instance->set_mirror(mirror); return instance; } diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index e65228d80..947301437 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -200,7 +200,7 @@ public: ModelInstance* add_instance(); ModelInstance* add_instance(const ModelInstance &instance); - ModelInstance* add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation); + ModelInstance* add_instance(const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation, const Vec3d &mirror); void delete_instance(size_t idx); void delete_last_instance(); void clear_instances(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a1ca93d62..941a181d3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2628,7 +2628,7 @@ void Plater::increase_instances(size_t num) float offset = 10.0; for (size_t i = 0; i < num; i++, offset += 10.0) { Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0); - model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation()); + model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation(), model_instance->get_mirror()); // p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec)); } From 360dbca52e65633c3a15558ecfffaa248124ccf1 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 3 Jan 2019 15:43:03 +0100 Subject: [PATCH 2/3] Attempt to fix camera movements after importing object --- src/slic3r/GUI/GLCanvas3D.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 1695a532b..5fa09d334 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4896,6 +4896,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } m_mouse.set_start_position_2D_as_invalid(); + m_mouse.set_start_position_3D_as_invalid(); #endif } else if (evt.Leaving()) From 237eaa5f6f49bee0276c40ccc6fd85f1911831f2 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Thu, 3 Jan 2019 13:25:56 +0100 Subject: [PATCH 3/3] Fix #1526 --datadir not working --- src/libslic3r/PrintConfig.cpp | 7 +++++++ src/libslic3r/PrintConfig.hpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 215b17481..7da839dc3 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3118,6 +3118,13 @@ CLIConfigDef::CLIConfigDef() const CLIConfigDef cli_config_def; DynamicPrintAndCLIConfig::PrintAndCLIConfigDef DynamicPrintAndCLIConfig::s_def; +void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::string &value) const +{ + if (cli_config_def.options.find(opt_key) == cli_config_def.options.end()) { + PrintConfigDef::handle_legacy(opt_key, value); + } +} + std::ostream& print_cli_options(std::ostream& out) { for (const auto& opt : cli_config_def.options) { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 08f42f39b..8713ed03f 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1171,6 +1171,12 @@ public: const ConfigDef* def() const override { return &s_def; } t_config_option_keys keys() const override { return s_def.keys(); } + // Verify whether the opt_key has not been obsoleted or renamed. + // Both opt_key and value may be modified by handle_legacy(). + // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy(). + // handle_legacy() is called internally by set_deserialize(). + void handle_legacy(t_config_option_key &opt_key, std::string &value) const override; + private: class PrintAndCLIConfigDef : public ConfigDef {