"Printer settings" > "Bed shape" : Fixed an update of the revert buttons status, when custom bed texture and/or model is changed
This commit is contained in:
parent
c36af0e739
commit
31e4a20f6d
2 changed files with 32 additions and 6 deletions
|
@ -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<const ConfigOptionFloats*>(config.option("nozzle_diameter"));
|
||||
value = int(nozzle_diameter->values.size());
|
||||
|
|
|
@ -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<TabPrinter*>(this)->m_printer_technology == ptFFF) {
|
||||
TabPrinter* tab = static_cast<TabPrinter*>(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<std::string>& keys) {
|
||||
bool was_deleted = false;
|
||||
for (std::vector<std::string>::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<TabPrinter*>(this)->m_printer_technology == ptFFF) {
|
||||
TabPrinter* tab = static_cast<TabPrinter*>(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)
|
||||
|
|
Loading…
Reference in a new issue