SPE-2075: Fixed crash during thumbnail generation for SLA printers.

This commit is contained in:
Lukáš Hejl 2024-01-02 13:19:02 +01:00
parent 33b13b937c
commit 9a3c831020

View File

@ -4907,6 +4907,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
const ModelObjectPtrs &model_objects = GUI::wxGetApp().model().objects;
std::vector<ColorRGBA> extruders_colors = get_extruders_colors();
const bool is_enabled_painted_thumbnail = !model_objects.empty() && !extruders_colors.empty();
if (thumbnail_params.transparent_background)
glsafe(::glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
@ -4921,8 +4922,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
for (GLVolume *vol : visible_volumes) {
const int obj_idx = vol->object_idx();
const int vol_idx = vol->volume_idx();
const bool render_as_painted = (obj_idx >= 0 && vol_idx >= 0) ?
!model_objects[obj_idx]->volumes[vol_idx]->mmu_segmentation_facets.empty() : false;
const bool render_as_painted = is_enabled_painted_thumbnail && obj_idx >= 0 && vol_idx >= 0 && !model_objects[obj_idx]->volumes[vol_idx]->mmu_segmentation_facets.empty();
GLShaderProgram* shader = wxGetApp().get_shader(render_as_painted ? "mm_gouraud" : "gouraud_light");
if (shader == nullptr)
continue;