ENH: param tab variant index & extruder switch

Change-Id: Icad6bce3b23ea98d5ef497ceabacc52f294af8f2
(cherry picked from commit 575572f184dc49eb763aa0b27f52f375dcb52f2d)
This commit is contained in:
chunmao.guo 2024-07-01 18:37:46 +08:00 committed by Noisyfox
parent fab6b21e4d
commit f5d2a1bc0c
7 changed files with 158 additions and 71 deletions

View file

@ -693,7 +693,7 @@ void ConfigOptionsGroup::on_change_OG(const t_config_option_key& opt_id, const b
auto itOption = it->second;
const std::string &opt_key = itOption.first;
int opt_index = get_extruder_idx(*m_config, itOption.first, itOption.second);
int opt_index = itOption.second;
this->change_opt_value(opt_key, value, opt_index == -1 ? 0 : opt_index);
}
@ -752,7 +752,6 @@ void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config,
auto opt_id = m_opt_map.find(opt_key)->first;
std::string opt_short_key = m_opt_map.at(opt_id).first;
int opt_index = m_opt_map.at(opt_id).second;
opt_index = get_extruder_idx(*m_config, opt_short_key, opt_index);
value = get_config_value(config, opt_short_key, opt_index);
}
@ -783,7 +782,7 @@ void ConfigOptionsGroup::reload_config()
// option key (may be scalar or vector)
const std::string &opt_key = kvp.second.first;
// index in the vector option, zero for scalars
int opt_index = get_extruder_idx(*m_config, kvp.second.first, kvp.second.second);
int opt_index = kvp.second.second;
const ConfigOptionDef &option = m_options.at(opt_id).opt;
this->set_value(opt_id, config_value(opt_key, opt_index, option.gui_flags == "serialized"));
}
@ -1279,9 +1278,6 @@ void ExtruderOptionsGroup::on_change_OG(const t_config_option_key& opt_id, const
const std::string& opt_key = itOption.first;
int opt_index = itOption.second;
if (printer_extruder_options.find(opt_key) == printer_extruder_options.end()) {
opt_index = get_extruder_idx(*m_config, itOption.first, itOption.second);
}
this->change_opt_value(opt_key, value, opt_index == -1 ? 0 : opt_index);
}