FIX: Incorrect flush matrix update condition judgment

Due to the decimal portion of floating-point numbers generated during square root extraction, mismatched matrix sizes were mistakenly considered consistent, resulting in the flush matrix size not being corrected. Now we compare the square value to avoid errors.

jira: STUDIO-13727
Change-Id: I1f3768dab186b25c9ac4e85d4eff24913f15b3dc
(cherry picked from commit d0e9a8c3f3086b4ad2bc14bbfebd3d6ceff9eefc)
This commit is contained in:
songwei.li 2025-07-30 10:08:45 +08:00 committed by Noisyfox
parent 873fb30bc5
commit 86a828afd2

View file

@ -3898,7 +3898,7 @@ void PresetBundle::update_multi_material_filament_presets(size_t to_delete_filam
f_multiplier.resize(nozzle_nums, 1.f);
}
if (num_filaments != old_number_of_filaments) {
if ( (num_filaments * num_filaments) != size_t(old_matrix.size() / old_nozzle_nums) ) {
// First verify if purging volumes presets for each extruder matches number of extruders
std::vector<double>& filaments = this->project_config.option<ConfigOptionFloats>("flush_volumes_vector")->values;
while (filaments.size() < 2* num_filaments) {