Fix a regression that second extruder settings not properly handled for H2D/X2D (#13648)

Fix a regression that second extruder settings not properly handled for H2D/X2D (OrcaSlicer/OrcaSlicer#13559)

The problem here is how it deals with comparasion between signed & unsigned unmbers. It will convert both into unsigned then do the comparasion,
which means when `extruder_id` is `-1` (which is a valid value, means all extruders), it will be treated as `0xFFFFFFFF` which is obviously greater than `nozzle_volumes->size()`
then be reset to `0`. So when the parameter dialog is built (which will call this function with `extruder_id=-1`), only the first extruder will be set to the correct variant index.
This commit is contained in:
Noisyfox
2026-05-13 20:48:50 +08:00
committed by GitHub
parent 34f7d562da
commit 1e11e80bd1

View File

@@ -7352,7 +7352,7 @@ void Tab::switch_excluder(int extruder_id)
{}, {"", "filament_extruder_variant"}, // Preset::TYPE_FILAMENT filament don't use id anymore
{}, {"printer_extruder_id", "printer_extruder_variant"}, // Preset::TYPE_PRINTER
};
if (!m_variant_combo && (extruder_id >= nozzle_volumes->size() || extruder_id >= extruders->size()))
if (!m_variant_combo && (extruder_id >= (int)nozzle_volumes->size() || extruder_id >= (int)extruders->size()))
extruder_id = 0;
if (m_extruder_switch && m_type != Preset::TYPE_PRINTER) {
int current_extruder = m_extruder_switch->GetValue() ? 1 : 0;