From 31e4a20f6dbded186e3a0d0c5b8fba9cb79029e6 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Aug 2022 15:25:32 +0200 Subject: [PATCH] "Printer settings" > "Bed shape" : Fixed an update of the revert buttons status, when custom bed texture and/or model is changed --- src/slic3r/GUI/OptionsGroup.cpp | 6 ++++++ src/slic3r/GUI/Tab.cpp | 32 ++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 6055a8e786..1855b6a4e5 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -597,6 +597,12 @@ void ConfigOptionsGroup::back_to_sys_value(const std::string& opt_key) void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config, const std::string& opt_key) { boost::any value; + if (opt_key == "bed_shape") { + for (const std::string& key : {"bed_custom_texture", "bed_custom_model"}) { + value = config.opt_string(key); + this->change_opt_value(key, value); + } + } if (opt_key == "extruders_count") { auto *nozzle_diameter = dynamic_cast(config.option("nozzle_diameter")); value = int(nozzle_diameter->values.size()); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index d422745a0e..f899d3d3f8 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -593,12 +593,32 @@ void Tab::update_changed_ui() const bool deep_compare = (m_type == Slic3r::Preset::TYPE_PRINTER || m_type == Slic3r::Preset::TYPE_SLA_MATERIAL); auto dirty_options = m_presets->current_dirty_options(deep_compare); auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare); - if (m_type == Preset::TYPE_PRINTER && static_cast(this)->m_printer_technology == ptFFF) { - TabPrinter* tab = static_cast(this); - if (tab->m_initial_extruders_count != tab->m_extruders_count) - dirty_options.emplace_back("extruders_count"); - if (tab->m_sys_extruders_count != tab->m_extruders_count) - nonsys_options.emplace_back("extruders_count"); + if (m_type == Preset::TYPE_PRINTER) { + { + auto check_bed_custom_options = [](std::vector& keys) { + bool was_deleted = false; + for (std::vector::iterator it = keys.begin(); it != keys.end(); ) { + if (*it == "bed_custom_texture" || *it == "bed_custom_model") { + it = keys.erase(it); + was_deleted = true; + } + else + ++it; + } + if (was_deleted && std::find(keys.begin(), keys.end(), "bed_shape") == keys.end()) + keys.emplace_back("bed_shape"); + }; + check_bed_custom_options(dirty_options); + check_bed_custom_options(nonsys_options); + } + + if (static_cast(this)->m_printer_technology == ptFFF) { + TabPrinter* tab = static_cast(this); + if (tab->m_initial_extruders_count != tab->m_extruders_count) + dirty_options.emplace_back("extruders_count"); + if (tab->m_sys_extruders_count != tab->m_extruders_count) + nonsys_options.emplace_back("extruders_count"); + } } for (auto& it : m_options_list)