mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 19:05:59 +08:00
Fixed crash when scaling to fit (SPE-2361):
the crash occured when scaling to fit on a circular bed with the object containing non-part volumes
This commit is contained in:
parent
1e035ee33d
commit
8dbf197e4e
@ -1205,6 +1205,10 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
|
|||||||
double max_z = 0.0;
|
double max_z = 0.0;
|
||||||
for (unsigned int i : m_list) {
|
for (unsigned int i : m_list) {
|
||||||
const GLVolume& v = *(*m_volumes)[i];
|
const GLVolume& v = *(*m_volumes)[i];
|
||||||
|
if (v.convex_hull() == nullptr) {
|
||||||
|
// E.g. negative meshes do not have a convex hull... (hotfix for SPE-2361)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
TriangleMesh hull_3d = *v.convex_hull();
|
TriangleMesh hull_3d = *v.convex_hull();
|
||||||
hull_3d.transform(v.world_matrix());
|
hull_3d.transform(v.world_matrix());
|
||||||
max_z = std::max(max_z, hull_3d.bounding_box().size().z());
|
max_z = std::max(max_z, hull_3d.bounding_box().size().z());
|
||||||
@ -1250,6 +1254,10 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
|
|||||||
remove_volumes(m_mode, to_remove);
|
remove_volumes(m_mode, to_remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: It should really only account for the model parts when scaling to fit. Not for modifiers,
|
||||||
|
// support enforcers / blockers and negative meshes.
|
||||||
|
|
||||||
|
|
||||||
switch (volume.type())
|
switch (volume.type())
|
||||||
{
|
{
|
||||||
case BuildVolume::Type::Rectangle: { undoredo_snapshot = fit_rectangle(volume, !undoredo_snapshot); break; }
|
case BuildVolume::Type::Rectangle: { undoredo_snapshot = fit_rectangle(volume, !undoredo_snapshot); break; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user