FIX: update filament map of plate when switching preset

that has different nozzle nums
jira:none

Change-Id: If78571ddf4fa7ac17e7dcf47013075821b8567a6
(cherry picked from commit a6ad5c8be86313085922e3063eec2aba029a5a99)
This commit is contained in:
zhimin.zeng
2024-07-12 17:01:54 +08:00
committed by Noisyfox
parent 0135b251cd
commit d6864a161c
3 changed files with 19 additions and 1 deletions

View File

@@ -3198,6 +3198,12 @@ void PartPlate::set_filament_maps(const std::vector<int>& f_maps)
filament_maps = f_maps;
}
void PartPlate::on_extruder_count_changed(int extruder_count)
{
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
std::fill(filament_maps.begin(), filament_maps.end(), 1);
}
void PartPlate::set_filament_count(int filament_count)
{
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
@@ -3210,7 +3216,6 @@ void PartPlate::on_filament_added()
filament_maps.push_back(1);
}
void PartPlate::on_filament_deleted(int filament_count, int filament_id)
{
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
@@ -5793,6 +5798,14 @@ void PartPlateList::load_cali_textures()
PartPlateList::is_load_cali_texture = true;
}
void PartPlateList::on_extruder_count_changed(int extruder_count)
{
for (unsigned int i = 0; i < (unsigned int) m_plate_list.size(); ++i) {
m_plate_list[i]->on_extruder_count_changed(extruder_count);
}
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: extruder_count=%2%")% __FUNCTION__ %extruder_count;
}
void PartPlateList::set_filament_count(int filament_count)
{
m_filament_count = filament_count;