mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 05:06:17 +08:00
Fix crash in debug mode with empty preview
This commit is contained in:
parent
faf4d8e6b0
commit
8470d4594d
@ -6648,14 +6648,17 @@ void GLCanvas3D::_load_sla_shells()
|
|||||||
for (const SLAPrintObject* obj : print->objects()) {
|
for (const SLAPrintObject* obj : print->objects()) {
|
||||||
unsigned int initial_volumes_count = (unsigned int)m_volumes.volumes.size();
|
unsigned int initial_volumes_count = (unsigned int)m_volumes.volumes.size();
|
||||||
for (const SLAPrintObject::Instance& instance : obj->instances()) {
|
for (const SLAPrintObject::Instance& instance : obj->instances()) {
|
||||||
add_volume(*obj, 0, instance, obj->get_mesh_to_print(), GLVolume::MODEL_COLOR[0], true);
|
auto & m = obj->get_mesh_to_print();
|
||||||
// Set the extruder_id and volume_id to achieve the same color as in the 3D scene when
|
if (!m.empty()) {
|
||||||
// through the update_volumes_colors_by_extruder() call.
|
add_volume(*obj, 0, instance, m, GLVolume::MODEL_COLOR[0], true);
|
||||||
m_volumes.volumes.back()->extruder_id = obj->model_object()->volumes.front()->extruder_id();
|
// Set the extruder_id and volume_id to achieve the same color as in the 3D scene when
|
||||||
if (auto &tree_mesh = obj->support_mesh(); !tree_mesh.empty())
|
// through the update_volumes_colors_by_extruder() call.
|
||||||
add_volume(*obj, -int(slaposSupportTree), instance, tree_mesh, GLVolume::SLA_SUPPORT_COLOR, true);
|
m_volumes.volumes.back()->extruder_id = obj->model_object()->volumes.front()->extruder_id();
|
||||||
if (auto &pad_mesh = obj->pad_mesh(); !pad_mesh.empty())
|
if (auto &tree_mesh = obj->support_mesh(); !tree_mesh.empty())
|
||||||
add_volume(*obj, -int(slaposPad), instance, pad_mesh, GLVolume::SLA_PAD_COLOR, false);
|
add_volume(*obj, -int(slaposSupportTree), instance, tree_mesh, GLVolume::SLA_SUPPORT_COLOR, true);
|
||||||
|
if (auto &pad_mesh = obj->pad_mesh(); !pad_mesh.empty())
|
||||||
|
add_volume(*obj, -int(slaposPad), instance, pad_mesh, GLVolume::SLA_PAD_COLOR, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
double shift_z = obj->get_current_elevation();
|
double shift_z = obj->get_current_elevation();
|
||||||
for (unsigned int i = initial_volumes_count; i < m_volumes.volumes.size(); ++ i) {
|
for (unsigned int i = initial_volumes_count; i < m_volumes.volumes.size(); ++ i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user