mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 00:55:53 +08:00
Fix of assertation from sinking contour
assertation at: GLModel::init_from(Slic3r::GUI::GLModel::Geometry && data) Line 407 It is called from: GLVolume::SinkingContours::update() Line 357 polygons(defined on line 344) are empty. --> also init_data will be empty.
This commit is contained in:
parent
af663a81e1
commit
cbc138a525
@ -324,9 +324,22 @@ void GLVolume::SinkingContours::update()
|
||||
const int object_idx = m_parent.object_idx();
|
||||
const Model& model = GUI::wxGetApp().plater()->model();
|
||||
|
||||
if (0 <= object_idx && object_idx < int(model.objects.size()) && m_parent.is_sinking() && !m_parent.is_below_printbed()) {
|
||||
if (object_idx < 0 ||
|
||||
object_idx >= int(model.objects.size()) ||
|
||||
!m_parent.is_sinking() ||
|
||||
m_parent.is_below_printbed()){
|
||||
m_model.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
const BoundingBoxf3& box = m_parent.transformed_convex_hull_bounding_box();
|
||||
if (!m_old_box.size().isApprox(box.size()) || m_old_box.min.z() != box.min.z()) {
|
||||
if (m_old_box.size().isApprox(box.size()) &&
|
||||
m_old_box.min.z() == box.min.z()){
|
||||
// Fix it !!! It is not working all the time
|
||||
m_shift = box.center() - m_old_box.center();
|
||||
return;
|
||||
}
|
||||
|
||||
m_old_box = box;
|
||||
m_shift = Vec3d::Zero();
|
||||
|
||||
@ -342,6 +355,8 @@ void GLVolume::SinkingContours::update()
|
||||
MeshSlicingParams slicing_params;
|
||||
slicing_params.trafo = m_parent.world_matrix();
|
||||
const Polygons polygons = union_(slice_mesh(mesh.its, 0.0f, slicing_params));
|
||||
if (polygons.empty()) return;
|
||||
|
||||
for (const ExPolygon& expoly : diff_ex(expand(polygons, float(scale_(HalfWidth))), shrink(polygons, float(scale_(HalfWidth))))) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
const std::vector<Vec3d> triangulation = triangulate_expolygon_3d(expoly);
|
||||
@ -376,12 +391,6 @@ void GLVolume::SinkingContours::update()
|
||||
}
|
||||
m_model.init_from(init_data);
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
}
|
||||
else
|
||||
m_shift = box.center() - m_old_box.center();
|
||||
}
|
||||
else
|
||||
m_model.reset();
|
||||
}
|
||||
|
||||
#if ENABLE_SHOW_NON_MANIFOLD_EDGES
|
||||
|
Loading…
x
Reference in New Issue
Block a user