mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
Fix:crash when multicolor printing
jira: none Change-Id: I6289934a897644fb025acd20b59bea1a69995f89 (cherry picked from commit 576d931475c4b42582d78092e75ce0b0b7394ca7)
This commit is contained in:
@@ -823,25 +823,24 @@ int GLVolumeCollection::load_real_wipe_tower_preview(
|
||||
if (wt_mesh.its.vertices.empty()) return int(this->volumes.size() - 1);
|
||||
|
||||
std::vector<Slic3r::ColorRGBA> extruder_colors = GUI::wxGetApp().plater()->get_extruders_colors();
|
||||
std::vector<Slic3r::ColorRGBA> colors;
|
||||
GUI::PartPlateList &ppl = GUI::wxGetApp().plater()->get_partplate_list();
|
||||
std::vector<int> plate_extruders = ppl.get_plate(plate_idx)->get_extruders(true);
|
||||
|
||||
for (int extruder_id : plate_extruders) {
|
||||
if (extruder_id <= extruder_colors.size())
|
||||
colors.push_back(extruder_colors[extruder_id - 1]);
|
||||
std::vector<Slic3r::ColorRGBA> colors;
|
||||
if (!plate_extruders.empty()) {
|
||||
if (plate_extruders.front() <= extruder_colors.size())
|
||||
colors.push_back(extruder_colors[plate_extruders.front() - 1]);
|
||||
else
|
||||
colors.push_back(extruder_colors[0]);
|
||||
}
|
||||
|
||||
volumes.emplace_back(new GLWipeTowerVolume(colors));
|
||||
if (colors.empty()) return int(this->volumes.size() - 1);
|
||||
volumes.emplace_back(new GLWipeTowerVolume({colors}));
|
||||
GLWipeTowerVolume &v = *dynamic_cast<GLWipeTowerVolume *>(volumes.back());
|
||||
v.model_per_colors.resize(colors.size());
|
||||
auto mesh = wt_mesh;
|
||||
if (render_brim) {
|
||||
mesh.merge(brim_mesh);
|
||||
}
|
||||
if (!colors.empty()) {
|
||||
v.model_per_colors.resize(1);
|
||||
v.model_per_colors[0].init_from(mesh);
|
||||
}
|
||||
TriangleMesh wipe_tower_shell = mesh.convex_hull_3d();
|
||||
|
||||
Reference in New Issue
Block a user