mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 22:21:59 +08:00
Merge branch 'lh_crash_SPE-2016'
This commit is contained in:
commit
a2e3dc1f09
@ -4917,6 +4917,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
||||
const Transform3d& projection_matrix = camera.get_projection_matrix();
|
||||
|
||||
const ModelObjectPtrs &model_objects = GUI::wxGetApp().model().objects;
|
||||
const int extruders_count = wxGetApp().extruders_edited_cnt();
|
||||
std::vector<ColorRGBA> extruders_colors = get_extruders_colors();
|
||||
for (GLVolume *vol : visible_volumes) {
|
||||
vol->model.set_color((vol->printable && !vol->is_outside) ? vol->color : ColorRGBA::GRAY());
|
||||
@ -4930,7 +4931,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
||||
shader->set_uniform("view_normal_matrix", view_normal_matrix);
|
||||
|
||||
const ModelVolume &model_volume = *model_objects[vol->object_idx()]->volumes[vol->volume_idx()];
|
||||
const size_t extruder_idx = get_extruder_color_idx(model_volume);
|
||||
const size_t extruder_idx = get_extruder_color_idx(model_volume, extruders_count);
|
||||
TriangleSelectorMmGui ts(model_volume.mesh(), extruders_colors, extruders_colors[extruder_idx]);
|
||||
ts.deserialize(model_volume.mmu_segmentation_facets.get_data(), true);
|
||||
ts.request_update_render_data();
|
||||
|
@ -529,7 +529,8 @@ void GLGizmoMmuSegmentation::update_model_object() const
|
||||
|
||||
void GLGizmoMmuSegmentation::init_model_triangle_selectors()
|
||||
{
|
||||
const ModelObject *mo = m_c->selection_info()->model_object();
|
||||
const int extruders_count = wxGetApp().extruders_edited_cnt();
|
||||
const ModelObject *mo = m_c->selection_info()->model_object();
|
||||
m_triangle_selectors.clear();
|
||||
|
||||
// Don't continue when extruders colors are not initialized
|
||||
@ -543,7 +544,7 @@ void GLGizmoMmuSegmentation::init_model_triangle_selectors()
|
||||
// This mesh does not account for the possible Z up SLA offset.
|
||||
const TriangleMesh *mesh = &mv->mesh();
|
||||
|
||||
size_t extruder_idx = get_extruder_color_idx(*mv);
|
||||
size_t extruder_idx = get_extruder_color_idx(*mv, extruders_count);
|
||||
m_triangle_selectors.emplace_back(std::make_unique<TriangleSelectorMmGui>(*mesh, m_modified_extruders_colors, m_original_extruders_colors[extruder_idx]));
|
||||
// Reset of TriangleSelector is done inside TriangleSelectorMmGUI's constructor, so we don't need it to perform it again in deserialize().
|
||||
m_triangle_selectors.back()->deserialize(mv->mmu_segmentation_facets.get_data(), false);
|
||||
|
@ -156,9 +156,12 @@ private:
|
||||
|
||||
std::vector<ColorRGBA> get_extruders_colors();
|
||||
|
||||
inline size_t get_extruder_color_idx(const ModelVolume &model_volume)
|
||||
inline size_t get_extruder_color_idx(const ModelVolume &model_volume, const int extruders_count)
|
||||
{
|
||||
return (model_volume.extruder_id() > 0) ? model_volume.extruder_id() - 1 : 0;
|
||||
if (const int extruder_id = model_volume.extruder_id(); extruder_id <= 0 || extruder_id > extruders_count)
|
||||
return 0;
|
||||
else
|
||||
return extruder_id - 1;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
Loading…
x
Reference in New Issue
Block a user