FIX: update filament map of plate when switching preset

that has different nozzle nums
jira:none

Change-Id: If78571ddf4fa7ac17e7dcf47013075821b8567a6
This commit is contained in:
zhimin.zeng 2024-07-12 17:01:54 +08:00 committed by lane.wei
parent ed98163973
commit a6ad5c8be8
3 changed files with 19 additions and 1 deletions

View File

@ -2853,6 +2853,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;
@ -2865,7 +2871,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;
@ -5911,6 +5916,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;

View File

@ -482,6 +482,7 @@ public:
std::vector<int> get_filament_maps();
void set_filament_maps(const std::vector<int>& f_maps);
void on_extruder_count_changed(int extruder_count);
void set_filament_count(int filament_count);
void on_filament_added();
void on_filament_deleted(int filament_count, int filament_id);
@ -914,6 +915,8 @@ public:
void init_cali_texture_info();
void load_cali_textures();
void on_extruder_count_changed(int extruder_count);
void set_filament_count(int filament_count);
void on_filament_deleted(int filament_count, int filament_id);
void on_filament_added(int filament_count);

View File

@ -3816,6 +3816,8 @@ void TabPrinter::extruders_count_changed(size_t extruders_count)
m_preset_bundle->printers.get_edited_preset().set_num_extruders(extruders_count);
m_preset_bundle->update_multi_material_filament_presets();
is_count_changed = true;
wxGetApp().plater()->get_partplate_list().on_extruder_count_changed((int)m_extruders_count);
}
// BBS
#if 1