Fix access violation when slicing project with print-by-object mode (#5984)

Fix issue that models with only one color become multicolor after slicing when print-by-object mode is used.
This applys the same fix as 612204b443
This commit is contained in:
Noisyfox 2024-07-30 22:32:15 +08:00 committed by GitHub
parent b5bf6aed6f
commit 783570ebf6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,10 +219,14 @@ ToolOrdering::ToolOrdering(const PrintObject &object, unsigned int first_extrude
// BBS // BBS
// Reorder the extruders to minimize tool switches. // Reorder the extruders to minimize tool switches.
std::vector<unsigned int> first_layer_tool_order;
if (first_extruder == (unsigned int) -1) { if (first_extruder == (unsigned int) -1) {
this->reorder_extruders(generate_first_layer_tool_order(object)); first_layer_tool_order = generate_first_layer_tool_order(object);
} }
else {
if (!first_layer_tool_order.empty()) {
this->reorder_extruders(first_layer_tool_order);
} else {
this->reorder_extruders(first_extruder); this->reorder_extruders(first_extruder);
} }