mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-29 04:12:00 +08:00
Fix for #13038 - Fix a crash when loading tool changes for not-existing extruder
This commit is contained in:
parent
f86d329a70
commit
d9ef0f1781
@ -1248,6 +1248,9 @@ std::string DSForLayers::get_tooltip(int tick/*=-1*/)
|
||||
else if (conflict == ctMeaninglessToolChange)
|
||||
tooltip += _u8L("There is an extruder change set to the same extruder.\n"
|
||||
"This code won't be processed during G-code generation.");
|
||||
else if (conflict == ctNotPossibleToolChange)
|
||||
tooltip += _u8L("There is an extruder change set to the not existing extruder.\n"
|
||||
"This code won't be processed during G-code generation.");
|
||||
else if (conflict == ctRedundant)
|
||||
tooltip += _u8L("There is a color change for extruder that has not been used before.\n"
|
||||
"Check your settings to avoid redundant color changes.");
|
||||
|
@ -659,6 +659,9 @@ ConflictType TickCodeManager::is_conflict_tick(const TickCode& tick, Mode main_m
|
||||
// We should mark a tick as a "MeaninglessToolChange",
|
||||
// if it has a ToolChange to the same extruder
|
||||
auto it = ticks.find(tick);
|
||||
if (it->extruder > colors.size())
|
||||
return ctNotPossibleToolChange;
|
||||
|
||||
if (it == ticks.begin())
|
||||
return tick.extruder == std::max<int>(only_extruder_id, 1) ? ctMeaninglessToolChange : ctNone;
|
||||
|
||||
@ -676,6 +679,9 @@ std::string TickCodeManager::get_color_for_tool_change_tick(std::set<TickCode>::
|
||||
{
|
||||
const int current_extruder = it->extruder == 0 ? std::max<int>(only_extruder_id, 1) : it->extruder;
|
||||
|
||||
if (current_extruder > colors.size())
|
||||
return it->color;
|
||||
|
||||
auto it_n = it;
|
||||
while (it_n != ticks.begin()) {
|
||||
--it_n;
|
||||
|
@ -37,6 +37,7 @@ enum ConflictType
|
||||
ctModeConflict,
|
||||
ctMeaninglessColorChange,
|
||||
ctMeaninglessToolChange,
|
||||
ctNotPossibleToolChange,
|
||||
ctRedundant
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user